| 04-17-2004, 02:43 PM | #1 |
ok now this freaking function is supposed to put units in order of how much life they have into a unit array. Right now i am working on getting the ordering right but for some reason i can't get this function to work cause the GUI expects a damned "endif" actually 2 of em. Can one find out where they belong? Also sometimes the GUI calles endloops endif's. Code:
function Order takes nothing returns nothing
local integer p = 1
local integer g = 1
local integer s = 1
local integer b = 1
local integer a = 1
loop
exitwhen b>udg_Pnumber*3
loop
exitwhen p > udg_Pnumber*3
loop
exitwhen g > udg_Pnumber*3
set udg_TargetsLife[b] = RMinBJ(udg_LifeTargets[g], udg_LifeTargets[p])
set g = g+1
endloop
set p = p + 1
endloop
loop
exitwhen a>udg_Pnumber*3
if udg_TargetsLife[b] == udg_LifeTargets[a] then
set udg_LifeTargets[a] = 20000*s
set s = s+1
exitwhen true
endif
set a = a+1
endloop
set b = b+1
endloop
endfuncton |
| 04-17-2004, 03:47 PM | #2 |
How about trying not to have an exitwhen inside an if. I haven't actually tried if it works, but that is the only suspicious thing I can find at a first glance. |
| 04-17-2004, 03:52 PM | #3 |
Usually "expected endif" means "endfunction is mispelled" (lol blizzard) |
| 04-17-2004, 04:19 PM | #4 |
Argh. Nothing else to be expected I suppose. It seems like there are always the need to translate from what compiler complains about to what really are wrong. Maybe this sillieness of the WE should be investigated (or already has bean?). |
| 04-17-2004, 05:00 PM | #5 |
exitwhens within ifs do work. I guess a way is to use PJass to get a different error message when you do not understand the WE one. |
| 04-17-2004, 05:02 PM | #6 |
omg that has got to the stupidest error i have ever made. Wow Lord Vexorian your my hero, definatly going into the credits for this one (and for the 15 functions that ripped form you =] ) PS: exitloop in if/thens are legal for future reference ^_^ |
| 04-17-2004, 07:40 PM | #7 |
Just to tell you, that is a parser error. If it really expected an endif it would have crashed. Why do you have the line exitwhen true in an if statement? That could be causing it. Isn't udg_LifeTargets[] a unit array? How could you compare real and unit arrays in the if statement then? |
