| 12-29-2008, 12:34 PM | #1 |
Over at TheHelper, kirbyman1 just found a sweet bug, which enables GUI users to use Loops in Conditions see here: http://www.thehelper.net/forums/showthread.php?t=115281 it works like following: place a "if then else (multiple)" action, add a condition, and then change the "if then else (multiple)" to a loop... so you got a condition in a loop. no you have to make an additionally loop below it, and drag and drop your first loop in this loops action block. Now change the outer loop in a "if then else (multiple)" EDIT: Sorry my example sucked xD... EXample by Artificial Trigger: generates following code: JASS:function Trig_Example_Func001Func002Func001C takes nothing returns boolean if ( not ( GetTriggerUnit() == udg_Caster[GetForLoopIndexA()] ) ) then return false endif return true endfunction function Trig_Example_Func001C takes nothing returns boolean set bj_forLoopAIndex = 1 set bj_forLoopAIndexEnd = 10 loop exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd if ( Trig_Example_Func001Func002Func001C() ) then return true else endif set bj_forLoopAIndex = bj_forLoopAIndex + 1 endloop return false return true endfunction function Trig_Example_Actions takes nothing returns nothing if ( Trig_Example_Func001C() ) then call KillUnit( udg_Targets[GetForLoopIndexA()] ) else endif endfunction //=========================================================================== function InitTrig_Example takes nothing returns nothing set gg_trg_Example = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Example, EVENT_PLAYER_UNIT_DEATH ) call TriggerAddAction( gg_trg_Example, function Trig_Example_Actions ) endfunction |
| 12-29-2008, 01:51 PM | #2 |
Wait... how is that a bug? Why wouldn't you be able to do that? |
| 12-29-2008, 03:22 PM | #3 |
With that bug, you can change this: Trigger: ... to this: Trigger: The code in the OP shows how, by doing this multiple times, you can end up with complex loops in Conditions blocks. Very interesting bug; it could help GUI users make more logical, structured code, I guess. |
| 12-29-2008, 03:49 PM | #4 |
Instead of the one you posted in Post #1, you could also make Trigger: Well, i guess i'm too much into vJASS. |
| 12-29-2008, 05:47 PM | #5 |
This sounds like it's really helpful (as a GUI user), but I can't think of an application of this right now... Anyway, thanks for posting here. |
| 12-29-2008, 07:44 PM | #6 | |
Quote:
yes ur right the example is not that good :) but there can be applications where you can need something like that :) hmm ....well most probably nothing can be achieved with this bug, which could not been achieved without the bug aswell, but perhaps it will make code sometimes more readable (After some time thinking about it i believe this will be probably pretty uncommon) . |
| 12-29-2008, 08:25 PM | #7 |
Not very different from placing the check in your actions, and using Skip Remaining Actions. Actually, I'd recommend continuing to do that, since Blizzard might just fix this bug and royally **** your triggers. [Haha, as if blizzard would fix a bug in the editor] |
| 01-01-2009, 08:48 AM | #8 |
I remember doing this accidently all the time (and being annoyed as crap about it) back in the day. Pity the bug is pretty much totally useless. |
| 01-02-2009, 07:43 AM | #9 |
I may be retarded, but I don't see how this is useful at all... Seems like it just is another way to write something that was simple to write in the first place. |
| 01-03-2009, 01:56 AM | #10 | |
Quote:
|
