Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Pathfinder Roleplaying Game

Notices

Reply
 
Thread Tools Display Modes
bodrin
Senior Member
 
Join Date: Feb 2007
Location: Nottinghamshire, United Kingdom
Posts: 1,265

Old August 23rd, 2013, 01:49 AM
I have an ability that allows the wielding of spiked chains, and similar weapons, as one-handed weapons.

Scripts posted for future reference

First 2000

Code:
~if we've been replaced, get out now
      doneif (tagis[Helper.SpcReplace] <> 0)

 ~if we aren't our chosen race get out now
      doneif (#hasrace[rFCOphiAng] = 0)
      
      foreach thing in BaseWep where "wFtrGroup.Flails"
        perform eachthing.pulltags[WepProf.?]
        perform eachthing.pulltags[wClass.?] 
        nexteach

    ~ I don't know what this does but it's in the original script I've copied and modified.
      perform hero.pushtags[WepProf.?]
      perform hero.pushtags[wClass.?]

      
      ~ Cycle through and apply the Helper.ExoticProf tag to all examples of 
      ~ the chosen weapon on the hero. This is important for the Aldori Dueling
      ~ Sword specifically, and possibly others.
       ~ I know this relates to Flails but i've left it alone.

      var searchexpr as string

      searchexpr = tagids[WepProf.?,"|"]

      foreach pick in hero from BaseWep where searchexpr
        perform eachpick.assign[Helper.ExoticProf]
        nexteach


            ~Lets assign the One Handed tag to our chosen weapon deleting the Two Handed tag first.
                 foreach pick in hero from BaseWep where "wFtrGroup.Flails"
            perform eachpick.delete[wClass.TwoHanded]
                     perform eachpick.assign[wClass.OneHanded] 
                       nexteach




Dormio Forte Somnio


Community Created Resources :
Data Package Repositories :
d20pfsrd
Custom Character Sheets
Community Server Setup (Packs)

Hero Lab Help- Video Tutorials and Pathfinder FAQ

Created by the community for the community

Last edited by bodrin; August 25th, 2013 at 02:59 AM. Reason: Edited the script to include comments.
bodrin is offline   #1 Reply With Quote
Aaron
Senior Member
 
Join Date: Oct 2011
Posts: 6,793

Old August 23rd, 2013, 06:30 AM
Are you having problems? Or does this work fine and you're just posting it so others can see and use it in the future?
Aaron is offline   #2 Reply With Quote
bodrin
Senior Member
 
Join Date: Feb 2007
Location: Nottinghamshire, United Kingdom
Posts: 1,265

Old August 23rd, 2013, 06:47 AM
Quote:
Originally Posted by Aaron View Post
Are you having problems? Or does this work fine and you're just posting it so others can see and use it in the future?
No problem, just posting a working script for future reference. Helping others, paying it forward.

Dormio Forte Somnio


Community Created Resources :
Data Package Repositories :
d20pfsrd
Custom Character Sheets
Community Server Setup (Packs)

Hero Lab Help- Video Tutorials and Pathfinder FAQ

Created by the community for the community
bodrin is offline   #3 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,207

Old August 23rd, 2013, 08:38 AM
If you want to post examples, I recommend you fix a few coding style issues:

You should never use SpcReplace as your test for whether something is disabled. SpcReplace should never be present without SpcDisable also being present, because it's there only to describe why a thing was disabled, and there are many things that will disable without replacing.

Your WepProf and wClass tag handling should have comments - I can't figure out why you're forwarding those to the hero, or why you're pulling in two different tags, then only using one of them in the search.

For a search through weapons, don't you want to use IsWeapon - that's the tag that means "we count as this weapon"?

A single line of tagreplace[] can be used instead of two lines of delete[] and assign[].

I recommend making sure that the weapon is two-handed before assigning one-handed to it. Otherwise, you'll be assigning the one-handed tag to all the light weapons, too, and you'll be doubling up that tag on all the weapons that were already one-handed.

Last edited by Mathias; August 23rd, 2013 at 09:00 AM.
Mathias is online now   #4 Reply With Quote
bodrin
Senior Member
 
Join Date: Feb 2007
Location: Nottinghamshire, United Kingdom
Posts: 1,265

Old August 23rd, 2013, 09:02 AM
Quote:
Originally Posted by Mathias View Post
If you want to post examples, I recommend you fix a few coding style issues:

You should never use SpcReplace as your test for whether something is disabled. SpcReplace should never be present without SpcDisable also being present, because it's there only to describe why a thing was replaced, and there are many things that will disable without replacing.

Your WepProf and wClass tag handling should have comments - I can't figure out why you're forwarding those to the hero, or why you're pulling in two different tags, then only using one of them in the search.

For a search through weapons, don't you want to use IsWeapon - that's the tag that means "we count as this weapon".

A single line of tagreplace[] can be used instead of two lines of delete[] and assign[].
This was butchered from the Tengu Swordtrained script.
Once I'd got the desired effect I left it alone.

I needed the race this applies to to gain the proficiency with the selected weapons, I presumed the push tags part would do that.

Thank you for the tagreplace[] suggestion. I'll try this later. It's still a work in progress.

Dormio Forte Somnio


Community Created Resources :
Data Package Repositories :
d20pfsrd
Custom Character Sheets
Community Server Setup (Packs)

Hero Lab Help- Video Tutorials and Pathfinder FAQ

Created by the community for the community
bodrin is offline   #5 Reply With Quote
ShadowChemosh
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729

Old August 23rd, 2013, 10:38 AM
Quote:
Originally Posted by Mathias View Post
Your WepProf and wClass tag handling should have comments.....
In my opinion, there is nothing in the programming field more despicable than an uncommented program. A programmer can be forgiven many sins and flights of fancy, however no programmer, no matter how wise, no matter how experienced, no matter how hard-pressed for time, no matter how well-intentioned, should be forgiven an uncommented and undocumented program.

Thats my favorite saying to give to my programmers when doing a code review. Its even written up in my standards document. Once a person has to debug a 3,000 line program without a single comment they will never leave code uncommented 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   #6 Reply With Quote
Umarian
Senior Member
 
Join Date: Apr 2010
Location: Lemont, IL
Posts: 320

Old August 23rd, 2013, 10:57 AM
If only we could get everyone to put comments in....what a wonderful world it would be!
Umarian is offline   #7 Reply With Quote
bodrin
Senior Member
 
Join Date: Feb 2007
Location: Nottinghamshire, United Kingdom
Posts: 1,265

Old August 23rd, 2013, 12:25 PM
So the pushtags / pulltags comment would be :-

~ I don't know what this does but it's in the original script I've copied and modified.

Dormio Forte Somnio


Community Created Resources :
Data Package Repositories :
d20pfsrd
Custom Character Sheets
Community Server Setup (Packs)

Hero Lab Help- Video Tutorials and Pathfinder FAQ

Created by the community for the community
bodrin is offline   #8 Reply With Quote
ShadowChemosh
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729

Old August 23rd, 2013, 12:47 PM
Quote:
Originally Posted by bodrin View Post
So the pushtags / pulltags comment would be :-

~ I don't know what this does but it's in the original script I've copied and modified.
Are you trying to make the person proficient with the weapons also as that is what it is doing by pushing the tags to the hero.

If you took out that code what happened? What happens when you add it back in? Sometimes you have to find answers via trial/error and see what the results are when you do "X".

Trust me I have no magic way of knowing what HL does. I have access to the same information everyone else on these boards do. I have learned that you often learn more from errors than from something that works.

Heck just the other day I actually did some bad stuff so badly that it hard crashed HL. I quickly figured out that trying to inherit the tag group properties from a group that was defined afterwards is NOT good. The point is now I know and won't do that again. Plus if someone presented to me the same situation I can easily find the reason.

Break scripts up into pieces and see what the results are of those pieces. Breaking things down to very very small pieces of code will help allot in how it all works together.

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   #9 Reply With Quote
ShadowChemosh
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729

Old August 23rd, 2013, 12:51 PM
Quote:
Originally Posted by bodrin View Post
So the pushtags / pulltags comment would be :-

~ I don't know what this does but it's in the original script I've copied and modified.
P.S. - Actually not a bad comment. I had sort of guessed that from the above code as I am using seeing copied code that is just left. At least with a comment the next person is not "guessing" they know it was left and if not needed could be taken out.

When fixing/debugging its very helpful to know the mind of the original programmer.

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   #10 Reply With Quote
Reply

Thread Tools
Display Modes

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 01:02 PM.


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