[JASS] Syntax Error

Status
Not open for further replies.
Level 20
Joined
Jul 6, 2009
Messages
1,885
JASS:
function Dagger_Loop takes nothing returns nothing
    call BJDebugMsg("lol")
endfunction

function Dagger_Loop_Init takes nothing returns nothing
    ForGroup(udg_Daggers,function Dagger_Loop)
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call TriggerRegisterTimerEvent(gg_trg_Untitled_Trigger_001,0.03,true)
    call TriggerAddAction(gg_trg_Untitled_Trigger_001, function Dagger_Loop_Init)
endfunction

Why is this code giving me errors? It says that there's syntax error at 'ForGroup' function and i see nothing wrong. This was actually a part of another trigger,but it doesn't seem to work even alone.
 
JASS:
function Dagger_Enum takes nothing returns nothing
    call BJDebugMsg("lol")
endfunction

function Dagger_Loop takes nothing returns nothing
    call ForGroup(udg_Daggers, function Dagger_Enum)
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    call TimerStart(CreateTimer(), 0.03, true, function Dagger_Loop)
endfunction

Welcome to JASS.
 
set gg_trg_Untitled_Trigger_001 = CreateTrigger( )
call TriggerRegisterTimerEvent(gg_trg_Untitled_Trigger_001,0.03,true)
call TriggerAddAction(gg_trg_Untitled_Trigger_001, function Dagger_Loop_Init)

A trigger-handle, an event-handle and a triggeraction-handle instead of simply a timer handle. That, my friend, is a key difference between efficient code and not.
 
Level 8
Joined
Aug 2, 2008
Messages
193
Just a global timer, that you start in some init-function, which will expire all 0.03125 (or whatever) seconds, using a function as a timer-callback.
Normally used when using a struct for spells or something.
They are alot better and some kind of faster than triggers afaik.

vJass gives free global deklaration, using normal jass would require to put the timer variable in the header...
 
Level 5
Joined
Oct 14, 2010
Messages
100
You're whining about using a trigger instead of a timer? If you think that's a key difference between efficient and non-efficient code, you either don't know what "key difference" means or you simple don't know much about optimization to begin with. An additional event handle or triggeraction handle is completely irrelevant when discussing efficiency, and definitely not worth nearly cursing someone for.
 
You're whining about using a trigger instead of a timer? If you think that's a key difference between efficient and non-efficient code, you either don't know what "key difference" means or you simple don't know much about optimization to begin with. An additional event handle or triggeraction handle is completely irrelevant when discussing efficiency

If you knew how inefficient JASS is and how much more performance you get from a single timer instead of a trigger, you would completely retract this statement.

definitely not worth nearly cursing someone for.

Definitely not, for which I apologise.
 
Status
Not open for further replies.
Top