Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Pathfinder Roleplaying Game
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
ebpatton
Member
 
Join Date: Jul 2014
Location: Ft. Wright, KY
Posts: 48

Old July 23rd, 2014, 09:50 AM
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]
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.
ebpatton is offline   #1 Reply With Quote
ebpatton
Member
 
Join Date: Jul 2014
Location: Ft. Wright, KY
Posts: 48

Old July 23rd, 2014, 09:54 AM
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.
ebpatton is offline   #2 Reply With Quote
ShadowChemosh
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729

Old July 23rd, 2014, 12:22 PM
Quote:
Originally Posted by ebpatton View Post
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.
No problem at all. Happens as someone is learning. Looks like you getting the hang of the scripting very well actually.

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.
ShadowChemosh is offline   #3 Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 03:37 AM.


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