Member
Join Date: Jul 2014
Location: Ft. Wright, KY
Posts: 48
|
In the Weapon Focus feat under General -> Feat in the editor is the following snippet of code:
Code:
~ Assign the appropriate tag to all weapons that meet the criteria var id as string var name as string call fTargetId foreach pick in hero from BaseWep where "IsWeapon." & id perform eachpick.assign[Broadcast.WepFocus] nexteach foreach thing in BaseWep where "thingid." & id perform eachthing.pulltags[wProfReq.?] nexteach ~ Set our 'short name' field[shortname].text = "Focus: " & name field[sbName].text = "Weapon Focus (" & lowercase(name) & ")" ~ Forward the weapon focus tag for the weapon to the hero perform hero.assignstr["WepFocus." & id] How can name contain the right thing when it's never initialized or assigned to? If it's some sort of global variable, why does it need to be declared? Even if it is global, how does it get its value? Does fTargetId actually make the assignments to both variables? I could totally believe that. But where then is the procedure defined? I see no reference to it in the Hero Lab Authoring Kit PDF. If it's a useful procedure, how would I know of the existence of other useful procedures like it? Thank you. |
#1 |
Member
Join Date: Jul 2014
Location: Ft. Wright, KY
Posts: 48
|
I put in debug statements, and I see where the variables are assigned. It's indeed the fTargetId procedure.
The whole post can probably be ignored. I should have just done the debugs before posting, but I didn't think of it. Sorry. |
#2 |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
Quote:
Just to add more info the procedure fTargetId is setting the variables with values. Then it sort of "passes" them back to the calling script from Weapon Focus. This happens because the declaration of "var id as string" line of code. Procedures are nice because it makes "re-usable" code but the downside is the ones made by LW can not be seen. On the good side in the future if you want you can make your own procedures directly in XML. This makes larger projects nice where the same script code gets used over and over again. Hero Lab Resources: Pathfinder - d20pfsrd and Pathfinder Pack Setup 3.5 D&D (d20) - Community Server Setup 5E D&D - Community Server Setup Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources. Created by the community for the community - Realm Works kickstarter backer (Alpha Wolf) and Beta tester.- d20 HL package volunteer editor. |
|
#3 |
|
|