Plo's Inventory Manager

These are tools and utilities that make it easier to run games. This includes Lib: macro tokens dropped into MapTool to manage the game, a conversion file for CharacterTool to allow use in MapTool, or just about anything else you can think of -- except graphics with macros and anything specific to a particular campaign framework. Those are already covered by the Tilesets subforum and the Links and External Resources forum.

Moderators: dorpond, trevor, Azhrei, giliath, Gamerdude, jay, Mr.Ice

User avatar
plothos
Great Wyrm
Posts: 1890
Joined: Sat Jun 21, 2008 1:07 am

Re: Plo's Inventory Manager

Post by plothos »

Well, I balk at using phrases like "you should do X" when describing what is a better (but more labor-intensive) way to code something, yes, it would be better if this was easier to install. I didn't for the aforementioned reasons, but I will recode things when I get the chance. Thought I'd get it out the door first. :wink:
Drop-In Utilities:
My Spell Manager for D&D3.5 and PFRPG
My Inventory Manager for D&D and PFRPG, but more generally useable than that.
My Message Manager -- My Top-Down D&D Token Images
and my Custom Initiative & Status/Spell-Effect Tracker (work in progress, but functional).

User avatar
biodude
Dragon
Posts: 444
Joined: Sun Jun 15, 2008 2:40 pm
Location: Montréal, QC

Re: Plo's Inventory Manager

Post by biodude »

plothos wrote:Well, I balk at using phrases like "you should do X" when describing what is a better (but more labor-intensive) way to code something, yes, it would be better if this was easier to install. I didn't for the aforementioned reasons, but I will recode things when I get the chance. Thought I'd get it out the door first. :wink:
I can totally relate.

The only reason I say 'Lib Tokens should never require campaign properties' is because lib properties are most reliably accessed using set/getLibProperty anyway (which allows access to properties even when the lib token is on another map), and given the fact that getLibProperty does not check the campaign 'default'. If you are accessing the lib properties with getLibProperty, then defining the properties in the campaign is unnecessary. Granted, 'should' is a strong, value-laden word, but it's based on some 'best practices' I learned from others. Not gospel, just a suggestion.

When you do get a chance to make some improvements, here some other suggestions to consider (these are all based on personal preference, so feel free to disagree):

Have you considered adding a CSS stylesheet to the main frame HTML? Even if you don't use it, having it already built in makes it that much easier for users to modify the appearance to suit their personal tastes. All it takes is a line like this in the <head></head> section of your html:

Code: Select all

<link rel="stylesheet" type="text/css" href="Inventory.css@[r: getMacroLocation()]"> <!-- "@this" will not work -->
and a macro named "Inventory.css" (or something similar) somewhere on the Lib token (I add a white background to mine to make them easier to find, but that's up to you). If you want to get really fancy, you can add classes and IDs to elements of your HTML for people to target with their CSS.

Given that the "Add an Item" link leads immediately to an input dialog to choose a category, what if there were simply a link for each category in the main interface? That might save the user an extra step, but I'm not sure about how much extra clutter it would add.

Could 'Location' also be a column in the table? Might make it easier to find items when they are sorted differently. I could also see this acting as a place to note "Body Slots" when equipping items... Which reminds me of pyromancer2k's generic Inventory API: I loved the simplicity of set-up, but always felt somewhat constrained in a lot of ways.

Splitting the weight column into a column for the unit weight, and another for the total, might look a bit cleaner (things would line up), and make it easier to see the breakdown.


A few bugs I might have found?
- When I try to 'Give' an item away, I get the error: "Unknown library token Lib:weapon." I guess this is left over from the integration with your full framework?
- When I click on the Encumberance link ("Light"), I get the error: "Illegal argument type java.lang.String, expecting java.math.BigDecimal" No idea what's going on there. [EDIT: the "Strength" property on the token was empty (not a number) ]

I like the simplicity of what you put out so far. It has inspired to me to re-think my 'ideal' inventory manager, and given me a few more ideas (danger! danger!). Thanks.
"The trouble with communicating is believing you have achieved it"
[ d20 StatBlock Importer ] [ Batch Edit Macros ] [ Canned Speech UI ] [ Lib: Math ]

User avatar
plothos
Great Wyrm
Posts: 1890
Joined: Sat Jun 21, 2008 1:07 am

Re: Plo's Inventory Manager

Post by plothos »

I think I have the item transfer bug worked out (sorry about that - I had borrowed my list of people to give to from my attack macro targeting routine - I also uncovered some (non)ownership issues along the way that I hope to have hashed out with a less-than-ideal ownership checks and assert() messages).

I believe I've also taken care of Strength being either blank or a text string.

Now working on the get/setLibProperty() thing and will repost when that's done.
Drop-In Utilities:
My Spell Manager for D&D3.5 and PFRPG
My Inventory Manager for D&D and PFRPG, but more generally useable than that.
My Message Manager -- My Top-Down D&D Token Images
and my Custom Initiative & Status/Spell-Effect Tracker (work in progress, but functional).

User avatar
Paradox
Dragon
Posts: 724
Joined: Fri Feb 27, 2009 4:01 pm

Re: Plo's Inventory Manager

Post by Paradox »

Hey Plothos,

I'm back to Pathfinder after a 4E trial. (I like 4E, but I know what my preference is now).

I'm looking at this with interest.

I'd like to second the request to have it integrate with your Spell Manager. I use the Special Abilities part of the Spell Manager to track potions, Scrolls, and Wands.. It would be awesome if these two tools "talked to each other".

I still use Lindsay's FW, but I understand what you mean about System Agnostic. Fortunately, your Spell Manager works fine with Lindsay's FW, I have no dount this one will too.

Ease of installation is cool, but I'm not going to harp on it. I think others have said it well enough.

Great work! I'm so happy to see you're still in the FW Design game. You are still really appreciated for all of your work (same goes for Lindsay and AliasMask).
I no longer believe that MapTools is usuable or intended just for programmers. MapTools is for everyone.

User avatar
Pyro-Tech
Cave Troll
Posts: 34
Joined: Sat Jun 12, 2010 10:23 pm

Re: Plo's Inventory Manager

Post by Pyro-Tech »

I have a quick question....new to the whole map tools thing.

You talk about adding the property Strength to a token, well what if the token already has a prop on it called Strength meaning the attribute?? Does it clash or what??

I like the idea of this system and look forward to intergrating it with the framework I will be using.
Image

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: Plo's Inventory Manager

Post by aliasmask »

There are two sources for getting a property value for a token. There is the default value defined in campaign properties under token properties for the matching token type. And there is the value that is set on a token which overwrites the default value. You can only get a default value if it is defined in campaign properties ahead of time for that token's type. You can have more than one type with the same property defined.

If Strength is already defined and in campaign properties with a default value of 10, then 10 will show up in the properties window of the new token. You can get the value by direct reference:

Code: Select all

[H: myStrength = Strength]
Or through indirect reference:

Code: Select all

[H: myStrength = getProperty("Strength")]
Let's say Strength value is left at the default for the current Token Properties for the config type "basic". But then you change the type in config to "DnD35" which also has Strength. If the defined default value is different, it will show the new default value... let's say 8. You never assigned a value to Strength, but because of the campaign properties default value, it shows one. Now let increase the Strength to 18:

Code: Select all

[H: Strength = 18]
This works because Strength is defined in the campaign properties as a value that can be directly references. But we also have hidden properties that can be defined. Lets say we create one called "StrBonus". Since it's not defined in the campaign properties we can't use the direct reference to assign the value, so we use the indirect way:

Code: Select all

[H: setProperty("StrBonus",floor((Strength - 10)/2)]
<!-- OR -->
[H: setProperty("StrBonus",floor((getProperty("Strength") - 10)/2)]
The benefit of creating a property for "StrBonus" in the campaign properties is we don't have to keep doing the math. If we create and set the default value for StrBonus in campaign properties to:

Code: Select all

StrBonus:[floor((Strength -10)/2)]
We can then use StrBonus by direct reference and don't have to keep doing the math ourselves.

Keep in mind, we never added a value to the token for StrBonus because we're making the campaign properties have the value based on other values with in the token, namely Strength. Strength also having a default value could also not have a defined value on the token. So, if save my token and someone else load it up, the Strength and StrBonus values will not be defined because they were defined in my campaign properties and not the token. In order to assure those values exist, I have to use Wiki: setProperty() or assign it a different value other than the default value with a direct reference.

This is kind of wordy, but I'll summarize it for you. Values don't get saved to a token until you set the value in your token properties to a value other than your default, or by using a macro that sets it to a value other than default through direct assignment [strength = 18] or through use of the Wiki: setProperty() function.

User avatar
plothos
Great Wyrm
Posts: 1890
Joined: Sat Jun 21, 2008 1:07 am

Re: Plo's Inventory Manager

Post by plothos »

If you already have a Strength property, it will work fine (assuming it has a number value entered - and even if it doesn't the lib will now determine that and treat it as a 0).

So I really shouldn't say add the properties to your campaign but rather make sure the properties are in the campaign (and have the types of values stored in them that the lib expects).
Drop-In Utilities:
My Spell Manager for D&D3.5 and PFRPG
My Inventory Manager for D&D and PFRPG, but more generally useable than that.
My Message Manager -- My Top-Down D&D Token Images
and my Custom Initiative & Status/Spell-Effect Tracker (work in progress, but functional).

User avatar
JonathanTheBlack
Dragon
Posts: 544
Joined: Mon Jun 28, 2010 12:12 pm
Location: I'm the worm...

Re: Plo's Inventory Manager

Post by JonathanTheBlack »

What should I put in my attack macro's if I want to get the weapon name, damage, and range?

User avatar
plothos
Great Wyrm
Posts: 1890
Joined: Sat Jun 21, 2008 1:07 am

Re: Plo's Inventory Manager

Post by plothos »

I suppose you could extract that info from the description texts, but it'd be an inelegant pain. (Name is easy, but the other stuff less so).
The better way to go would be to add that info to the item entries themselves. The way it's set up now, each item entry is a json object that contains a field called "UseInfo" that holds (at the moment) an empty json object. You could go into those fields (or code a macro that lets you do it more easily) and add the relevant info. Then just have your attack macro call the info from UseInfo.

I didn't add that in, because I wasn't coding this to be designed for any specific framework. I probably should have realized that just about any FW is going to need this basic info, but hindsight is 30/400 as they say.

In the near future I'll be posting my FW with this integrated, and you'll be able to see one (suboptimal) approach to doing the above.
Drop-In Utilities:
My Spell Manager for D&D3.5 and PFRPG
My Inventory Manager for D&D and PFRPG, but more generally useable than that.
My Message Manager -- My Top-Down D&D Token Images
and my Custom Initiative & Status/Spell-Effect Tracker (work in progress, but functional).

User avatar
JonathanTheBlack
Dragon
Posts: 544
Joined: Mon Jun 28, 2010 12:12 pm
Location: I'm the worm...

Re: Plo's Inventory Manager

Post by JonathanTheBlack »

Figglesnoots. I guess my players can edit their attack macro's individually. They're first level and won't have that many for a long time.

User avatar
plothos
Great Wyrm
Posts: 1890
Joined: Sat Jun 21, 2008 1:07 am

Re: Plo's Inventory Manager

Post by plothos »

See first post for latest version, the official v1.0 of the InvLib.
I've coded everything so that hopefully you should not have to define any properties anywhere to use the basic features. (The macro buttons on the lib that I used to set up the default inventory have not been recoded, and won't work without the properties listed in the GM notes on the Lib.)

I have also fixed the item-transfer process, and I've added support for charge-tracking for wands. This technically could handle staffs as well, but would require multiple clicks, atm, to use multiple charges.

As always, I hope it works and is helpful, and appreciate comments/kudos/critiques/suggestions/requests/delicious-food-bequests.
Cheers! :)
Drop-In Utilities:
My Spell Manager for D&D3.5 and PFRPG
My Inventory Manager for D&D and PFRPG, but more generally useable than that.
My Message Manager -- My Top-Down D&D Token Images
and my Custom Initiative & Status/Spell-Effect Tracker (work in progress, but functional).

User avatar
plothos
Great Wyrm
Posts: 1890
Joined: Sat Jun 21, 2008 1:07 am

Re: Plo's Inventory Manager

Post by plothos »

Right, so further testing has revealed I failed to eliminate all need to define the token variables.
I'm working to remedy this and will post again with the fix ASAP.
Drop-In Utilities:
My Spell Manager for D&D3.5 and PFRPG
My Inventory Manager for D&D and PFRPG, but more generally useable than that.
My Message Manager -- My Top-Down D&D Token Images
and my Custom Initiative & Status/Spell-Effect Tracker (work in progress, but functional).

User avatar
plothos
Great Wyrm
Posts: 1890
Joined: Sat Jun 21, 2008 1:07 am

Re: Plo's Inventory Manager

Post by plothos »

Okay, I think I've got it all sorted out. It should be fully plug-and-play now.
I've had some issues with the tokens sometimes just no longer running onCampaignLoad, so if this crops up, let me know.
Thx :D
Drop-In Utilities:
My Spell Manager for D&D3.5 and PFRPG
My Inventory Manager for D&D and PFRPG, but more generally useable than that.
My Message Manager -- My Top-Down D&D Token Images
and my Custom Initiative & Status/Spell-Effect Tracker (work in progress, but functional).

User avatar
plothos
Great Wyrm
Posts: 1890
Joined: Sat Jun 21, 2008 1:07 am

Re: Plo's Inventory Manager

Post by plothos »

Happily reporting a bug-free trial in my Friday game. Yay!
Drop-In Utilities:
My Spell Manager for D&D3.5 and PFRPG
My Inventory Manager for D&D and PFRPG, but more generally useable than that.
My Message Manager -- My Top-Down D&D Token Images
and my Custom Initiative & Status/Spell-Effect Tracker (work in progress, but functional).

User avatar
booga
Dragon
Posts: 365
Joined: Fri Dec 14, 2007 9:00 am

Re: Plo's Inventory Manager

Post by booga »

This looks great,

and I'd love to add it to my Cybeprunk Framework. I see I can customize the purse to any currency, however I can't find a way to create/remove/rename item categories (I'd like to remove Wands for example and add Cybernetics). Is there a way to do this ? I'm pretty sure I could do this with the previous version you had posted (however the Give function wasn't working), with this one I can't figure it out.

Thanks.

Post Reply

Return to “Drop-In Macro Resources”