HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

JassCraft saying this is wrong?

02-06-2007, 06:34 AM#1
Mythic Fr0st
Collapse JASS:
function Cast_C915A takes nothing returns nothing
    if GetSpellAbilityId() == 'A000' then
    endif
endfunction
function Trig_Cast_Actions takes nothing returns nothing
call ExecuteFunc("Trig_Cast_funcAD")
endfunction

//===========================================================================
function InitTrig_Cast takes nothing returns nothing
    set gg_trg_Cast = CreateTrigger(  )
    call TriggerAddCondition(gg_trg_Cast,Condition(function Cast_C915A))
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Cast,EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddAction(gg_trg_Cast,function Trig_Cast_Actions )
endfunction

it keeps saying error on line twelve

line twelve, is call TriggerAddCondition(gg_trg_Cast,Condition(function Cast_C915A))

The name of my trigger is Cast, but it keeps saying "Undeclared Variable gg_trg_Cast"

It works in editor though?
02-06-2007, 06:46 AM#2
PipeDream
The gg_trg variables are created by the world editor automatically. Don't use 'em if you don't need 'em by replacing with a local trigger variable.
02-06-2007, 10:04 AM#3
Fireeye
As Pipe already said gg_trg is created by the world editor, if you want to fix this in jass craft you have to add it to the globals part.

Also what disturbs me on this is the condition
Collapse JASS:
function Cast_C915A takes nothing returns nothing
    if GetSpellAbilityId() == 'A000' then
    endif
endfunction
function Trig_Cast_Actions takes nothing returns nothing
call ExecuteFunc("Trig_Cast_funcAD")
endfunction

//===========================================================================
function InitTrig_Cast takes nothing returns nothing
    set gg_trg_Cast = CreateTrigger(  )
    call TriggerAddCondition(gg_trg_Cast,Condition(function Cast_C915A))
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Cast,EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddAction(gg_trg_Cast,function Trig_Cast_Actions )
endfunction

Why don't you make it like this?
Collapse JASS:
function Cast_C915A takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
endfunction