Textmacro problem

Nexor

...
Reaction score
74
I was trying to simplify one of my problems, the timer call back with 0 expiraton time.

I've made a trigger that uses it, but one of the textmacros won't go in the trigger :S

The Textmacro setup:
JASS:
globals
    timer TIMER_MACRO = CreateTimer()
endglobals

//! textmacro Globals takes name, global, realx, realy
    globals
        $global$_$name$
        $realx$_$name$
        $realy$_$name$
    endglobals
//! endtextmacro

//! textmacro Callback takes name, load
    function Callback_$name$ takes nothing returns nothing
        $load$
    endfunction
//! endtextmacro
    
//! textmacro Timer takes name, saveglobal,saverealx,saverealy
        $saveglobal$
        $saverealx$
        $saverealy$
        call TimerStart(TIMER_MACRO,0,false,function Callback_$name$)
//! endtextmacro


And the usage in a trigger:

JASS:

//! runtextmacro Globals( "Runes", "item Item", "real X", "real Y" )

//! runtextamcro Callback( "Runes", "call CreateItem( GetItemTypeId(Item_Runes), X_Runes, Y_Runes))" )

function Trig_Runes_Actions takes nothing returns nothing
    if GetItemTypeId(GetManipulatedItem()) == 'I000' then
        call ResetCooldownAll( GetTriggerUnit() )
        //! runtextmacro Timer( "Runes","set Item_Runes = GetManipulatedItem()","set X_Runes = GetItemX(Item_Runes)","set Y_Runes = GetItemY(Item_Runes)" )
    endif
endfunction
//===========================================================================
function InitTrig_Runes takes nothing returns nothing
    set gg_trg_Runes = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Runes, EVENT_PLAYER_UNIT_PICKUP_ITEM )
    call TriggerAddAction( gg_trg_Runes, function Trig_Runes_Actions )
endfunction


My problem is, that jasshelper says the Callback_Runes function is undeclared, but there is the textmacro that adds it there :S:S
 

Trollvottel

never aging title
Reaction score
262
JASS:
//! textmacro Globals takes name, global, realx, realy
    globals
        $global$_$name$
        $realx$_$name$
        $realy$_$name$
    endglobals
//! endtextmacro


you did not define a type for these globals...
 

Nexor

...
Reaction score
74
Lol , only the callback part has problem.

JASS:
//! runtextmacro Globals( "Runes", "item Item", "real X", "real Y" )


This will create 3 global variables: Item_Runes (item variable), X_Runes (real variable) and Y_Runes (real variable)
Here's no problem only at the callback function
 

Xorifelse

I'd love to elaborate about discussions...........
Reaction score
87
Textmacro's have its uses, this is definitely not 1 of them. Stop using them like that, it generates a huge messy code.
 

Nexor

...
Reaction score
74
I've inserted it to my second trigger (without textmacros) and runs with no problem at all, so there is some problem with the textmacro thing and the issue is not related to my coding knowledge
 

Artificial

Without Intelligence
Reaction score
326
Code:
//! runtext[COLOR="Red"]am[/COLOR]cro Callback( "Runes", "call CreateItem( GetItemTypeId(Item_Runes), X_Runes, Y_Runes))" )
-_-
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top