EdgeOfChaos
E
EdgeOfChaos
I don't even know if what I'm trying to do is possible, but I'd very much like a way to do this.
I want to use a timer inside of a struct to register a piece of code to it, whenever the struct is instantiated. This is what I have:
It gives me a syntax error on this line:
It's obviously not detecting the piece of code "checkArea1". How would I get it to detect this, if possible?
I want to use a timer inside of a struct to register a piece of code to it, whenever the struct is instantiated. This is what I have:
JASS:
struct Patroler extends MazeObstacle
real x2
real y2
timer t1
timer t2
method getX2 takes nothing returns real
return .x2
endmethod
method setX2 takes real x2 returns nothing
set .x2 = x2
endmethod
method getY2 takes nothing returns real
return .y2
endmethod
method setY2 takes real y2 returns nothing
set .y2 = y2
endmethod
method checkArea1 takes nothing returns nothing
endmethod
method start takes nothing returns nothing
set .t1 = CreateTimer()
set .t2 = CreateTimer()
call TimerStart(.t1,0.33,true,function .checkArea1)
endmethod
static method create takes integer id, boolean kill, real x, real y, real x2, real y2 returns Patroler
local Patroler new = Patroler.allocate(id,kill,x,y)
call new.setX2(x2)
call new.setY2(y2)
call new.start()
return new
endmethod
endstruct
It gives me a syntax error on this line:
JASS:
call TimerStart(.t1,0.33,true,function .checkArea1)
It's obviously not detecting the piece of code "checkArea1". How would I get it to detect this, if possible?