- Joined
- Mar 7, 2011
- Messages
- 124
Hi,
I just started learning how to use the editor today so I might have a few really stupid questions. Don't simplify the explanations though, I should be able to keep up.
I already read the nifty oop struct tutorial, so thank you azn for that.
Anyways here's my problem in condensed form:
OK so the jasshelper compiler says that I've got an undeclared variable Wheel at the line that ive marked with my big question. Here's what it looks like in jasshelper
I don't think I should be running into any problems with a static method calling a non static, since its really a instance variable calling the nonstatic method (.createwheel)
From the sound of the error it almost seems like I'd need to wait to call any methods in my struct until after the constructor has been fully finished, but that seems like such a huge flaw I can't even imagine blizzard would have made JASS that way.
My other question has to do with running a different method periodically
I found this in the functions list
but periodic stuff is usually dangerous and I don't know how wc3 handles its trigger evaluations. so basically my question is, is that function ok? rotatewheel can be a pretty heavy operation, if that makes a difference.
I just started learning how to use the editor today so I might have a few really stupid questions. Don't simplify the explanations though, I should be able to keep up.
I already read the nifty oop struct tutorial, so thank you azn for that.
Anyways here's my problem in condensed form:
JASS:
struct Wheel
//my first question is should it be:
private hashtable myunits
//or
private hashtable myunits = InitHashtable()
.
. //lots of irrelevant methods (all in the Wheel struct)
.
method createwheel takes nothing returns hashtable
//stuff that works
return units //IS of type hashtable
endmethod
static method create takes nothing returns Wheel
local Wheel newwheel = Wheel.allocate()
set newwheel.myunits = newwheel.createwheel //<==== my big question
return newwheel
endmethod
endstruct
OK so the jasshelper compiler says that I've got an undeclared variable Wheel at the line that ive marked with my big question. Here's what it looks like in jasshelper
Code:
set s__Wheel_myunits[newwheel]=Wheel.getMethod(createwheel,newwheel)
I don't think I should be running into any problems with a static method calling a non static, since its really a instance variable calling the nonstatic method (.createwheel)
From the sound of the error it almost seems like I'd need to wait to call any methods in my struct until after the constructor has been fully finished, but that seems like such a huge flaw I can't even imagine blizzard would have made JASS that way.
My other question has to do with running a different method periodically
I found this in the functions list
JASS:
call TriggerRegisterTimerEventPeriodic(new.rotatewheel, .03)