| 03-27-2004, 04:55 AM | #1 |
I was referencing Lord Vexorian's mech map and I see this: "Custom script: loop" in conjuction with "Custom script: exitwhen" Where are those or what series of trigger bits are those representing? I would expect "custom script: loop" to be a fairly obvious "loop" action.. but i can't find anything that says "loop" anywhere except with the integers, but I don't need intergers.. I just need it to loop until a given variable hits a number. Nevermind, that's just making things confusing.. How do I loop a set of actions, that's my question. |
| 03-27-2004, 11:21 AM | #2 |
you can loop actions with the use of any Variables and array, but what kind of loop do you need? Can you give a exemple ? |
| 03-29-2004, 03:33 AM | #3 | |
Quote:
kinda sounds like you dont need integers but you do |
| 03-29-2004, 08:56 AM | #4 | |
Quote:
You can say that again. I mean, it's damn simple really. I'm looking at Lord Vexorian's spell and thinking "There's GOT to be a simple "loop this until the given conditions are met".. But I can't seem to find it. Look at Lord Vexorian's Mech spell map, and look at the anti-materia spell to see what I'm talkin about. |
| 03-29-2004, 09:13 AM | #5 |
A loop in JASS looks like this: Code:
loop
exitwhen (condition)
endloopUsing GUI with custom script you can make a loop like this, it will continue to loop until "tempBool" becomes equal to true. Code:
Custom script: loop
Set tempBool = ((SomeGroup) is empty)
Custom script: exitwhen udg_tempBool == true
-------- do stuff here --------
Wait 0.2 seconds
Custom script: endloop |
| 03-29-2004, 11:08 AM | #6 |
The == true in your exitwhen is not necessary. exitwhen udg_tempBool is enough (and means the same). |
| 03-29-2004, 05:58 PM | #7 |
You got me confused. How exactly does that trigger work? Like how does it determine how many times it loops? |
| 03-29-2004, 06:59 PM | #8 |
Under said JASS loop, it loops forever until the exit value becomes true. |
| 03-29-2004, 07:13 PM | #9 |
Yeah, now you see what I was getting at. What you did Grater is exactly how I got around my little gui issue. I was just wondering if there was sucha thing within WE's gui trigger menu's. That little loop thing has some f'cking mad potential though.. to be able to look anything until a given condition is met.. and not just based on integers or something.. nice.. |
| 03-29-2004, 08:24 PM | #10 |
Guess why we use JASS? heh, as sadly, GUI doesn't offer you this looping-potential -_- |
| 03-30-2004, 08:19 AM | #11 | |
Quote:
|
| 03-30-2004, 12:57 PM | #12 |
Well, I guess it also depends on the name of the variable. As an example if I have 2 booleans named attacking and defending and the first one is true if an attack is running, the second if you currently defend. Then I consider it more understandable if I have: if attacking then // do something elseif defending then // do something endif instead of: if attacking == true then // elseif defending == true then // endif |
| 03-30-2004, 06:53 PM | #13 |
Its also slightly slower to do it the second way because first what happens is that your boolean variable is storing a 0 or a 1 If (attacking)then is actually reading it as If(1 continue, 0 quit) But now your throwing in another expression it has to evaluate. if(attacking==true)then It now has to convert that into a 1 or a 0 then proceed onward with the path choosing operator. Its an extra step and it'll slow you down. |
| 03-30-2004, 07:41 PM | #14 |
ok, it is possible to do some loops with the regular functions, here is an example where I spawn any unit in a specific region. This works fairly well excaept if you have more than one unit in the region at a time it dosent stop right but Im sure there are ways around it, just havent been working on this map becuz not to many ppl like it. :\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ P1 Spawn Loop Events Time - Every 0.50 seconds of game time Conditions ((Entering unit) is A structure) Equal to False Actions Unit Group - Pick every unit in (Units in P1 Spawn enter <gen>) and do (Actions) Loop - Actions Unit - Create 1 (Unit-type of (Picked unit)) for Player 1 (Red) at (Center of P1 Spawn exit <gen>) facing Default building facing degrees ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ P1 Spawn Stop Events Player - Player 1 (Red)'s Food used becomes Greater than or equal to 100.00 Conditions ((Entering unit) is A structure) Equal to False Actions Trigger - Turn off P1 Spawn Loop <gen> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ P1 Spawn Restart Events Player - Player 1 (Red)'s Food used becomes Less than 100.00 Conditions Actions Trigger - Turn on P1 Spawn Loop <gen> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ there ya go sans, hope it helps. |
