Importing DoWhile action on GUI

FlameSoul

New Member
Reaction score
0
Let's see if I can make this clear enough.
First, i want to create a "C like" DoWhile JASS function, it should be used like
"Do multiple actions while condition(=True)"
After that, i want to put that function in the world editor GUI so that i can select DoWhile like every other trigger function

Trigger:
  • Do action While condition



If the second is not possible, at least i would like to know how to put the JASS code in a trigger and how to use it in other triggers (i'm really new to this stuff, so, asume i know nothing).

Thanks!
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
JASS:
loop
    exitwhen i != n
    call Something()
endloop


?
 

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
As far as I know Jass loop == do while/while loop in c/c++

After that, i want to put that function in the world editor GUI so that i can select DoWhile like every other trigger function
You should check EGUI

But you don't really need this you could easily make a workaround
like
[lJASS]
if something[/lJASS]
[lJASS]Custom Script: exitwhen true
[/lJASS]
the above is in a "regular" gui loop

I might be wrong though...
 

jomik

New Member
Reaction score
17
Here, I just made it, seems to work :D
JASS:
//---------------------------------------------------------------------\\
// Call the function using a custom script in GUI like this:           \\
//     Custom script:   call while(udg_i, udg_n, gg_trg_Test2, true)   \\
//     Pass 2 integers, 1 trigger and a boolean to this function       \\
//       The integers has to be the same for this loop to run          \\
//      The trigger is the one you want the loop to call in GUI        \\
//The boolean chooses wether you want to check the trigger's conditions\\
// Remember to use the prefixes:                                       \\
//          udg_*variable name* for the variables when you call it     \\
//          gg_trg_*trigger name* for the trigger                      \\
//---------------------------------------------------------------------\\

library While
    function while takes integer i, integer n, trigger t, boolean f returns nothing
        loop
            exitwhen i != n
            if (f == true) then
                if TriggerEvaluate(t) then
                    call TriggerExecute(t)
                endif
            else
                call TriggerExecute(t)
            endif
        endloop
    endfunction
endlibrary


Just make a trigger and convert it to custom text. And call the function as shown in the comments here.
Added a BAAD test map :p - More so you can see how to call it.
 

Jesus4Lyf

Good Idea™
Reaction score
397
Lol jomik, that's terrible... it's an infinite loop sys. :thup:
And not GUI.

Basically, you can implement "Break" by Custom Script: exitwhen true
Put Custom Script: loop
at the start.
Put Custom Script: endloop
at the end.
Have your "while" condition, and if it is not met, then Custom Script: exitwhen true
:)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top