Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Savage Worlds

Notices

Reply
 
Thread Tools Display Modes
TCArknight
Senior Member
 
Join Date: Jan 2007
Location: NW Arkansas
Posts: 1,321

Old November 21st, 2017, 07:45 PM
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 &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]
		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>
TCArknight is offline   #1 Reply With Quote
TCArknight
Senior Member
 
Join Date: Jan 2007
Location: NW Arkansas
Posts: 1,321

Old November 25th, 2017, 11:21 AM
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.
TCArknight is offline   #2 Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 06:15 AM.


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