Discussion Nesting textmacroes

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
Suppose this: I want a user to be able to create a set of structs with a textmacro. But inside the struct, there's a ton of functions that could use textmacroing as well.

Ergo: Nesting textmacroes would be the obvious solution, too bad it isn't allowed, though...


Example:
JASS:

//! textmacro StructCreate takes NAME
    struct $NAME$
        integer i
        real r
        string s
        unit u
        // Etc...

        method setinteger takes integer val returns nothing
            set .i = val
        endmethod

        method setreal takes real val returns nothing
            set .r = val
        endmethod

        method setstring takes string val returns nothing
            set .s = val
        endmethod

        method setunit takes unit val returns nothing
            set .u = val
        endmethod

        // Etc...
    endstruct
//! endtextmacro

//! runtextmacro StructCreate("S1")
//! runtextmacro StructCreate("S2")
//! runtextmacro StructCreate("S3")
//! runtextmacro StructCreate("S4")


Would look so much better as:
JASS:

//! textmacro Methods takes TYPE, VARNAME 
        method set$TYPE$ takes $TYPE$ val returns nothing
            set .$VARNAME$ = val
        endmethod
//! endtextmacro
//! textmacro StructCreate takes NAME
    struct $NAME$
        integer i
        real r
        string s
        unit u
        // Etc...

        //! runtextmacro Methods("integer","i")
        //! runtextmacro Methods("real","ri")
        //! runtextmacro Methods("string","s")
        //! runtextmacro Methods("unit","u")
        // Etc...
    endstruct
//! endtextmacro

//! runtextmacro StructCreate("S1")
//! runtextmacro StructCreate("S2")
//! runtextmacro StructCreate("S3")
//! runtextmacro StructCreate("S4")


Could this be possible in NewGen?
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
No... Jasshelper does not allow nested textmacro.

Well, I know that. I'm opening the discussion to see if it would be possible, what it could mean to some systems and what could be the potential road blocks for it...
 

Anachron

New Member
Reaction score
53
http://www.wc3c.net/showpost.php?p=1109375&postcount=2752 said:
i like the textmacros, the only disatvantages are:
- you cannot run a textmacro in a textmacro
JASS:
//! textmacro bla takes V
//! run textmacro bi("$V$)
//! endtextmacro


- there are no loop/if then else functions for them
[jass="if-suggestion"]
//! textmacro bla takes V
set $V$=x
//! macroif (V=="4")
call set$V$(12,false)
//! elsemacro
call set$V$(12,true)
//! endmacroif
//! endtextmacro
[/jass]

[jass="loop-suggestion"]
//! textmacro bla takes V
set $V$=x
//! macroloop
//! macroloopexit (V=="4")
call set$V$(12,false)
call set$V$(12,true)
//! endmacroloop
//! endtextmacro
[/jass]
Vexorian said:
Tot: nested runtextmacro is planned, I'll also make a way to repeat a block of text with a list of arguments, not going to do any of that horrid macroif or macroloop stuff though.
However, Vexorian never did it.
 
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