• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Better way to handle?

TCArknight

Well-known member
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&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
	    endif

      validif (lastpos(heroedges, mychoice)  >= 0)
	  
	  ]]></evalrule>
    </thing>
 
Found the solution with the evalrule. :)
Code:
	  var mychoice as string

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

      validif (hero.tagsearch[mychoice] <> 0)
Swapping out the whole lastpos() thing for the bero.tagsearch[] worked perfectly.
 
Back
Top