Don't give silly functions that don't have any kind of sense, give me a spell that you don't understand or you want to know how it works, then I'll explain you 'what you want', but not so. So give me a func
Alright, I'm new at JASS coding. I can do trigger-enhanced spells pretty well, so I decided to pick this up. I decided to give Daelin's mass-sleep JASS a shot, and I've got a slight problem. He says, "Make this the only and first spell made," In refrence to the raw code. I...uhh...didn't. Is there any way to check what the raw code is for this spell, or any way to set it to what I know it will be? If so, thanks.
Edit: Scratch that! Upon rereading the tutorial my 5th, 6th time i noticed that handy-dandy little "Convert to custom text" thing....hehe...That's what you get for reading an English book AND this...
Whats wrong with this, its just a test trigger for using locals
the errors I get only contains the ones with the local a, what to I do wrong?
Is the only problem that the local is after the first function?
function Trig_Untitled_Trigger_003_Actions takes nothing returns nothing
set a = ( a + "1" )
call DisplayTextToForce( GetPlayersAll(), a )
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_003 takes nothing returns nothing
set gg_trg_Untitled_Trigger_003 = CreateTrigger( )
local string a
call TriggerRegisterTimerEventPeriodic( gg_trg_Untitled_Trigger_003, 1.00 )
call TriggerAddAction( gg_trg_Untitled_Trigger_003, function Trig_Untitled_Trigger_003_Actions )
endfunction
Well, your problem is more than obvious. Locals are visible (can be used) only in the function in which you declare them, not trigger. Conclusion? Your code should look like this:
function Trig_Untitled_Trigger_003_Actions takes nothing returns nothing
local string a
set a = ( a + "1" )
call DisplayTextToForce( GetPlayersAll(), a )
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_003 takes nothing returns nothing
set gg_trg_Untitled_Trigger_003 = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Untitled_Trigger_003, 1.00 )
call TriggerAddAction( gg_trg_Untitled_Trigger_003, function Trig_Untitled_Trigger_003_Actions )
endfunction
Oh, and be careful, you must declare locals in a function BEFORE doing anything else. For example, in your section function you did this:
set gg_trg_Untitled_Trigger_003 = CreateTrigger( )
local string a
INCORRECT! Setting a value to a variable is also an action. This is correct:
local string a
set gg_trg_Untitled_Trigger_003 = CreateTrigger( )
So basically in the sidebar with all the actions, I put the take and return values for those into the function? And what if a function has more than one action, then do you put the take and return values for all of them? And if so, and there are two of the same take or return values, do you leave it as one, or put two in?
~VanMavus
#60
The rest of Daelin's original post has been moved to its own topic