• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Undeclared variable

Status
Not open for further replies.
Level 2
Joined
Aug 30, 2016
Messages
24
so i made this little jass script to disable fog in my map but it gives me an error in jasscraft

Undeclared variable : gg_trg_FogOff

function Trig_FogOff_Actions takes nothing returns nothing
call FogEnableOff( )
call FogMaskEnableOff( )
endfunction
function InitTrig_FogOff takes nothing returns nothing
set gg_trg_FogOff = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_FogOff, Player(0), "-fogoff", true )
call TriggerAddAction( gg_trg_FogOff, function Trig_FogOff_Actions )
endfunction
 

Chaosy

Tutorial Reviewer
Level 41
Joined
Jun 9, 2011
Messages
13,239
Wops, I read your code wrong. Ignore my statement.
Do this:
JASS:
function TurnOffFog takes nothing returns nothing
    call FogEnableOff()
    call FogMaskEnableOff()
endfunction

function InitTrig_NAME takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterPlayerChatEvent(t, Player(0), "-fogoff", true)
    call TriggerAddAction(t, function TurnOffFog )
    t = null
endfunction
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
The gg_trg_ variables are trigger variables created for each "trigger" (Every script file would be better.) in your map.
So if you created one with the name FogOff, then you have a trigger variable called "gg_trg_FogOff".

It might be a problem in JassCraft as the InitTrig function worked (I assume at least).
 
Status
Not open for further replies.
Top