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?
Thanks!
TC
Code:
<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 & 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]
nexteach
endif]]>
</eval>
<evalrule phase="Validate" priority="5000" index="2" message="Selected Hero'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
endif
validif (lastpos(heroedges, mychoice) >= 0)
]]></evalrule>
</thing>