View Single Post
Fenris447
Senior Member
 
Join Date: Sep 2017
Posts: 600

Old December 31st, 2020, 10:34 AM
For the record, I did get it figured out. I used the spell selector in the configurable thing, which imposes the hasagent tag on new copies of the spells. Then I searched all spells with that tag and built a list. That list was then used to find the spellbook and prepared versions of each of those spells.

All of this ran at Final 50000 and works perfectly.

Code:
  ~set our variables
  var searchexpr as string
  var otherexpr as string
  var blep as number

  ~start off the string for the tag expression with an open parenthesis
  searchexpr = "("

  ~look at all the spells that have been selected by this configurable   
  foreach pick in hero from BaseSpell where "hasagent.cfg5C1WthWrd"

  ~if this isn't the first spell we've found, add an OR (" | ") before it in the string
    if (blep > 0) then
      searchexpr &= " | " 
     endif

  ~add the found spell's thingid to the search expression
    searchexpr &= eachpick.tagids[thingid.?]

  ~blep tracks how many spells have been added to the list we're building
  ~so once we've found one, add to blep so we can add an OR as above
    blep += 1

  ~hide the found spell; this version of the spell is from the configurable
   perform eachpick.assign[Hide.Spell]
   nexteach

  ~close the tag expression string with a parenthesis
  searchexpr &= ")"

  ~make a copy the string with just the spells listed 
  otherexpr = searchexpr

  ~add the tag that shows we're looking for the spellbook version of the spell
  searchexpr &= " & portal.ClsBook"

  ~add the tag that shows we're looking for the prepared version of the spell
  otherexpr &= " & Helper.Memorized"


  ~run through the list of spells, looking for their spellbook versions
  foreach pick in hero from BaseSpell where searchexpr

  ~add "(Lost)" to the end of the spell's name
      eachpick.field[sNameMod].text = "Lost"

  ~hide this spell, as it's in the spellbook and has disappeared
      perform eachpick.assign[Hide.Spell]
  nexteach

  ~run through the list of spells, looking for their prepared versions
  foreach pick in hero from BaseSpell where otherexpr

  ~add "(Lost from spellbook)" to the end of the spell's name
      eachpick.field[sNameMod].text = "Lost from spellbook"
  nexteach

Found an issue with or have a suggestion for the 5e Community Pack? Please post it here at our GitHub.

Feel free to stop by the Lone Wolf Development Subreddit, for discussion of any and all LWD products and community efforts!
Fenris447 is offline   #14 Reply With Quote