Jump to content
Alloder.pro: about Allods with love
Search In
  • More options...
Find results that contain...
Find results in...

New program for writers

We turn from quantity to quality and tell you how we will supplement the Allods Team program with rewards in rubles.

More

The new Updater

Let us to introduce the new addon updater software and to share the details

Read more

Alloder 2.0

We have started the process of project evolve, and this relates not only, and not even primarily of the site's view

Read more

Blinking widget


Setras
 Share

Recommended Posts

Hi guys. I need a simple and nice way to make a widget blink like 10 times and stop blinking.

Problem is... It's possible that there will be dozens of such widgets and i don't want to store a global var-table containing info about "how much times did certain widget blink"... And i want them to blink like... repeatedly...

Let's share ideas about making it effective and fast?

Link to comment
Share on other sites

Aloha!

You can make yourself a little helper library, which basically will launch given sequence of effects, say

Code:

local sequence = {}

for k = 1, 10 do

  table.insert( sequence, { 0.5, 1, 1000 + 50 * k, EA_SYMMETRIC_FLASH } )

end

fxlib.PlayFadeEffectSequence( widget, sequence )

Each cell in this sequence is a set of arguments for AO Lua API widget method "PlayFadeEffect". It can be used like

Code:

local cell = sequence [ i ] 

widget:PlayFadeEffect( unpack( cell ) )

Library itself can register on demand a single handler for API event "EVENT_EFFECT_FINISHED", which will identify current playing sequence and launch effect for next sequence cell from library's internal hash. Something like

Code:

handlers [ "EVENT_EFFECT_FINISHED" ]  = function( event )

  local widget = event.wtOwner

  local instanceID = widget:GetInstanceId()

  local sequence = hash [ instanceID ] 

  if sequence then

    local i = sequence.i or 1

    local cell = sequence [ i ] 

    sequence.i = i + 1

    if cell then

      widget:PlayFadeEffect( unpack( cell ) )

    else

      widget:FinishFadeEffect()

      hash  [ instanceID ]  = nil

    end

end

You can expand this approach on all types of widget effects in AO, and as outcome you'll get most effective and powerful AO user-made library ever existed.

Cheers! =)

P.S. Sorry for rubbish English, can't use Google translator.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

By using our site you agree to the Terms of Use