Thread: Findchild
View Single Post
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old 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.
Mathias is online now   #5 Reply With Quote