When ever i convert the data to integer it does not work and sets it to 0.
What am i doing wrong here?
What am i doing wrong here?
JASS:
function Trig_maze_init_Actions takes nothing returns nothing
//local integer array g_grid
local integer array start
local integer array end
local integer x = 0
local integer y = 0
local integer i = 0
local integer xtemp = 0
local integer ytemp = 0
local real rad = 0
local boolean array options
local integer optionsused = 0
local boolean success = false
local string str = ""
loop
exitwhen x > 20
set y = 0
loop
exitwhen y > 20
set g_grid[x][y] = -1
set y = y + 1
endloop
set x = x + 1
endloop
set start[0] = 0
set start[1] = 0
set x = start[0]
set y = start[1]
set g_grid[x][y] = 0
loop
set optionsused = 0
loop
set options[0] = false
set options[1] = false
set options[2] = false
set options[3] = false
loop
set i = GetRandomInt(0,3)
exitwhen optionsused>3
exitwhen options<i> == false
endloop
set rad = (i*bj_PI)/2
set xtemp = R2I(Cos(rad))
set ytemp = R2I(Sin(rad))
call BJDebugMsg(I2S(xtemp)+","+R2S(Sin(rad)))
call BJDebugMsg("rad = "+R2S(rad))
set success = false
if (x <=20) then
if (x >= 0) then
if (y <=20) then
if (y >= 0) then
if (g_grid[x+xtemp][y+ytemp]==-1) then
set success = true
call BJDebugMsg("TEST")
endif
endif
endif
endif
endif
if (success==false) then
set options<i> = true
set optionsused = optionsused + 1
endif
exitwhen optionsused > 3
exitwhen success == true
endloop
if success == true then
set i = i + (R2I(bj_PI)/2)
set g_grid[x+R2I(Cos(i))][y+R2I(Sin(i))] = 1
set i = i + ((3*R2I(bj_PI))/2)
set g_grid[x+R2I(Cos(i))][y+R2I(Sin(i))] = 1
set x = x + xtemp
set y = y + ytemp
set g_grid[x][y] = 0
call BJDebugMsg("TEST222")
endif
exitwhen success == false
endloop
set x = 0
set y = 0
loop
exitwhen y > 5
set x = 0
set str = ""
loop
exitwhen x > 20
set str = str + I2S(g_grid[x][y])
set x = x + 1
endloop
call BJDebugMsg(str)
set y = y + 1
endloop
endfunction
//===========================================================================
function InitTrig_maze_init takes nothing returns nothing
set gg_trg_maze_init = CreateTrigger( )
call TriggerAddAction( gg_trg_maze_init, function Trig_maze_init_Actions )
endfunction
</i></i>