Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - Savage Worlds (http://forums.wolflair.com/forumdisplay.php?f=59)
-   -   Better way to handle? (http://forums.wolflair.com/showthread.php?t=59596)

TCArknight November 21st, 2017 08:45 PM

Better way to handle?
Hi all!

Yet another scripting question. :)

I have the below thing (and a couple others similar). When I add the item from the table_dynamic table, the cursor goes into 'wait, processing' spinny mode and it takes 30 seconds to a minute to add to the hero. I'm guessing it's a delay with the foreach or due to the lastpos check.

Is there a better way to script this?

  <thing id="exp17Wild" name="Exp. and Wis.: Wild Card" description="There are moments when everything comes together and an opportunity presents itself. You’re hero knows how to make the most of just such a moment; choose one Wild Card Edge, regardless of requirements." compset="HeroJrny">
    <fieldval field="usrCandid1" value="component.Edge &amp; EdgeType.Wildcard"/>
    <usesource source="SavRiftC"/>
    <tag group="RiftsHJ" tag="ExpWis"/>
    <tag group="ChooseSrc1" tag="Thing"/>
        <eval phase="Setup" priority="5000"><![CDATA[
        var mychoice as string
        if (field[usrChosen1].ischosen <> 0) then
      #resmax[resEdge] += 1

          mychoice = "Edge." & field[usrChosen1].chosen.idstring
          foreach pick in hero where mychoice
            perform eachpick.assign[thing.skipprereq]
        <evalrule phase="Validate" priority="5000" index="2" message="Selected Hero&apos;s Journey professional Edge needs to be chosen" summary="Edge missing."><![CDATA[
          var mychoice as string
          var heroedges as string
          heroedges = hero.tagids[Edge.?,"|"]
          if (field[usrChosen1].ischosen <> 0) then
            mychoice = "Edge." & field[usrChosen1].chosen.idstring

      validif (lastpos(heroedges, mychoice)  >= 0)

TCArknight November 25th, 2017 12:21 PM

Found the solution with the evalrule. :)

          var mychoice as string

          if (field[usrChosen1].ischosen <> 0) then
            mychoice = "Edge." & field[usrChosen1].chosen.idstring

      validif (hero.tagsearch[mychoice] <> 0)

Swapping out the whole lastpos() thing for the bero.tagsearch[] worked perfectly.

All times are GMT -8. The time now is 07:00 AM.

Powered by vBulletin® - Copyright ©2000 - 2019, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.