Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Pathfinder Roleplaying Game
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
Lord Magus
Senior Member
 
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464

Old October 1st, 2023, 07:40 AM
I am trying to use a string, stored in the field "abText", as a thingID in a script, but I do not know how to do that properly.

I have tried
Code:
~ We calculate the bonuses for Elemental Augmentation

var AttBon as number
var AttTarget as string

foreach pick in hero where "abCategory.AMSAffin & Affinity.? & Helper.FirstCopy"
  AttBon = round(eachpick.field[abValue3].value/2,0,-1)
  AttTarget = eachpick.field[abText].text
  hero.child[AttTarget].field[aPostMod].value += AttBon
nexteach
but the "hero.child[AttTarget]" part does not work, even though the abText field that AttTarget refers to contains the thingID of the ability score I want to use.

Any pointers on how to properly convert a string to an thingID? Thanks!
Lord Magus is offline   #1 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old October 1st, 2023, 09:45 AM
Don't store the Id of the pick as text. Store some identity tag from the target pick on the picks you're foreaching through. Since this is attributes, and there's only 6 of them, use a 6-item if...elseif to apply the bonus to the correct attribute. If there were more picks, a nested foreach would be the way to find them.

Also, why is this script using a foreach - can't these AMSAffin picks run the script themselves, instead of running it from some master pick? As far as I can tell, this would be a 3-line script on those picks:

doneif (tagis[Helper.FirstCopy] = 0)
doneif (tagis[Affinity.?] = 0)

hero.chilfdound[aDex].field[aPostMod].value += round(field[abValue3].value/2,0,-1)

(just copying the script from pick to pick, changing the attribute Id for each one).

Last edited by Mathias; October 1st, 2023 at 09:49 AM.
Mathias is offline   #2 Reply With Quote
Lord Magus
Senior Member
 
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464

Old October 1st, 2023, 11:43 AM
Quote:
Originally Posted by Mathias View Post
Don't store the Id of the pick as text. Store some identity tag from the target pick on the picks you're foreaching through. Since this is attributes, and there's only 6 of them, use a 6-item if...elseif to apply the bonus to the correct attribute. If there were more picks, a nested foreach would be the way to find them.
Thanks for the advice. I wanted to try and avoid running a series of if-then to do it.

Quote:
Originally Posted by Mathias View Post
Also, why is this script using a foreach - can't these AMSAffin picks run the script themselves, instead of running it from some master pick?
Funny that you're asking that, as this was my first idea that I then discarded to try to "centralize" the process on the Transform ability. I'll probably just transfer everything on the Affinities. Thanks again!
Lord Magus is offline   #3 Reply With Quote
Reply


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 04:52 AM.


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