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

Servers monitoring and the Addons Editor

We present you two legends. All dreams come true.

Servers monitoring The Addons Editor

Digest April

We talk about what was done and updated in the past month. We help keep abreast of events.

Read more

Game tooltips

Tooltips provide a way for 3rd party fansites and extensions to display detailed information on mouseover.

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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