• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[JASS] trigger waiting the end of a function running

Status
Not open for further replies.
Level 2
Joined
Jun 5, 2006
Messages
18
hi...i've created a function in JASS (because it's really easier and shorter to use by giving it parameters instead using globals...)

unfortunately is necessary that this function uses some "Wait X" inside itself....

differently than if i do "Run trigger (ignoring conditions)", my triggers wait the ends of the function (and that's not good because this should be a thing that happens WHILE the trigger is running)

can you help me?Maybe i have to use a trigger to do this right?

here is the code (i will note post the GUI code because is very long)

JASS:
function FDDcastbar takes integer mySpell, integer myPg returns nothing
    local real intervalli = ( FDDspellinfoDELAY(mySpell) / 20.00 )
    local real lastInterval = ModuloReal(FDDspellinfoDELAY(mySpell), 20.00)
    local string castBar = " "
    local integer cicloA = 1
    local integer cicloB = 1
    loop
        exitwhen cicloA > 10
        set cicloB = 1
        loop
            exitwhen cicloB > cicloA
            set castBar = ( castBar + "|c00ffffffl |r" )
            set cicloB=cicloB+1
        endloop
        set cicloB=cicloA+1
        loop
            exitwhen cicloB > 10
            set castBar = ( castBar + "|c00ff0000l |r" )
            set cicloB=cicloB+1
        endloop
        call TriggerSleepAction( intervalli )
        if ( cicloA == 10 ) then
            call TriggerSleepAction( lastInterval )
        endif
        call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(myPg), udg_FDD_CastBar[myPg], castBar )
        set castBar = " "
        set cicloA=cicloA+1
    endloop
    call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(myPg), udg_FDD_CastBar[myPg], "|c00ffffff l l l l l l l l l l |r" )
endfunction

i've done it with a trigger:) (by simply adding the function to trigger actions)

a question...are there any better ways to do it?:O
 
Status
Not open for further replies.
Top