HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Second trigger waits?

05-29-2006, 04:37 AM#1
Zandose
If you run a second trigger from within a trigger will waits in the second trigger pause the first trigger?
05-29-2006, 04:57 AM#2
PipeDream
If you use the TriggerExecute(GUI trigger run) or ExecuteFunc functions, no. If you use the call statement, yes.
05-29-2006, 01:29 PM#3
Soultaker
Quote:
Originally Posted by PipeDream
If you use the TriggerExecute(GUI trigger run) or ExecuteFunc functions, no. If you use the call statement, yes.

I'm pretty sure it's otherwise.

Let me show this example:

Trigger:
Start
Collapse Events
Time - Elapsed game time is 0.01 seconds
Conditions
Collapse Actions
Set Test_Integer = 1
Trigger - Run Test <gen> (ignoring conditions)
Game - Display to (All players) for 30.00 seconds the text: (String(Test_Integer))

Trigger:
Test
Events
Conditions
Collapse Actions
Set Test_Integer = 2

It will then show "2" when you start up the game.

Conclusion: If you run a GUI trigger (b) from another GUI trigger (a), the first one (a) will pause untill the second one (b) is done.

- Soultaker
05-29-2006, 02:24 PM#4
The)TideHunter(
Yes, you are correct Soultaker, as Jass uses the same method as Java and most other laungages with reacursion.
Just in a different manner
05-29-2006, 02:31 PM#5
Thunder_Eye
putting a wait before the Test_Integer = 2 will return 1 instead
05-29-2006, 02:50 PM#6
The)TideHunter(
Yea, the wait will return a null to the reacursion, thus not returning a command to begin where it left off on the first trigger
05-29-2006, 03:07 PM#7
blu_da_noob
Quote:
Originally Posted by Soultaker
Conclusion: If you run a GUI trigger (b) from another GUI trigger (a), the first one (a) will pause untill the second one (b) is done.- Soultaker

That is true, unless trigger B uses waits, in which case trigger A will carry on running.
05-29-2006, 08:57 PM#8
PipeDream
Well duh; Run trigger interrupts the current thread, but they really are distinct threads that won't block each other when waiting. This isn't recursion in the usual vertical sense, it's horizontal, if that makes any sense.

To sum: If you use TriggerExecute, waits in the executed trigger will not block the first trigger. However, it does interrupt and begin executing immediately.
05-29-2006, 09:13 PM#9
The)TideHunter(
Its not really recursion, but i see it in a sense of that, it runs the requested thread then waits for it to get to the end then return back.

Yes it nearly has nothing to do with recursion, with the turn left or right with binary, but i just see it in a sense of recursion