HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Looping

01-23-2006, 07:39 PM#1
Thunder_Eye
Can anyone tell me why this doesnt work?
(Ab is an Ability array of 5) An is a spell, so is empty. At map intilization I set Ab[1-5]=Empty

Trigger:
For each (Integer A) from 1 to 5, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Ab[(Integer A)] Equal to Empty
Ab[((Integer A) - 1)] Not equal to An
(Ability being cast) Equal to An
Collapse Then - Actions
Unit - Remove An from (Casting unit)
Set Ab[(Integer A)] = An
Floating Text - Create floating text that reads An above (Casting unit) with Z offset 100.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
Set Float = (Last created floating text)
Else - Actions
01-23-2006, 07:49 PM#2
Anitarf
In what way does it not work? What is it supposed to do? Can we see the rest of the trigger? Are you sure you don't set your variable array somewhere else?
01-23-2006, 07:56 PM#3
Thunder_Eye
It is supposed to make a floating text with the spell name, and it doesnt. The trigger consists about 8 of these, one for each ability,
the Event is A unit begins casting an ability. (Ive also tried change it to "starts a effect"
The trigger is really long so I don't want to post it unless I really have to. It was much longer before I added the "For loops". Worked before I added those.

bah anyway, this is the original trigger, the other one is the one I use now
EDIT: The trigger is to long for the post

(set for bad english but I dont have time to think )
01-23-2006, 08:02 PM#4
Anitarf
Ok, here's a blind shot, at the end of "then-actions", put a "skip remaining actions". If that doesn't work, post the whole trigger.
01-23-2006, 08:03 PM#5
Thunder_Eye
Well I cant do that because in the end of the trigger it checks all the Ab[] and makes some stuff.

EDIT: There seem to be some kind of post limit I override with my long-long trigger :/
anyway this is how that part looks like in the original/working one
Previous Part

Trigger:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Ability being cast) Equal to An
Collapse Then - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Ab[1] Equal to Empty
Collapse Then - Actions
Unit - Remove An from Priest 0000 <gen>
Set Ab[1] = An
Set String[1] = (Name of Ab[1])
Floating Text - Create floating text that reads String[1] above Priest 0000 <gen> with Z offset 100.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
Set Float = (Last created floating text)
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Ab[2] Equal to Empty
Collapse Then - Actions
Unit - Remove An from Priest 0000 <gen>
Set Ab[2] = An
Set String[2] = (Name of Ab[2])
Floating Text - Create floating text that reads (String[1] + String[2]) above Priest 0000 <gen> with Z offset 100.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
Set Float = (Last created floating text)
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Ab[3] Equal to Empty
Collapse Then - Actions
Unit - Remove An from Priest 0000 <gen>
Set Ab[3] = An
Set String[3] = (Name of Ab[3])
Floating Text - Create floating text that reads (String[1] + (String[2] + String[3])) above Priest 0000 <gen> with Z offset 100.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
Set Float = (Last created floating text)
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Ab[4] Equal to Empty
Collapse Then - Actions
Unit - Remove An from Priest 0000 <gen>
Set Ab[4] = An
Set String[4] = (Name of Ab[4])
Floating Text - Create floating text that reads ((String[1] + String[2]) + (String[3] + String[4])) above Priest 0000 <gen> with Z offset 100.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
Set Float = (Last created floating text)
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Ab[5] Equal to Empty
Collapse Then - Actions
Unit - Remove An from Priest 0000 <gen>
Set Ab[5] = An
Set String[5] = (Name of Ab[5])
Floating Text - Create floating text that reads ((String[1] + String[2]) + (String[3] + (String[4] + String[5]))) above Priest 0000 <gen> with Z offset 100.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
Set Float = (Last created floating text)
Else - Actions
Else - Actions



What I need is some kind of "end loop when Ab[x] = An"
01-23-2006, 08:09 PM#6
Anitarf
If that's the case, complain about it in the Site Discussion forum and demand it fixed. Or, just try to post the trigger in 2 parts... or, just try to cut out the parts that repeat themselves, but nothing else and explain exactly what kind of parts were skipped. Anyway, I need to know what the full trigger looks like (and what's it supposed to do) to be able to help you.
01-23-2006, 08:11 PM#7
Thunder_Eye
Yeah I posted the part that repeats, it just changes the abilities, here comes the end (still original trigger)

previous end

Trigger:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Ab[1] Not equal to Empty
Ab[2] Not equal to Empty
Ab[3] Not equal to Empty
Ab[4] Not equal to Empty
Ab[5] Not equal to Empty
Collapse Then - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Ab[1] Equal to Kal
Ab[2] Equal to Vas
Ab[3] Equal to Xen
Ab[4] Equal to An
Ab[5] Equal to Flam
GreaterWaterEl[1] Equal to True
Collapse Then - Actions
Unit - Remove An from Priest 0000 <gen>
Unit - Remove Des from Priest 0000 <gen>
Unit - Remove Flam from Priest 0000 <gen>
Unit - Remove Kal from Priest 0000 <gen>
Unit - Remove Vas from Priest 0000 <gen>
Unit - Remove Xen from Priest 0000 <gen>
Unit - Remove Ylem from Priest 0000 <gen>
Unit - Remove Sanct from Priest 0000 <gen>
Unit - Add KalVasXenAnFlam to Priest 0000 <gen>
Wait 1.00 seconds
Floating Text - Destroy Float
Wait 2.00 seconds
Unit - Remove KalVasXenAnFlam from Priest 0000 <gen>
Unit - Add An to Priest 0000 <gen>
Unit - Add Des to Priest 0000 <gen>
Unit - Add Flam to Priest 0000 <gen>
Unit - Add Kal to Priest 0000 <gen>
Unit - Add Vas to Priest 0000 <gen>
Unit - Add Xen to Priest 0000 <gen>
Unit - Add Ylem to Priest 0000 <gen>
Unit - Add Sanct to Priest 0000 <gen>
Collapse For each (Integer B) from 1 to 5, do (Actions)
Collapse Loop - Actions
Set Ab[(Integer B)] = Empty
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Ab[1] Equal to An
Ab[2] Equal to Flam
Ab[3] Equal to Kal
Ab[4] Equal to Des
Ab[5] Equal to Ylem
Blizzard[1] Equal to True
Collapse Then - Actions
Unit - Remove An from Priest 0000 <gen>
Unit - Remove Des from Priest 0000 <gen>
Unit - Remove Flam from Priest 0000 <gen>
Unit - Remove Kal from Priest 0000 <gen>
Unit - Remove Vas from Priest 0000 <gen>
Unit - Remove Xen from Priest 0000 <gen>
Unit - Remove Ylem from Priest 0000 <gen>
Unit - Remove Sanct from Priest 0000 <gen>
Unit - Add AnFlamKalDesYlem to Priest 0000 <gen>
Wait 1.00 seconds
Floating Text - Destroy Float
Wait 2.00 seconds
Wait until ((Current order of Priest 0000 <gen>) Not equal to (Order(blizzard))), checking every 0.50 seconds
Unit - Remove AnFlamKalDesYlem from Priest 0000 <gen>
Unit - Add An to Priest 0000 <gen>
Unit - Add Des to Priest 0000 <gen>
Unit - Add Flam to Priest 0000 <gen>
Unit - Add Kal to Priest 0000 <gen>
Unit - Add Vas to Priest 0000 <gen>
Unit - Add Xen to Priest 0000 <gen>
Unit - Add Ylem to Priest 0000 <gen>
Unit - Add Sanct to Priest 0000 <gen>
Collapse For each (Integer B) from 1 to 5, do (Actions)
Collapse Loop - Actions
Set Ab[(Integer B)] = Empty
Collapse Else - Actions
Unit - Remove An from Priest 0000 <gen>
Unit - Remove Des from Priest 0000 <gen>
Unit - Remove Flam from Priest 0000 <gen>
Unit - Remove Kal from Priest 0000 <gen>
Unit - Remove Vas from Priest 0000 <gen>
Unit - Remove Xen from Priest 0000 <gen>
Unit - Remove Ylem from Priest 0000 <gen>
Unit - Remove Sanct from Priest 0000 <gen>
Floating Text - Destroy Float
Collapse For each (Integer B) from 1 to 5, do (Actions)
Collapse Loop - Actions
Set Ab[(Integer B)] = Empty
Unit - Add An to Priest 0000 <gen>
Unit - Add Des to Priest 0000 <gen>
Unit - Add Flam to Priest 0000 <gen>
Unit - Add Kal to Priest 0000 <gen>
Unit - Add Vas to Priest 0000 <gen>
Unit - Add Xen to Priest 0000 <gen>
Unit - Add Ylem to Priest 0000 <gen>
Unit - Add Sanct to Priest 0000 <gen>
Else - Actions

01-23-2006, 08:12 PM#8
Thunder_Eye
You can se the current repeating trigger on the first post. here comes the end.
(Sry for double post, Though It was needed this time)
current end

Trigger:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CSAb1[1] Not equal to Empty
CSAb1[2] Not equal to Empty
CSAb1[3] Not equal to Empty
CSAb1[4] Not equal to Empty
CSAb1[5] Not equal to Empty
Collapse Then - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CSAb1[1] Equal to Kal
CSAb1[2] Equal to Vas
CSAb1[3] Equal to Xen
CSAb1[4] Equal to An
CSAb1[5] Equal to Flam
Collapse Then - Actions
Collapse For each (Integer B) from 1 to 8, do (Actions)
Collapse Loop - Actions
Unit - Remove Abilities[(Integer B)] from (Casting unit)
Unit - Add KalVasXenAnFlam to (Casting unit)
Wait 1.00 seconds
Floating Text - Destroy CSFloat1
Wait 2.00 seconds
Unit - Remove KalVasXenAnFlam from (Casting unit)
Collapse For each (Integer B) from 1 to 8, do (Actions)
Collapse Loop - Actions
Unit - Add Abilities[(Integer B)] to (Casting unit)
Collapse For each (Integer B) from 1 to 5, do (Actions)
Collapse Loop - Actions
Set CSAb1[(Integer B)] = Empty
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CSAb1[1] Equal to An
CSAb1[2] Equal to Flam
CSAb1[3] Equal to Kal
CSAb1[4] Equal to Des
CSAb1[5] Equal to Ylem
Collapse Then - Actions
Collapse For each (Integer B) from 1 to 8, do (Actions)
Collapse Loop - Actions
Unit - Remove Abilities[(Integer B)] from (Casting unit)
Unit - Add AnFlamKalDesYlem to (Casting unit)
Wait 1.00 seconds
Floating Text - Destroy CSFloat1
Wait 2.00 seconds
Wait until ((Current order of (Casting unit)) Not equal to (Order(blizzard))), checking every 0.50 seconds
Unit - Remove AnFlamKalDesYlem from (Casting unit)
Collapse For each (Integer B) from 1 to 8, do (Actions)
Collapse Loop - Actions
Unit - Add Abilities[(Integer B)] to (Casting unit)
Collapse For each (Integer B) from 1 to 5, do (Actions)
Collapse Loop - Actions
Set CSAb1[(Integer B)] = Release Pet
Collapse Else - Actions
Collapse For each (Integer B) from 1 to 8, do (Actions)
Collapse Loop - Actions
Unit - Remove Abilities[(Integer B)] from Playerhero[(Player number of (Triggering player))]
Floating Text - Destroy CSFloat1
Collapse For each (Integer B) from 1 to 5, do (Actions)
Collapse Loop - Actions
Set CSAb1[(Integer B)] = Release Pet
Collapse For each (Integer B) from 1 to 8, do (Actions)
Collapse Loop - Actions
Unit - Add Abilities[(Integer B)] to Playerhero[(Player number of (Triggering player))]
Else - Actions

01-24-2006, 04:58 PM#9
Thunder_Eye
*bump (seems like no one reply's on posts thats more than 1 days old)
01-27-2006, 01:12 PM#10
Thunder_Eye
*bump again
01-27-2006, 04:28 PM#11
Anitarf
Put all the actions that come at the end in a seperate trigger, then, use the "skip remaining actions" as I suggested before, but before skipping, run that trigger; I *think* the event responses should carry over to the new trigger when run in this way, if not, then we'll think of something else.
01-27-2006, 04:51 PM#12
johnfn
Meh, Anitarf, there's a better way (or at least an equal way that doesn't involve another trigger :P), just make a local variable and set it to true when you need to (at the end of the then set of statements), and have (localvar = false) as one of the conditions in the if statement.
01-27-2006, 05:17 PM#13
Anitarf
If you do it like that, there's no need for the variable to be local.
01-27-2006, 06:19 PM#14
johnfn
You're right, I wondered why I said that after I did. Ah, there's always the possibility he has a wait in his trigger :D
01-28-2006, 10:45 AM#15
Thunder_Eye
How can it work just because I skip the other if/then/else?
Is it some kind of system overload that causes the problem?
And if so why did it work before I added all the "For Loops"?