Universal Inventory System (API)

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
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: Universal Inventory System (API)

Post by Azhrei »

It might be cumbersome at this point, but if the macros use Wiki: getProperty() and Wiki: setProperty() then adding a given property to the property type wouldn't be necessary...

Rockinorange
Kobold
Posts: 8
Joined: Sun Feb 14, 2010 2:23 pm

Re: Universal Inventory System (API)

Post by Rockinorange »

First off, I would like to say that this is such a great tool. Thanks for putting the time and effort into making it. Unfortunately, I am having a problem getting out of the door with this. I am confused as to what name I am supposed to change in "Step 2" and what am I supposed to change it to?

Also, I went through the whole thing without changing the name, and when I try to call up the inventory, i get the following error:
java.lang.NumberFormatException: For input string: "ItemTypes" error executing expression macro.return = json.get(eval(InventoryLocation), "ItemTypes").
Note: I am using 3.5 framework in case it matters.

User avatar
Raoden
Dragon
Posts: 381
Joined: Fri Dec 18, 2009 2:33 am
Location: San Diego

Re: Universal Inventory System (API)

Post by Raoden »

Rockinorange wrote:First off, I would like to say that this is such a great tool. Thanks for putting the time and effort into making it. Unfortunately, I am having a problem getting out of the door with this. I am confused as to what name I am supposed to change in "Step 2" and what am I supposed to change it to?
Hey! I'm a fellow newb, but I think I just figured this out, and I'm happy that I might actually be able to be helpful to someone else here for the first time.

Anywhere the downloaded macros contain the text

Code: Select all

inventory.location1()
replace it with the name of the Token Property in which you want your tokens to store their inventories. So if your Tokens have a Property called "Equipment," change

Code: Select all

[macro("Setup Inventory@Lib:UniversalInventorySystem"): inventory.location1()]
to

Code: Select all

[macro("Setup Inventory@Lib:UniversalInventorySystem"): "Equipment"]
(The quotation marks are important.)

This unfortunately has to be done, not just with the Call Inventory Setup macro, but also with all the Z: Calling Macros that you copy later in the setup process. Alternatively, you could rename things elsewhere. You can either just name the Token Property that keeps track of items in your campaign "Inventory", or you can edit the location1 macro button on the library token, and change its code from

Code: Select all

[H: macro.return = "Inventory"]
to

Code: Select all

[H: macro.return = "Equipment"]
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G. K. Chesterton

Wonderful HTML/CSS reference * Color Manager * Token Manager 2.0

LonePaladin
Kobold
Posts: 5
Joined: Mon May 10, 2010 12:47 am

Re: Universal Inventory System (API)

Post by LonePaladin »

This looks interesting, and definitely useful, but I can't seem to get my foot in the door. I'm assuming that I access it by launching MT and selecting File > Open Campaign. When I try this, I get the following error:
Could not load campaign.
java.util.zip.ZipException: error in opening zip file
I get the same thing if I try to do anything with the token file.

There's something else that's unrelated, but I have no idea where to post it. It appears that the gallery section of the rptools.net site is down. I want to take a look at Cweord's tokens, but just get a database error when I click the link in his signature.

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: Universal Inventory System (API)

Post by Azhrei »

Raoden wrote:[...] or you can edit the location1 macro button on the library token, and change its code from

Code: Select all

[H: macro.return = "Inventory"]
to

Code: Select all

[H: macro.return = "Equipment"]
This is the preferred approach. It allows all locations in the code to be changed at once and was requested to work this way so that the macro was more flexible in terms of which property was used to hold the information.

I think this is mentioned in the OP, IIRC.

@LonePaladin: Given the error message I would suggest that you verify that the download worked properly. As you can probably guess by that message, the ".cmpgn" (and ".rptok") file is really a ".zip" file. Try opening the file with an UNZIP utility and see if the contents can be viewed. If they can't, then your download was probably messed up somehow and you should try again.

I just tried downloading both files from RapidShare and they unzip fine for me.

LonePaladin
Kobold
Posts: 5
Joined: Mon May 10, 2010 12:47 am

Re: Universal Inventory System (API)

Post by LonePaladin »

Azhrei wrote:@LonePaladin: Given the error message I would suggest that you verify that the download worked properly. As you can probably guess by that message, the ".cmpgn" (and ".rptok") file is really a ".zip" file. Try opening the file with an UNZIP utility and see if the contents can be viewed. If they can't, then your download was probably messed up somehow and you should try again.

I just tried downloading both files from RapidShare and they unzip fine for me.
I've tried this. The files won't respond to opening in WinZip or WinRAR, and I've probably downloaded them from the links in the OP about a dozen times.

Since you got copies of the files that work the way they should, could you try sending me those copies? For some reason, the ones I'm pulling from the links are consistently getting messed up.

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: Universal Inventory System (API)

Post by Azhrei »

I'm attaching them directly here. Let me know if it works. If it does, then it's likely some combination of issues between your browser and the RapidShare service...
Attachments
UniversalInventoryV1_1.cmpgn
(117.96 KiB) Downloaded 239 times
UniversalInventory1_1.rptok
(31.94 KiB) Downloaded 274 times

LonePaladin
Kobold
Posts: 5
Joined: Mon May 10, 2010 12:47 am

Re: Universal Inventory System (API)

Post by LonePaladin »

That seemed to do the trick. Thanks a bunch!

Now to play around with it and figure out how to use it for my next game...

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: Universal Inventory System (API)

Post by Full Bleed »

jsharen wrote:Has anyone created a token for pathfinder/3.5? Would be great to get an example of what that would look like.
So... has anyone done a Pathfinder setup?
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
quikdagger
Giant
Posts: 128
Joined: Tue Jul 27, 2010 10:15 am
Location: Indianapolis, IN
Contact:

Re: Universal Inventory System (API)

Post by quikdagger »

First just let me say, I love this resource

Now onto my problem :(
Works great but for some reason all-of-a-sudden I keep getting the following error anytime I attempt to add items to a tokens inventory

Error executing getProperty: there is no impersonated token.

now i have tried to impersonate token but it comes up with same error...
RPGA#: 5223824963
Recruiting: World's Largest Dungeon
Camapign Session Summary Page
In Development: World of Deiradh
SkypeID:quikdagger
LFR Character:Malcrere Krylon (Human Pursuing Avenger 1)

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Universal Inventory System (API)

Post by aliasmask »

Check the macro checkbox settings. Maybe apply to selected tokens is not checked?

User avatar
quikdagger
Giant
Posts: 128
Joined: Tue Jul 27, 2010 10:15 am
Location: Indianapolis, IN
Contact:

Re: Universal Inventory System (API)

Post by quikdagger »

aliasmask wrote:Check the macro checkbox settings. Maybe apply to selected tokens is not checked?
worked thanks
RPGA#: 5223824963
Recruiting: World's Largest Dungeon
Camapign Session Summary Page
In Development: World of Deiradh
SkypeID:quikdagger
LFR Character:Malcrere Krylon (Human Pursuing Avenger 1)

User avatar
Sir Flak
Dragon
Posts: 344
Joined: Thu Sep 28, 2006 4:20 pm
Location: Oklahoma, US

Re: Universal Inventory System (API)

Post by Sir Flak »

A while has passed since this library was originally created. Since then many new features have come out and we have new insight into ways to optimize macros.

I'm reworking this library's data structure. Converting it from using giant nested jsons to use hidden properties holding individual jsons (or at least much smaller ones). It works similar to rumble's d&d v5 equipment data structures. I'm attempting to make it backward compatible, and use all the same function names to get the same data. Behind the scenes it will just use alot more variables.

Here are some average times (ms) the various functions take to perform in the new version versus the old.

Code: Select all

Function                            New     Old
Get Item Types                  3.3      23.9
Get Properties of Type        3.3      25.2
Get IDs of Type                  4.2      N/A
Get Item                           3.2     119.4
Get Items of Type              75.1    51.2
Get Items of Type Length   4.4      57.1
Get Items Length               5.1      N/A
Get List of Items For Type 4.5    260.4
Most of the functions operate 10 times faster in with the new structures. I'll post it when I finish.

Telarus
Giant
Posts: 129
Joined: Sat May 22, 2010 11:16 pm

Re: Universal Inventory System (API)

Post by Telarus »

Nice! My first pass at my Earthdawn Framework ran into this exact problem, but I've been reading up on UDFs and storing lists and arrays in hidden properties instead of nested JSONs in defined properties. Definitely seems the way to go, and it's good to see you getting hard numbers.

Looking forward to seeing the new API.

User avatar
Sir Flak
Dragon
Posts: 344
Joined: Thu Sep 28, 2006 4:20 pm
Location: Oklahoma, US

Re: Universal Inventory System (API)

Post by Sir Flak »

I pretty much got my new property based version of this working. Theres a couple clunky things that I should fix before public consumption.

I'm actually using the new version of this in my new aces & eights framework. I used it for alot of things not just inventory. For instance I'm trackings skills and such as well. I just gave them a different location name so they wouldn't interfere with each other.

Works pretty good. I'm happy with the higher speeds I'm getting. My character sheets are much faster than my other framework using the old version of this library.

Post Reply

Return to “Drop-In Macro Resources”