Textmacro Syntax error

doin

New Member
Reaction score
1
Trying something new, and it is already a pain in the a**(can't say that, can I)
here is my code, all of the code that has got only the slightest contact with it.

JASS:
//! textmacro NUnitAtLocFunc takes INSTANCE, AMOUNT, IntID, PLAYER
function NUAL$INSTANCE$ takes nothing returns nothing
    call CreateNUnitsAtLoc( $AMOUNT$, $IntID$, $PLAYER$, GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
endfunction
//! endtextmacro


JASS:
function Trig_Substringtest_Actions takes nothing returns nothing
    if (SubStringBJ(GetEventPlayerChatString(), 2, 5) == "nggr") then
        //call CreateNUnitsAtLoc( 1, 'nggr', Player(1), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
        //! runtextmacro NUnitAtLocFunc("1","1","'nggr'","Player(0)")
    else
        //call CreateNUnitsAtLoc(1, 'hsor', Player(1), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
        //! runtextmacro NUnitAtLocFunc("2","1","'hsor'","Player(0)")
    endif
endfunction

//===========================================================================
function InitTrig_Substringtest takes nothing returns nothing
    set gg_trg_Substringtest = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_Substringtest, Player(0), "-", false )
    call TriggerAddAction( gg_trg_Substringtest, function Trig_Substringtest_Actions )
endfunction


and the error I get is:
line 135:Syntax error with
JASS:
function NUAL1 takes nothing returns nothing
 

Flare

Stops copies me!
Reaction score
662
The macro is causing a function to be nested within another function

JASS:
//! textmacro NUnitAtLocFunc takes INSTANCE, AMOUNT, IntID, PLAYER
//Commenting the function/endfunction should be sufficient
//function NUAL$INSTANCE$ takes nothing returns nothing
    call CreateNUnitsAtLoc( $AMOUNT$, $IntID$, $PLAYER$, GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
//endfunction
//! endtextmacro


And fix that leak (GetRectCenter ())

And using a textmacro there is a bit excessive (you could just call the CreateNUnitsAtLoc function, or
JASS:
call CreateUnit (Id, Player, GetRectCenterX (whichRect), GetRectCenterY (whichRect), bj_UNIT_fACING)
 

doin

New Member
Reaction score
1
yeah, I know you can use the CreatNUnitsAtLoc function, but I want to go further with the textmacro, but this is an early-stage test.

EDIT: now I get the error: Statement outside of function.
EDITEDIT: nevermind, i forgot to delete a line...
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top