Warcraft III resources & community, 2003–2006 · archived

First JASS Function...err

3 posts
#1

First JASS Function...err

Hi, I just recently decided a map I'm working on would benefit from some JASS(lots of "Points"! :P )

Perhaps some JASS guru could educate me on why the following function throws 4 or more "Expected 'endloop'" errors.

I'm used to Javascript, and I must say....JASS is REALLY structured. Makes it difficult to learn without reading tutorials.

function Trig_Generate_Points_New_Actions takes nothing returns nothing

// Free Locations
loop
call RemoveLocation(udg_PointIndex[udg_PointCount])
set udg_PointCount = udg_PointCount-1
exitwhen udg_PointCount == 0
endloop

// Reset Tile Count
set udg_TileCount = 0

// Allocate Local Values
local integer RandomValue
local integer NumLoops = 0
local integer PosX
local integer PosY

endfunction


Although I plan to move away from locations, I need to know why the loop isn't ending despite there being an 'endloop'.

Thanks,
#2
Ahh, I logged onto bnet and pestered DarnYak. Apparently local variables can only be initialized before executable code. :D
#3
Yes no other natives can be called before declaration of local variables.