Difference between revisions of "Script:Backpack"
From Roll20 Wiki
(→Item Definitions) |
(→Item Definitions) |
||
Line 48: | Line 48: | ||
==== name ==== | ==== name ==== | ||
+ | The name parameter is '''essential''' to the item definition and must be unique for this item. Names of items are ''case insensitive'' and considered <u>first class citizens</u> along with [[Script:Backpack#enigma|enigma]] names. Names can contain any character including numbers but <b>cannot</b> start with a number else that number will be considered a [[Script:Backpack#quantity|quantity]] | ||
+ | |||
+ | If there are multiple items with the same name identifier the combined result of the receiving location will have its quantity increased even if the donating location's item definition is different in other areas from the receiving location's definition. | ||
+ | |||
+ | An example would be moving a 'flute' from <b>A</b> {{rarr}} <b>B</b> where say <b>A</b> has 5 flutes and <b>B</b> has 2 flutes. The difference between <b>A</b> and <b>B</b>'s flutes despite having the same name is that they have different descriptions or weights despite having the same primary identifier as 'flute'. If you move 1 flute <b>A</b> {{rarr}} <b>B</b> then <b>B</b> would have 3 flutes and <b>A</b> 4 as expected, but <b>B</b> will simply have it's quantity altered, as opposed to another 'flute' item being generated matching <b>A</b>'s flute definition. | ||
+ | |||
+ | A simple resolution to this to have the name be more descriptive such as 'Alfreds Flute' and 'Bernard's Flute'. Special care must be taken such that these names do not conflict with introduced [[Script:Backpack#enigma|enigma]] names | ||
==== type ==== | ==== type ==== | ||
==== subtype ==== | ==== subtype ==== |
Revision as of 01:58, 26 June 2015
API Script
Author: Ken L.
Version: 1.25
Last Modified: 2015-6-24
Code: NA
Dependencies: None
Conflicts: Unknown
Contents |
Backpack is a journal based inventory system that updates the 'bio' section of a journal to represent a graphic inventory interface. This allows GMs whom implement this script to allow players to manage a graphic representation of their inventory. Once setup, you can move, give, drop, and pickup items through the use of the API button interface as well as buy and sell from shops and stores should they be prepared.
To use this script requires quite a bit of setup on the part of the GM preparing the asset and item databases. The asset database is simply a list of available item types/subtypes and their associated images. The item database is a list of parsable item signatures which can be short hand written to loot drop handouts or any backpack compatible journal entry.
Getting Started
Once you load the backpack.js and backpack_tmp.js scripts into your campaign, you'll need to at least create an asset database.
After creating an asset database, you're ready to populate backpack compatible journal entries as inventories, stores, or loot cache drops.
General Use
TODO
Item Definitions
Item definitions are the format in which entries of items are parsed into the script. They consist of several parts.
[quantity] <name>;<type> [weight] [value] [description] [use] [maxcharge] [enigma]
Formally:[quantity]
name
type
[optionals]
[quantity]
name
type
subtype
[optionals]
name
→ Name of the item, see name
type
→ Existing type in backpack_tmp.js, see type
sybtype
→ Existing subtype defined in the asset database, see subtype
quantity
→ Optional quantity of the item, see quantity
weight
→ Optional weight of the item in lbs, see weight
value
→ Optional value of the item, see value
description
→ Optional description of the item, see description
use
→ Optional use argument to be executed, see use
maxcharge
→ Optional max charges of the item, see charges
enigma
→ Optional enigma arguments, see enigmas
name
The name parameter is essential to the item definition and must be unique for this item. Names of items are case insensitive and considered first class citizens along with enigma names. Names can contain any character including numbers but cannot start with a number else that number will be considered a quantity
If there are multiple items with the same name identifier the combined result of the receiving location will have its quantity increased even if the donating location's item definition is different in other areas from the receiving location's definition.
An example would be moving a 'flute' from A → B where say A has 5 flutes and B has 2 flutes. The difference between A and B's flutes despite having the same name is that they have different descriptions or weights despite having the same primary identifier as 'flute'. If you move 1 flute A → B then B would have 3 flutes and A 4 as expected, but B will simply have it's quantity altered, as opposed to another 'flute' item being generated matching A's flute definition.
A simple resolution to this to have the name be more descriptive such as 'Alfreds Flute' and 'Bernard's Flute'. Special care must be taken such that these names do not conflict with introduced enigma names
type
subtype
quantity
weight
value
description
use
charges
enigmas
Asset Database
The asset database is a journal entry that contains within its gmnotes section the library of images to be used for item definitions
The asset database has a simple format where each line is a single asset entry (blank lines between groups of entries are fine).
Each asset entry is in either of the following formats:
Type:Link
Type:Subtype:Link
Formally:
type
subtype
link
type
link
type
→ Existing type in backpack_tmp.js
sybtype
→ Anything except ε
link
→ HTML link to the image source, must start with 'http' case insensitive
Item Database
TODO
Customizing
TODO
Changelog
TODO