Lone Wolf Development Forums  

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

Notices

Reply
 
Thread Tools Display Modes
Skarn
Member
 
Join Date: Jun 2016
Location: KS, USA
Posts: 39

Old November 11th, 2018, 09:09 PM
I'm trying to code a few different sizes of barrel (based on real-world cooperage) that will adjust their weight based on how many 4 oz. "servings" are contained within them. (My initial intention is to use them to keep track of how many doses of "Tears to Wine" I have, since a single creature drinking the entire output of a first level druid's casting of the spell at 3.74 gallons (0.5'^3) would be enough to induce water poisoning and kill most people.)

I have the barrels set up so that they appear in Tracked Resources with an appropriate number of "charges", and I can currently change the weight from empty to full based on a checkbox under Activated Abilities using an Eval Script.

Is there an existing item I could scavenge code from that programmatically checks the Tracked Resources/remaining charges value and does something based on that?

Is it possible to programmatically change the number of "charges" used so that I could use the activation checkbox to 'refill' a barrel? Similarly, could I clear the checkbox from my script if the number of charges drops below a certain point?

Is there some way to put a button rather than a checkbox in the activation area as more appropriate than a button for refilling?

In looking at the Leadership feat, I can see how it adds the tracker for modifiers to the leadership score, but I haven't been able to find in the editor where this is handled programmatically; I can see where it bootstraps 'LeaderHelp', but I can't find that thing in the editor.

Finally, is what I'm proposing currently within the known capabilities of Hero Lab?
Skarn is offline   #1 Reply With Quote
Farling
Senior Member
 
Join Date: Mar 2013
Location: Greater London, UK
Posts: 2,623

Old November 11th, 2018, 10:42 PM
A bag of holding gets the weight of the contained items to be ignored. You could have a look at how that is achieved, to then adjust your own item's weight?

Farling

Author of the Realm Works Import tool, Realm Works Output tool and Realm Works to Foundry module

Donations gratefully received via Patreon, Ko-Fi or Paypal
Farling is offline   #2 Reply With Quote
Aaron
Senior Member
 
Join Date: Oct 2011
Posts: 6,793

Old November 12th, 2018, 09:12 AM
Quote:
Originally Posted by Skarn View Post
Is there an existing item I could scavenge code from that programmatically checks the Tracked Resources/remaining charges value and does something based on that?
No example comes to mind.

Quote:
Originally Posted by Skarn View Post
Is it possible to programmatically change the number of "charges" used so that I could use the activation checkbox to 'refill' a barrel? Similarly, could I clear the checkbox from my script if the number of charges drops below a certain point?
The "charges used" field is a user field (trkUser), which means it is not meant to be changed by scripts, and it is persistant. This is because as users click through they are setting the value of the field themselves, and we don't want to change that. Now a script can be told to ignore the "don't change user fields" behavior by inserting a trustme command prior to making the change, but its still going to be persistant, and you're not going to have any sort of "are you sure" confirmation dialogue. Someone activates this script, it's going to wipe whatever clicks had set the user field to before.

Quote:
Originally Posted by Skarn View Post
Is there some way to put a button rather than a checkbox in the activation area as more appropriate than a button for refilling?
If by "button" you mean something like the Nights Rest on the In-play tab, then no. There is currently no way to place a button like that for a user, you'll have to make do with activation checkboxes.

Quote:
Originally Posted by Skarn View Post
In looking at the Leadership feat, I can see how it adds the tracker for modifiers to the leadership score, but I haven't been able to find in the editor where this is handled programmatically; I can see where it bootstraps 'LeaderHelp', but I can't find that thing in the editor.
LeaderHelp stores and array for benefits to be read from, it's not a tracker, so I don't think that's what you're looking for? Check out the procedures called from within the leadership feat's script, LdrValCalc, LeaderLst, LeaderScor if you need more info on how that works, but I am not sure how this is related to the other questions above.

Quote:
Originally Posted by Skarn View Post
Finally, is what I'm proposing currently within the known capabilities of Hero Lab?
I think it's doable. You can access the current number of charges because that is stored in the user field, then multiply that by whatever weight factor each charge should add (based on whatever your house rule says), and override the weight field (gWeight) for the barrel. I think the main challenge will be finding the right timing to override the weight.
Aaron is offline   #3 Reply With Quote
Skarn
Member
 
Join Date: Jun 2016
Location: KS, USA
Posts: 39

Old November 12th, 2018, 12:04 PM
Quote:
Originally Posted by Farling View Post
A bag of holding gets the weight of the contained items to be ignored. You could have a look at how that is achieved, to then adjust your own item's weight?
I'm not trying to put something into these barrels that exists elsewhere in inventory. Also, the bag of holding and handy haversack simply ignore the weight of items placed into them rather than removing this, that, or the other thing from the calculation item by item.

I do appreciate the attempt to assist, though.

Quote:
Originally Posted by Aaron View Post
The "charges used" field is a user field (trkUser) . . . I think it's doable. You can access the current number of charges because that is stored in the user field, then multiply that by whatever weight factor each charge should add (based on whatever your house rule says), and override the weight field (gWeight) for the barrel. I think the main challenge will be finding the right timing to override the weight.
That did the trick. Once again, much appreciation.
Code:
Pre-levels, 900
field[gWeight].value = 6 - (field[trkUser].value * 0.25)
The above line defaults to a full 1 quart "hand-keg" and removes weight for each 4 oz. 'dose' consumed, based on a gallon (of water) being rounded from 8.3# to 8#.

Also, it turns out that Hero Lab automatically added a 'reset to default value' button on the tracked resources entry for it, so I have my 'click to refill' after all.

The timing I used has been working for me on waterskins and jugs that automatically calculated weight based on full or empty. So far it tests like a champ for these barrels, too.

Edit: Answering another of Aaron's comments: The reason why I mentioned Leadership in the OP is the tracker on it's activation entry that lets you change the modifier to your leadership score. Turns out I didn't need to go that route after all.

Last edited by Skarn; November 12th, 2018 at 12:07 PM.
Skarn is offline   #4 Reply With Quote
Azhrei
Senior Member
 
Join Date: Sep 2015
Posts: 435

Old November 13th, 2018, 08:20 AM
This sounds like a change that should be incorporated into the base HL data set for PF — very useful, thanks!

I'll make my own version of this for various containers in the short term, but maybe ShadowChemosh will end up adding something like it to the Community Pack...? (Wink, wink, nudge, nudge)
Azhrei is offline   #5 Reply With Quote
Skarn
Member
 
Join Date: Jun 2016
Location: KS, USA
Posts: 39

Old November 13th, 2018, 08:34 AM
Quote:
Originally Posted by Azhrei View Post
This sounds like a change that should be incorporated into the base HL data set for PF — very useful, thanks!
I'm thrilled to find that I'm not the only person who finds it useful. You're quite welcome.
Skarn is offline   #6 Reply With Quote
ShadowChemosh
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729

Old November 13th, 2018, 11:27 AM
Quote:
Originally Posted by Azhrei View Post
ShadowChemosh will end up adding something like it to the Community Pack...? (Wink, wink, nudge, nudge)
I actually have such logic already running in my houserules file but never figured any other group was OCD enough to worry about small weights of arrows or usable items.

I can take a look and see how I could add it to the community Pack because it designed to run all the time without turning off currently. Which is not good for the community.

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   #7 Reply With Quote
Skarn
Member
 
Join Date: Jun 2016
Location: KS, USA
Posts: 39

Old November 13th, 2018, 11:43 AM
Quote:
Originally Posted by ShadowChemosh View Post
I actually have such logic already running in my houserules file but never figured any other group was OCD enough to worry about small weights of arrows or usable items.
In my case, OCD >and< Aspergian.

Besides, keeping enough Tears to Wine-created mead on hand to maintain a constant effect can get pretty heavy at lower levels.

Quote:
Originally Posted by ShadowChemosh
I can take a look and see how I could add it to the community Pack because it designed to run all the time without turning off currently. Which is not good for the community.
I took out the activation component (identical to the adaptive jug and waterskin that I offered up for the community pack some time back) from my barrels when I added in the script to track serving weight.

If that activation component was added back in, wouldn't it be possible to use the activation checkbox to disable calculations? If I'm not mistaken, that should then cause the item to default to the weight assigned in the editor.
Skarn is offline   #8 Reply With Quote
Azhrei
Senior Member
 
Join Date: Sep 2015
Posts: 435

Old November 14th, 2018, 09:57 AM
OCD-ish? Yeah, I suppose.

For me, I want to correct the silly wineskin that weighs 4 lbs even when it's empty.
Azhrei is offline   #9 Reply With Quote
Skarn
Member
 
Join Date: Jun 2016
Location: KS, USA
Posts: 39

Old November 14th, 2018, 10:09 AM
Quote:
Originally Posted by Azhrei View Post
OCD-ish? Yeah, I suppose.

For me, I want to correct the silly wineskin that weighs 4 lbs even when it's empty.
Check out this post in the Community Pack thread for a .USER file that does almost exactly what you want.

Its a clay jug that I configured based on an activation button for full or empty weight; the only difference between that and what you want is that I used the standard waterskin weight for full, and 0.5# for empty. (The official empty weight would mean that a full skin only holds half what is claimed.)

Shouldn't be too difficult to adapt it for more precision with the code here if that's what you prefer.
Skarn 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 07:10 AM.


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