[Solved] Use global variable in JASS

Status
Not open for further replies.
Hello again ! : )

How can I make vJASS not to be pissed off by the fact I use global variables in the trigger (with or without array)? (I made a GUI trigger that I converted into JASS)
vJASS:
function Trig_RemoveTruces_Actions takes nothing returns nothing
    local player PLAYER1 = udg_PLAYER4
    local player PLAYER2 = udg_PLAYER5
    call TriggerSleepAction( udg_TimeBetweenTruces )
    call ForceRemovePlayerSimple( PLAYER1, udg_DiploTrucesOf[GetConvertedPlayerId(PLAYER2)])
    call ForceRemovePlayerSimple( PLAYER2, udg_DiploTrucesOf[GetConvertedPlayerId(PLAYER1)])
    call DisplayTextToForce( GetPlayersAll(), ( "The truce between " + udg_StringNameFaction[GetConvertedPlayerId(PLAYER1)] + " and " + udg_StringNameFaction[GetConvertedPlayerId(PLAYER2)] + " has ended." ) )
endfunction

//===========================================================================
function InitTrig_RemoveTruces takes nothing returns nothing
    set gg_trg_RemoveTruces = CreateTrigger(  )
    call TriggerAddAction( gg_trg_RemoveTruces, function Trig_RemoveTruces_Actions )
endfunction

Thanks for reading the forum !
 
Last edited:
Wow... Ok I'm bad with JASS cause I mainly use GUI and don't know much about it; and OK my question is badly phrased, I admit. But come on, you don't all have to be so condescending you know?
But nvm, I just wanted to know why when checking the syntax (Syntax Check button and when the map loads), I get a message stating that the global variables I use are not declared, and they clearly are as they're made with the "Variable Editor". But the trigger works fine. i just wanted to get rid of this message and thought something was wrong but it doesn't really matter.
 
But then I don't quite understand. You say it also throws an error when it's not converted, so GUI
No no I never said that. GUI is fine ofc. And any JASS (even when not converted but directly written) using udg_ type variables triggers the syntax error.

The syntax checker checks the syntax of the JASS triggers.
The GUI Global Variables (the udg_ variables) are not included in the syntax checker.
That is why we dont use it.
We save the map, which automatically runs the vJASS precompiler and generates the vanilla JASS code and checks the syntax.
Nice to know !
 

Deleted member 219079

D

Deleted member 219079

You can't. Only knowledgeable people like Vexorian who can. (He, in fact, the one who invented vJASS). Lmao.
Learn C++. Use sfmpq.dll (found in jassnewgenpack, API here) to open the map file and extract file "war3map.j", parse it and run it through JASS2 syntax checker (e.g. pjass (found in jassnewgenpack) argumentation: pjass.exe path\to\common.j path\to\Blizzard.j path\to\war3map.j) and import it back to the map.

Inspect wehack.lua (found in jasssnewgenpack) to learn how to integrate your tool into WE. That file also gives you good insight on what exactly is done before calling jasshelper (find "function compilemap_path(mappath)").

Now that you know, when can we expect RheikoJASS?
 
Status
Not open for further replies.
Top