View Single Post
Duggan
Senior Member
Volunteer Data File Contributor
 
Join Date: Nov 2009
Posts: 1,502

Old August 21st, 2019, 06:10 PM
Quote:
Originally Posted by Mathias View Post
The question there is whether you want to be able to update the list with any changes the user has applied - for example, can the user add another thing from the same category to the list of standard things that came with the vehicle? Or can the user pay to upgrade the level of one of the standard things, in which case you want the name displayed to the user to change. If so, then you'll want your script to have a branch, with a pick branch that uses foreach pick in gizmo, and a thing branch that uses foreach bootstrap in this. If you're ok with the same list being displayed before and after the user adds the item, then the foreach thing will function in both cases, and give the same information in both cases.
Yes, I want to update the description if the user changes things. So I guess I will need the dual setup. The following is what I've got set up, but it's still not pulling in those bootstrapped qualities in the purchase table. Using debug statements, I've verified that I get into the "ispick = 0" section, but that the loop doesn't execute anything in it, suggesting that there are no items among the bootstraps.

Code:
<procedure id="InfoWeapSp" context="info"><![CDATA[
  ~declare variables that are used to communicate with our caller
  var iteminfo as string

  ~report any special details about the weapon (omitting if there are none)
  var special as string
  special = tagnames[Weapon.?,", "]
  if (isentity = 1) then
    if (ispick = 0) then
      foreach bootstrap in this
        special &= eachthing.field[name].text
        nexteach
    else
      foreach pick in gizmo where "component.WeapQual"
        special = splice(special, eachpick.field[thingname].text,", ")
        nexteach
      endif
    endif

  special = splice(special,field[wpSpecial].text,", ")
  if (empty(special) = 0) then
    iteminfo &= "Special: " & special & "{br}"
    endif
  ]]></procedure>
In case it's relevant, this is the weapon I'm testing it out with:
Code:
<thing id="wpmBOB_GREG" name="BFF Autocutlery Chainsaber Mark IX" description="description omitted for space" compset="Melee">
  <fieldval field="wpDamage" value="Melee+3d6"/>
  <fieldval field="grCost" value="4"/>
  <fieldval field="shortname" value="Chainsaber"/>
  <tag group="Equipment" tag="TwoHand" name="Requires two hands" abbrev="Requires two hands"/>
  <tag group="License" tag="Illegal" name="Illegal" abbrev="Illegal"/>
  <tag group="WeaponType" tag="MelExotic" name="Exotic Melee" abbrev="Exotic Melee"/>
  <child entity="grCustWeap">
    <bootstrap thing="wqHyperAcc">
      <autotag group="Quality" tag="Free"/>
      </bootstrap>
    <bootstrap thing="wqFProne">
      <autotag group="Quality" tag="Free"/>
      </bootstrap>
    </child>
  </thing>
Duggan is offline   #8 Reply With Quote