I am not exactly sure how "Run Tree By Name" works, and I am hoping for some help understanding it.
Simple version: If I want a BHAV associated with one object to run a BHAV associated with another object, I can use "Run Tree By Name". If there are multiple BHAVs with the same name attached to similar objects, how do I make sure that it runs the right one (or returns false if the right object doesn't have the appropriately named BHAV)?
Longer version: There is an object in game called "Job Finder" that generates the five different careers available to find a job in each day. I want it to change how it chooses careers based on (a) whether I have added a new BHAV to that career, and if so (b) the information provided by that BHAV (it will assign values to various Temps, which I can then use to remove other jobs as options for that day). The game generates all the careers as invisible objects in each lot, and the career I want to look at would be the Stack Object when I use "Run Tree By Name". Would that work, and what settings would I need?
Yes, the TreeByName is taken from the current stack object that was selected seleced by 1F. The name of the tree to search for is picked from your own object (Job Finder), its semiglobals, or globals. You can add a string resource 12F with a name to Job Finder, or use one of the existing global names without conflicts. Doesn't matter much what the name says. Unselect the boxes for SemiGlobals and Globals because it doesn't make sense to go up in scope in this case, and only search the stack object's private. Usually you use the method Push Onto My Stack, then the result will be written into your temps, and you will wait until the called tree completes. Run in My Stack works the same but can only execute instantaneous scripts without idle, which would be ok in this case too.
I am not familiar with how Job Finder works specifically, and if there could be a better solution.
Run in Stack Object's Stack will run from the other object's point of view and write into its variables. Every object holds its own temps, attributes, etc. This is rarely used. Can only run instantaneous scripts because you can't interrupt another object's working at random moments.
Push Onto My Stack by Guid, will actually select the tree to run from an object of GUID in Temp 0,1. It doesn't need to be spawned on the lot. Any object from the catalog is possible. This is a newer function. It saves you from spending resources to spawn an object, and changing and restoring the current stack object.