View Single Post
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,207

Old August 20th, 2019, 10:28 AM
Something I realized I should add to the foreach bootstrap in this - here's how you can look up tags that were assigned to a bootstrap as autotags and fields that were assigned to the bootstrap as assignvals:

Code:
       mountmods = ""
      if (focus.tagis[ModCatAllw.MountMod] <> 0) then
        if (focus.autotags.tagis[WMVisible.?] <> 0) then
          mountmods = splice(mountmods,focus.autotags.tagnames[WMVisible.?,", "],", ")
        else
          mountmods = splice(mountmods,"External",", ")
          endif
        if (focus.autotags.tagis[WMFlex.?] <> 0) then
          mountmods = splice(mountmods,focus.autotags.tagnames[WMFlex.?,", "],", ")
        else
          mountmods = splice(mountmods,"Fixed",", ")
          endif
        if (focus.autotags.tagis[WMControl.?] <> 0) then
          mountmods = splice(mountmods,focus.autotags.tagnames[WMControl.?,", "],", ")
        else
          mountmods = splice(mountmods,"Remote",", ")
          endif
        if (empty(mountmods) = 0) then
          modlist &= " (" & lowercase(mountmods) & ")"
          endif

        ~if there's a domDomain field for a weapon mount, that's the direction
        ~it points, and the format used to display those is to just add it to
        ~the end of the text, outside the parentheses
        if (focus.assignvals.field[domDomain].isempty = 0) then
          modlist &= " " & focus.assignvals.field[domDomain].text
          endif
This code is from a procedure that's called by the foreach bootstrap, since we have multiple places where we need to look up the same info. A procedure can't reference eachthing or eachpick unless the foreach is inside the same procedure, which is why it sets the focus to the current pick and then calls the procedure, and the procedure uses the focus.
Code:
    foreach bootstrap in this from Gear where searchexpr
      perform eachthing.setfocus
      call VehModInfo
      nexteach
Mathias is offline   #7 Reply With Quote