Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - Authoring Kit (http://forums.wolflair.com/forumdisplay.php?f=58)
-   -   Findchild (http://forums.wolflair.com/showthread.php?t=60401)

RavenX March 19th, 2018 01:40 PM

Findchild
 
Mathias,

Can the hero.findchild[] part of the script be used to home in on a thing with a specific tag?

Mathias March 19th, 2018 01:56 PM

Code:

hero.findchild[component,tag expression]
uses the same tag expression that

Code:

foreach pick in hero from component where "tag expression"
would - so if you can find it with foreach, you can find it with findchild[].

RavenX March 19th, 2018 02:01 PM

I thought that was the case. That should make it easier to output the Nature and Demeanor for a character sheet for me. Thank you.

TCArknight March 20th, 2018 05:55 AM

Quote:

Originally Posted by Mathias (Post 264580)
Code:

hero.findchild[component,tag expression]

It seems too that if you know there is always one of a particular component on a hero, then you can do:
Code:

hero.findchild[component]
I did find out that you can use:
Code:

perform hero.findchild[component].setfocus
Then you step through using focus.field[fieldname].text or any way you would use eachpick.X

Are there any potential issues with using findchild instead of the foreach?
Any Benefits?

Mathias March 20th, 2018 07:27 AM

You'd use findchild instead of foreach if you're certain you'll only find one item that fulfills the requirements. Then, you set the focus to the item you've found, and go on with your script.

For example, let's say you have a long script that needs to look up and change several things on the race - in order to use that with a foreach, basically your script will need to start with the foreach, and end with the next each, but with findchild, your script starts with the findchild, sets a focus to the race, and then the rest of the script looks like normal code, instead of referring to eachpick throughout.

RavenX March 20th, 2018 01:29 PM

Yeah, I needed it for the Nature and Demeanor archetypes, which get assigned a unique tag from their chooser portals. The user has to pick one archetype for each of them, but they come from the same pool of available things. I rigged the portal to assign a tag and then had the find child look for that tag for character sheet output. :D


All times are GMT -8. The time now is 09:46 PM.

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