Page 1 of 8

Plo's Inventory Manager

Posted: Tue Jun 29, 2010 8:42 pm
by plothos
EDIT: Here's the lastest pass at my inventory system with incorporated coinpurse function and weight-tracking/wand charges support. Installation has been greatly simplified, and hopefully all major bugs have been squashed.
Inventory Demo.jpg
Inventory Demo.jpg (101.94 KiB) Viewed 15759 times
Features:
-Add any number of items with data for item weight, number carried, and a description.
-Create "containers" that allow other items to be placed inside them (just to help you track where stuff is)
-Sort items by name (alphabetical with items in containers all placed indented after the container), or by weight, or by quantity.
-Total weight of all carried items
-Ability to tell the manager to ignore the weight of any entry (say for bags of holding, etc.)
-Add or ignore weight of coins from the coinpurse
-Set a reminder by the total weight as to how encumbered you are (current macro gives prompts according to 4E rules, but these prompts can be ignored).
-Full non-magic weapons/ammo/armor/gear pre-coded for D&D 4E (use of this entirely optional)
-Ability to create wands with any number of charges, use charges (1 at a time with a report of the use), and recharge.
-Item transfer function allows you to pass an item between tokens via a series of links sent between players.

At present, it uses data stored on the lib for quick additions of gear, and the info is from the D&D 4E players handbook, but additions can be made manually as well, so there's really no limitation here - just ignore the 4E data if you don't want it.

Installation (now with 62% more easy):
-Drop the lib into your campaign and make sure it's player-visible.
-Make sure the lib is called "Lib:inventory".
-Check the notes on the lib for a brief comment on the few possible-but-unlikely conflicts.
-Drag or copy the black "Open Inventory" macro button to tokens or to the global/campaign panels (make sure apply to selected is checked)
-Select a token then click said button and you should be off and running.

Re: Plo's Inventory Manager

Posted: Tue Jun 29, 2010 9:51 pm
by aliasmask
Lately, I've become a big fan of not using campaign properties. Can you put a check in your open code to check for the properties and if not there run a setup where they are defined. I find there is very little need for most properties to be manually edited.

edit: Maybe write a custom property like setProperty("h.inventoryManagerVersion",versionNumber,currentToken()) and do a check for that value. Also, if there is a future upgrade this property can be checked as well if more props or whatever needs to be done.

Re: Plo's Inventory Manager

Posted: Tue Jun 29, 2010 10:42 pm
by plothos
Not 100% sure what you're asking for or what the issue is. I mean, I could go through the code and replace all the prop calls/definitions with getProperty() and setProperty() stuff to use hidden props. Or are you asking me to check if there's a property called Coinpurse and if not to use a macro to define it so the GM doesn't have to do it via campaign properties? If so, not sure what the big deal is there.

Re: Plo's Inventory Manager

Posted: Wed Jun 30, 2010 12:34 am
by aliasmask
ah, nm... yeah, I typically always use the getProperty. I wasn't thinking that other people didn't. Don't bother on my account. Sounds like a lot of extra work.

Re: Plo's Inventory Manager

Posted: Wed Jun 30, 2010 12:44 am
by Voltang
This looks very interesting, especially since the use of the spell manager you created has, with some hiccups, made it easier to envision a day when I don't have to tab out of map tools to look something up on a character sheet or in the srd.

Some questions: can the items in this inventory interact or be made to interact with the item and mod sets in the lmarkus Pathfiinder framework? Or with the spell manager, even, allowing a wand or scroll to be deleted from the inventory when it is expended in the manager?

Right now I'm just now learning how to create more complex macros and my reach often exceeds my understanding of what the code can actually do.

Re: Plo's Inventory Manager

Posted: Wed Jun 30, 2010 1:36 am
by plothos
aliasmask wrote:ah, nm... yeah, I typically always use the getProperty. I wasn't thinking that other people didn't. Don't bother on my account. Sounds like a lot of extra work.
I've started doing this when I have modularity and share-ability in mind. But a lot of the code here came out of my pre-existing FW-integrated stuff, so I didn't want to recode it. I don't think it's a big deal to ask people to establish props, but if you can code a lib to be just drop-in-able, it's definitely preferable.

Re: Plo's Inventory Manager

Posted: Wed Jun 30, 2010 1:42 am
by plothos
Voltang wrote:Some questions: can the items in this inventory interact or be made to interact with the item and mod sets in the lmarkus Pathfiinder framework? Or with the spell manager, even, allowing a wand or scroll to be deleted from the inventory when it is expended in the manager?
They absolutely can. In fact, if you peruse the lib, you'll find most of the buttons that are not colored blue are in fact not being used (in retrospect I should have deleted them and will in future releases), and are hold-overs from my FW-integrated version. That's 3.5, but gives you an idea of one way to do some of this. I am not familiar with even the use of lmarkus's FW, much less the coding, so I don't know what data you'd need, but the way I did it is I have the base weapon, and I have an enchantments/mwk/materials menu that you use to adjust stuff, etc., and the AB and dmg bonuses, along with the enchantments, 2H, double, light, etc., is all saved in a big json in the item's entry that I call "Useinfo". Then I have equip option when you click the item in the inventory, which sets the token to use the weapons/armor, etc.

So it's definitely doable, but how you do it depends very much on the FW you're working with. I'd have put some of that in, but I wanted the tool to be as FW agnostic as possible.

Re: Plo's Inventory Manager

Posted: Wed Jun 30, 2010 2:56 am
by wolph42
Very slick!

and erm
Lately, I've become a big fan of not using campaign properties. Can you put a check in your open code to check for the properties and if not there run a setup where they are defined. I find there is very little need for most properties to be manually edited.

edit: Maybe write a custom property like setProperty("h.inventoryManagerVersion",versionNumber,currentToken()) and do a check for that value. Also, if there is a future upgrade this property can be checked as well if more props or whatever needs to be done.
<N00b>can I conclude from this that you can use setProperty(), without first having the property first defined on the respective token? And if so how do you detect whether it is or isn't predefined?</n00b>

Re: Plo's Inventory Manager

Posted: Wed Jun 30, 2010 3:16 am
by JML
Great job plothos. I might borrow it for a framework I'm working on.

I've got a few questions regarding my own needs, but they may be of some interest for others :
  • 1) is it possible to have containers inside containers ?

    2) is it possible for a PC to drop a container on a temporary basis, aka a "drop" state ? (dropping a backpack to get rid of some encumbrance during a fight for instance)

    3) and the dropping idea leads me to wonder if it would be possible to exchange containers between tokensĀ ? Which would allow to lend to others or even steal or being stolen :twisted:

Re: Plo's Inventory Manager

Posted: Wed Jun 30, 2010 3:33 am
by plothos
wolph42 wrote:Very slick!
Thanks! :D
wolph42 wrote:and erm
...
<N00b>can I conclude from this that you can use setProperty(), without first having the property first defined on the respective token? And if so how do you detect whether it is or isn't predefined?</n00b>
Yes, setProperty() and setLibProperty() can be used to store data in "hidden" properties. Their get correlates retrieve it. It's a good way to go, if you're looking to share a tool via a lib like this. For instance, my initiative window lib uses setLibProperty() all over the place and you never have to define anything to get it to work.

Determining if a prop is defined (one method): first find out what property set the token is using getPropertyType() and then getting a list of what props are defined for that type with getAllPropertyNames() (don't confuse this or what it does with the similar function getPropertyNames(); the names of these functions are very confusing, and it's unfortunate.)

Re: Plo's Inventory Manager

Posted: Wed Jun 30, 2010 3:34 am
by aliasmask
wolph42 wrote:<N00b>can I conclude from this that you can use setProperty(), without first having the property first defined on the respective token? And if so how do you detect whether it is or isn't predefined?</n00b>
When you get the property and it's "" when it should have some value is your first clue, but to know for sure you can use Wiki: getMatchingProperties() or Wiki: getMatchingLibProperties() to see if it exists.

Re: Plo's Inventory Manager

Posted: Wed Jun 30, 2010 3:35 am
by wolph42
thnx for the heads up!

Re: Plo's Inventory Manager

Posted: Wed Jun 30, 2010 3:37 am
by plothos
JML wrote:Great job plothos. I might borrow it for a framework I'm working on.

I've got a few questions regarding my own needs, but they may be of some interest for others :
  • 1) is it possible to have containers inside containers ?

    2) is it possible for a PC to drop a container on a temporary basis, aka a "drop" state ? (dropping a backpack to get rid of some encumbrance during a fight for instance)

    3) and the dropping idea leads me to wonder if it would be possible to exchange containers between tokensĀ ? Which would allow to lend to others or even steal or being stolen :twisted:
1. You can put a container inside a container, but the way it's set up right now if you put stuff inside the container in a container they won't be sorted quite right.

2. There's no drop state per se, but you can click on the item and choose "ignore weight" or whatever I called it, and the weight of the item will be ignored in the total - the weight entry will be surrounded by [] to indicate this.

3. Another option that should come up when you click an item is "give" and when you choose this it will send a link to another player that will let them accept it, up which you will be returned a link that if clicked will remove the item from your inventory. This works for anything in there, including containers, but it won't transfer the contents of the containers (as of yet).

Re: Plo's Inventory Manager

Posted: Wed Jun 30, 2010 5:04 am
by JML
Which means I'll get all I dreamed of with only a few tweaking from my part or waiting for yours. :wink:

Thanks a lot.

Re: Plo's Inventory Manager

Posted: Sun Jul 04, 2010 1:30 pm
by biodude
plothos wrote:
aliasmask wrote:ah, nm... yeah, I typically always use the getProperty. I wasn't thinking that other people didn't. Don't bother on my account. Sounds like a lot of extra work.
I've started doing this when I have modularity and share-ability in mind. But a lot of the code here came out of my pre-existing FW-integrated stuff, so I didn't want to recode it. I don't think it's a big deal to ask people to establish props, but if you can code a lib to be just drop-in-able, it's definitely preferable.
I second this request: I do not want to have to add properties to my campaign properties, especially if I just want to try it out. getProperty() & setProperty() makes this unnecessary.
And Lib:Tokens should never require campaign properties (there was a thread ages ago that beat this into me when I didn't understand).

One other small suggestion: create a macro group that appears near the top of the macro panel for the lib: token that has the interface macros (the one you use to call the UDFs, etc.) already made-up. Then, people can just drag them over to their campaign properties / tokens. Entrepid folks can even write a simple 'installer' macro that does all the copying automatically, rather than creating the macros from scratch every time.

Making a Lib:Token as "Drop-in" as possible only takes a little extra effort in my experience, but it makes the result so much easier to use.

The tool looks great, I can't wait to try it out.