In the Weapon Focus feat under General -> Feat in the editor is the following snippet of code:
Two variables, id and name, are declared and later used. But neither is initialized. I could maybe believe id is picking up information from the foreach statement, but name doesn't show up at all until it's used in an assignment.
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.
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]
Two variables, id and name, are declared and later used. But neither is initialized. I could maybe believe id is picking up information from the foreach statement, but name doesn't show up at all until it's used in an assignment.
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.