• 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.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

Order of GUI Triggers

Status
Not open for further replies.
Level 3
Joined
Sep 7, 2013
Messages
47
Hi,
I am not sure if this was already been asked but I am really in need to know this.

  • Trigger1
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Set x = 0
  • Trigger2
  • Events
    • Hero1 takes damage
  • Conditions
  • Actions
    • Set x = x + 1
  • Trigger3
  • Events
    • Hero1 takes damage
  • Conditions
  • Actions
    • Set x = x + 1
    • Custom Script: call BJDebugMsg(I2S(udg_x))
Now, the question is...
What will be shown in the BJDebugMsg? Is it 1? (x=0+1) or is it 2? (x=(0+1)+1)
Any help would be appreciated. Thanks in advance :D
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
The triggers are registered to an event.
The one being registered the first will be executed first (I think).
The triggers register themselves to an event on map loading.
The order of which trigger is registered first depends on the order in which they are made.

If I make a trigger and do my stuff and then I make another trigger, the first trigger is registered first.
So it doesn't matter where they are positioned in the triggers list.

At least that is how it should work.
I am not quite sure but it happens sometimes that they switch order.
I never trust those things any more and even stopped using normal events, but I think it has something to do when the editor is restarted.

If it is really important that the triggers are executed in a specific order, then use an event system.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
Well... I don't know (because I am lazy as shit) if there are any event systems in here but I created my own where I can run triggers on customized events and can give them a "priority".
The priority is a simple integer. Triggers with a low priority will be ran first and triggers with a high priority will be ran last... yea I think that I am kinda using MS logics right now.
 
Level 3
Joined
Sep 7, 2013
Messages
47
How do you do the "priority" you are speaking about? Teach me master :D
Anyways, I only need a single or two triggers to be run last. If only there is an easy and fast way...(because I am also lazy as shit) :D
 
Level 3
Joined
Sep 7, 2013
Messages
47
Hm... That is the best way if I only have 2 triggers (the one with higher priority and the one with lower). Because if I am going to do that, that means I have to put the timer function to all of my triggers in order for the trigger I want to be last to be run last. (not to mention it will run many times/instances). I agree that it will be hard for GUI, but I am accepting JASS/vJASS suggestions or ideas ;)
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
Well it is not so easy to use in GUI.
If you want a few things to be ran last, then you can create a timer that expires in 0 seconds and do the action when it expires.
That way, you are doing the thing after the event.

if it works for you it is fine, but this is really really bad especially for damage events, because after 0. seconds timer, the damage could've been dealt(the game may try to run 1 logical cycle before going back to the script), so you may be too late to the party by then.

But as I said, if it works for you, its fine enough
 
Status
Not open for further replies.
Top