• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[General] Does "Wait for condition" works properly?

Status
Not open for further replies.
Level 17
Joined
Dec 11, 2014
Messages
2,004
Very inaccurate. It's just a loop with a wait in it.

JASS:
function SomeAction takes nothing returns nothing
    loop
        exitwhen MyCondition
        call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, someInterval)) //RMaxBJ makes sure the interval isn't lower than 0.1
    endloop
endfunction

//===========================================================================
function InitTrig_MyTrigger takes nothing returns nothing
    set gg_trg_MahTrig = CreateTrigger()
    call TriggerAddAction(gg_trg_MahTrig, function SomeAction)
endfunction

//I changed the code a little bit, so you can actually read it

If you understand JASS, this is how it works. If you don't, this is a trigger that has a single action, the Wait for Condition action, where the condition is MyCondition, the interval is someInterval, MahTrig is your trigger name and SomeAction are your actions.
 
Status
Not open for further replies.
Top