TextMacro and stuff

NoobImbaPro

You can change this now in User CP.
Reaction score
60
I have this code that doesn't work obviously
JASS:
static method create takes boolean E1, boolean E2, boolean E3, boolean E4, boolean E5, boolean E6, boolean E7, boolean E8 returns thistype
        local thistype this = thistype.allocate()
        local string st
        local integer i = 0
        loop
            set i = i + 1
            set st = "E" + I2S(i)
            //! textmacro Select takes string Item
                if $Item$ then
                    set this.equip<i> = true
                else
                    set this.equip<i> = false
                endif
            //! endtextmacro
            //! runtextmacro Select(st)
        exitwhen i == 8
        endloop
        
        return this
    endmethod</i></i>


SO what it does? It tries to loop the arguments above instead of checking one by one.
E1, E2, E3 are item types, let's say sword, bow etc.. . The method creates a RPG Class. The class has the charateristics of equiping items. It checks every boolean that the function takes and then applies code to unit. I tried to use textmacro for optimising somehow the code but its features are not so great. Anyone can help me finding a way to manage this with loop action??? So when I add anotheer item just to put one more number instead of 1 more if then else condition.
 

Sevion

The DIY Ninja
Reaction score
424
You cannot use textmacros with string variables as textmacros are compiled on save which means the script isn't actually run (thus no values stored in the variables).
 
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