• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

State in a foreach loop

frumple

Well-known member
I am wanting to use amendthing on certain picks that I choose with a foreach loop.

How do I use the state.thing[XXX].amendthing[yyy,zzz] statement within the loop?

Using eachpick in place of thing[XXX] or state.thing[XXX] doesn't work. I think I need to dynamically assign thing[XXX] to the id of the current pick but thing[XXX] won't take strings.
 
amendthing may ONLY be used from the state.thing[] context. You cannot use it from inside a foreach.

amendthing is designed for permanent changes, not dynamic use.
 
What sort of things are you trying to modify? You might be able to use the DescAppend field instead.
 
Trying to use on wOtherMel and wOtherRan so that they show the name I assign it instead of other melee/ranged attack in the statblock.

The issue is that I want a specific one of these attacks changed (which I have tagged), and not any others (which is why I am using the foreach loop).
 
Blame his grandkids. I heard some skuttlebutt that they were street fighter fans and he joined the cast to make them happy.
 
amendthing may ONLY be used from the state.thing[] context. You cannot use it from inside a foreach.

amendthing is designed for permanent changes, not dynamic use.
Ummm I hate to say this but you can use amendthing from inside of a foreach. Unless your saying you can't use state & amendthing together in a foreach loop then yes that is true sort of. You can mimic the state feature by taking the current info from the Pick and adding it to the new value before doing amendthing.

For Paths of War I had to build something NEW to support Maneuvers (like spells but not really). Actually had I waited they are more like Powers which we have now...

So I have the following script that loops through special Maneuvers and Stances Ability Things and builds a special Name and Description text similar to a spell. I actually assumed this was how Spells where built in HL.

But you can see at the very bottom of the script that I use amendthing in a foreach loop. I guess its like the bee. No one told me I couldn't do it so I found a way to do it. :D
Code:
      ~ Set text fields
      var sBreak  as string
      var sText   as string
      var sName   as string
      ~ Default to the HL new line
      sBreak = "{br}"

      ~ Loop through all the Path of War Maneuvers
      foreach thing in Ability where "PathOfWar.Manuever|PathOfWar.Stance"

        sText = "{b}Discipline:{/b} " &eachthing.tagnames[Discipline.?] & " (" & eachthing.tagnames[mType.?] & ")"

        ~ If we have a descriptor tag then add it into the header text
        If (eachthing.tagis[mDescript.?] <> 0) Then
          sText &= " [" & eachthing.tagnames[mDescript.?] & "]"
        Endif
        sText &= sBreak & "{b}Level:{/b} " & eachthing.tagnames[mLevel.?]
        sText &= sBreak & "{b}Initiation Action:{/b} " & eachthing.tagnames[mInitAct.?]

        ~ If we have a range tag then add it into the header text
        If (eachthing.tagis[mRange.?] <> 0) Then
          sText &= sBreak & "{b}Range:{/b} " & eachthing.tagnames[mRange.?]
        Endif

        ~ If we have a target tag then add it into the header text
        If (eachthing.tagis[mTarget.?] <> 0) Then
          sText &= sBreak & "{b}Target:{/b} " & eachthing.tagnames[mTarget.?]
        ~.. If we have a manually entered target text then use it
        ElseIf ( empty(eachthing.field[spcName].text) = 0 ) Then
          sText &= sBreak & "{b}Target:{/b} " & eachthing.field[spcName].text
        Endif  

        sText &= sBreak & "{b}Duration:{/b} " & eachthing.tagnames[mDuration.?]

        ~ If we have a saving throw tag then add it into the header text
        If (eachthing.tagis[mSave.?] <> 0) Then
          sText &= sBreak & "{b}Saving Throw:{/b} " & eachthing.tagnames[mSave.?]
        Endif

        ~ Combine the Manuever text to after the header
        sText &= sBreak & sBreak & eachthing.field[descript].text
        sName = eachthing.tagnames[mLevel.?] & " " & eachthing.field[name].text

        ~ Set maneuver text
[B]        perform eachthing.amendthing[description,sText]
        perform eachthing.amendthing[name,sName][/B]
      nexteach
 
Back
Top