Help with textmacro

dudeim

New Member
Reaction score
22
Hey,

I'm creating my first textmacro but it keeps giving me an error.
JASS:
//this is how I call it
//! runtextmacro Create("0","2","Q")

//! textmacro Create takes x, y, hotkey
    //! externalblock extension=lua ObjectMerger $FILENAME$ --gives an error in this line
    
        //! i setobjecttype("abilities")
        //! i createobject("AEev","0".."$hotkey$".."01")
        //! i makechange(current,"aart","ReplaceableTextures\\CommandButtons\\BTNnumber1.blp")
        //! i makechange(current,"arar","")
        //! i makechange(current,"arac","other")
        //! i makechange(current,"anam","One")
        //! i makechange(current,"ansf","(Hotkey ".."$hotkey$"..")")
        //! i makechange(current,"alev",1)
        //! i makechange(current,"Eev1",1,0)
        //! i makechange(current,"aub1",1,"")
        //! i makechange(current,"abpx",$y$)
        //! i makechange(current,"abpy",$x$)
        //! i makechange(current,"aher",1)
        //! i makechange(current,"arlv",1)
//! endexternalblock
//! endtextmacro

and this is the error posted in the log: lua:2: attempt to concatenate global 'hotkey' (a nil value)
I just copied and paste a little and I don't really have a clue what I'm doing so hope anyone could point me in the good direction.
Edit: updated script to the newest and with a new problem: External not found in config file: ""
 

Sevion

The DIY Ninja
Reaction score
413
The ObjectMerger code is run before textmacros are parsed, methinks.

I don't think you can use texmacros in conjunction with ObjectMerger code.
 

tooltiperror

Super Moderator
Reaction score
231
>I don't think you can use texmacros in conjunction with ObjectMerger code.
Didn't Azlier say you could use text macros + Grimoire to speed up development time?
 

Sevion

The DIY Ninja
Reaction score
413
Then perhaps you can. I don't really know because I never really used ObjectMerger or textmacros extensively.
 

PurgeandFire

zxcvmkgdfg
Reaction score
508
Yes, you can use textmacros with lua.

Anyway, the problem is this line:
[ljass]//! i createobject("AEev","0"..hotkey.."01")[/ljass]
It should be:
[ljass]//! i createobject("AEev","0".."$hotkey$".."01")[/ljass]

Do the same for the other line that uses hotkey:
[ljass]//! i makechange(current,"ansf","(Hotkey " .."$hotkey$".. ")")[/ljass]

You'll also probably want to change x and y in the code to $x$ and $y$ respectively.
 

dudeim

New Member
Reaction score
22
Ok I changed it and now it's loading the first part (execute external commands) and jasshelper continues then it gives an error (again on execute external commands (that is what jasshelper is loading)) and it gives the error: External not found in config file: ""
 

Dirac

22710180
Reaction score
147
I don't know LUA but dons't $FILENAME$ has to be included in your textmacro? i see it here
//! externalblock extension=lua ObjectMerger $FILENAME$
but where does it get passed?
 

dudeim

New Member
Reaction score
22
No pretty sure it has to be $FILENAME$ dunno why but every other lua script uses that so I guess it has to be that way.
 

PurgeandFire

zxcvmkgdfg
Reaction score
508
It runs just fine for me. Make sure you removed the comment:
JASS:
//gives an error in this line

Comments in lua are denoted by a double-hyphen. ( -- )

Also, post what you used for running the textmacro, because that is most likely where the problem is.
 

dudeim

New Member
Reaction score
22
Haha big fail I know what I did wrong I used //! runtextmacro inside a global block (for global vars) so that's why it didn't work:p
 
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