• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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 40
Joined
Jun 9, 2011
Messages
13,182
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,657
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