Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[Script] Item Store 5e

1664813225

Edited 1665403986
Julexar
Pro
API Scripter
Hello everyone, it is I again. As announced quite some time ago, I have been working on a major rework of my Magic Item Store Script and I have finally finished it. The main reason I am making a new thread is because the new version is so different from the old one that I felt discussion about it should be in a separate thread. If you experience any Issues with this Script, please let me know and I will try to fix it as soon as I can. IMPORTANT: This Script depends on ChatSetAttr and will NOT work without it. Features Standardized Commands Creation of multiple Stores Ability to add custom Items Ability to edit existing Items Activation/Deactivation of Stores Inflation/Deflation of Prices Ability to buy Items (automatically removes Gold and adds Items to the Character's Inventory) Shop Menu for Players Ability to Haggle prices And much, much more. GitHub Repository Commands GM ONLY !store - Pulls up the Menu and allows the GM to create and modify Stores     --reset - Resets all Stores.     --create --name {Insert Name} - Allows the GM to create a new Store.     --store {Insert existing Store Name} - Shows the GM all Information about a certain Store.                       --inv view/edit/generate/reset - Allows the GM to edit, generate or reset the Inventory of the selected Store or view a specific item.          Edit & View Only                           --item {Insert Item Name} - Select a specific Item that you wish to edit/view.          Edit Only                     --remove - Removes the selected Item.                    --add - Adds a new Item                         --name {Insert new Name} - Set the Name of an Item                         --desc {Insert new Description} - Set the Description of an Item (Check the  Wiki to see how a Description is structured)                         --mods {Insert new Modifiers} - Set the Modifiers of an Item. (Check the  Wiki to see how Modifiers work)                         --props {Insert new Properties} - Set the Properties of an Item. (E.g. Light, Heavy, Two-Handed, etc.)                         --price {Insert new Price} - Set the Price (GP) of an Item. (Must be 0 or above)                             --amount {Insert new Amount} - Set the Amount of Items you will receive upon buying (Must be at least 1 and a whole number - no fractions!)                     Generate Only                         --type {Insert Item Type} --minrare {Insert minimum Rarity} --maxrare {Insert maximum Rarity} - Generate a random Inventory based on Item Type and Rarity. For a list of available Types and Rarities, check the  Rarity List and the Type List                  --overwrite true/false - Select whether you wish you to Overwrite an already existing Inventory. (Put true if so, put false if not) Default: true General          --players - Add this Option if you want to show the selected Store to the Players.         --name {Insert new Name} - Changes the Name of the selected Store.         --hdc {Insert new Haggle DC} - Sets the Haggle DC for the selected Store. (Default: 10)         --inflate {Insert number from 0.1 to Infinity} - Set a Percentage of Inflation to increase prices.         --deflate {Insert number from 0.1 to Infinity} - Set a Percentage of Deflation to decrease prices.         --activate - Activates the selected Store and makes it available for Players.         --deactivate - Deactivates the selected Store and makes it visible to only the GM.         --delete - Deletes the selected Store. GM & Players !shop - Pulls up a Menu where all active Stores and Options are displayed      --cart {Insert Cart Number} - Select a Cart to use. (Optional)      --store {Insert existing Shop Name} - selects a certain Shop          --buy {Insert Item Name} - Pulls up the Purchasing menu             --amount {Insert amount} - increases the amount of Items you buy (Default: 1)         --haggle - Pulls up the Haggling menu             --amount - sets the amount you want to haggle for                 --{Insert Skill} - sets the skill used in haggling (Persuasion or Intimidation) !cart - Pulls up the Shopping Cart Menu.     --reset - Resets all Carts      --new - Creates a new Shopping Cart.      --{Insert Cart Name} - Shows you the content of the selected Cart.          --rem {Insert Item Name} - Removes an Item from your Cart. !checkout - Buys a specific item or all items in a Cart.      --cart {Insert Cart Name} - Purchase the Items in your Cart.      --store {Insert Store Name} --item {Insert Item Name} - Purchase a specific item
How can I install this?. I don't know how to use the .js file
I try the following code !store --store Potions --inv generate --type Potion --minrare common --maxrare rare and it crash my sandbox Also I try !store the menu for creating a store appear and I create a store but then When I use !store --store it said I have no stores
1664943717
Julexar
Pro
API Scripter
Thanks for the feedback, I'll look into it ASAP
1665403888
Julexar
Pro
API Scripter
Update v1.6 Fixed an issue where new Stores wouldn't be created Fixed an issue where the Inventory wouldn't be generated Added Reset commands GitHub Repository
Hey Julexar, great idea for a script! I just installed and started playing around with it, and ran into a crash when I changed the haggle DC from 10 to 15: Just wanted to pass it on!
1665407539

Edited 1665407590
Julexar
Pro
API Scripter
Curtis F. said: Hey Julexar, great idea for a script! I just installed and started playing around with it, and ran into a crash when I changed the haggle DC from 10 to 15: Just wanted to pass it on! Try with the newest version 1.6 - sadly not installable from the library yet but you can copy-paste the code from the GitHub Repo
1665583705

Edited 1665607854
hello, I am not able to get any response from the mod.  Do you have any initial tips that I might try?  I've deleted and re-installed the 1.6 mod, and ensured I don't have any previous versions hanging out.  When I try to create a new store, I get no output in the in-game chat, and nothing in the console window either. I am the creator and GM of the game I'm trying to use this script in. Thank you so much for your time and help! James Edited:  I was able to determine there was a conflict between this mod and one of the Meta Script mods.  After removing the Meta Script mods,  am able to use the !store command; however the mod crashes with the following details when I try to create a new store (either with the button or with the command syntax): For reference, the error message generated was: TypeError: state.store.push is not a function TypeError: state.store.push is not a function at createStore (apiscript.js:37384:21) at handleInput (apiscript.js:36681:29) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:168:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:168:1), <anonymous>:70:8) at /home/node/d20-api-server/api.js:1739:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425)
1665657374
Julexar
Pro
API Scripter
James S. said: hello, I am not able to get any response from the mod.  Do you have any initial tips that I might try?  I've deleted and re-installed the 1.6 mod, and ensured I don't have any previous versions hanging out.  When I try to create a new store, I get no output in the in-game chat, and nothing in the console window either. I am the creator and GM of the game I'm trying to use this script in. Thank you so much for your time and help! James Edited:  I was able to determine there was a conflict between this mod and one of the Meta Script mods.  After removing the Meta Script mods,  am able to use the !store command; however the mod crashes with the following details when I try to create a new store (either with the button or with the command syntax): For reference, the error message generated was: TypeError: state.store.push is not a function TypeError: state.store.push is not a function at createStore (apiscript.js:37384:21) at handleInput (apiscript.js:36681:29) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:168:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:168:1), <anonymous>:70:8) at /home/node/d20-api-server/api.js:1739:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) Hiya, thanks for your Reply. I will look into it and post an update when I fix the Issue.
1666357912
Julexar
Pro
API Scripter
Update v1.7 Fixed Issues where changing options wouldn't work or apply Fixed Issues where creating stores didn't work Fixed other minor issues GitHub Repository
1666362247
timmaugh
Pro
API Scripter
James S. said: Edited:  I was able to determine there was a conflict between this mod and one of the Meta Script mods.  After removing the Meta Script mods,  am able to use the !store command; however the mod crashes with the following details when I try to create a new store (either with the button or with the command syntax): For reference, the error message generated was: TypeError: state.store.push is not a function TypeError: state.store.push is not a function Can you share which metascript caused the conflict, and what the command line was you were trying? The above error is indicative that the store  property of the state had not been properly initialized as an array, which shouldn't have much to do with metascripts... or at least, should be work-around-able.
1666367521
Julexar
Pro
API Scripter
timmaugh said: James S. said: Edited:  I was able to determine there was a conflict between this mod and one of the Meta Script mods.  After removing the Meta Script mods,  am able to use the !store command; however the mod crashes with the following details when I try to create a new store (either with the button or with the command syntax): For reference, the error message generated was: TypeError: state.store.push is not a function TypeError: state.store.push is not a function Can you share which metascript caused the conflict, and what the command line was you were trying? The above error is indicative that the store  property of the state had not been properly initialized as an array, which shouldn't have much to do with metascripts... or at least, should be work-around-able. Yeah, I would like to know as well, as so far I haven't been able to reconstruct the error
timmaugh said: Can you share which metascript caused the conflict, and what the command line was you were trying? The above error is indicative that the store  property of the state had not been properly initialized as an array, which shouldn't have much to do with metascripts... or at least, should be work-around-able. Julexar said: Yeah, I would like to know as well, as so far I haven't been able to reconstruct the error Hello, sorry for the delay in getting back to you.  I'm not sure which one of the metascripts I had removed caused the "unresponsiveness issue" I reported, as I deleted all of the ones I had installed at the same time.  I believe the following are all the ones I had installed at the time: ZeroFrame, SelectManager, Fetch, Muler and Plugger.  They were all removed, one after the other, and I didn't think to stop and test in between each one.  But I think you may have misunderstood my edit comments,  I'm pretty sure the meta-scripts were causing the script to be completely unresponsive, but after removing them, I was subsequently able to then experience the crash which would suggest that it's (at least) one of the mods I still have, not one of the meta-ones deleted, or unrelated to any mods at all.  As I mentioned in my original post, the crash occurs when I try to create a new store either via the menu/gui, or by using the command directly.  To repro via menu/ gui: 1)  Type !store into the main chat and press enter 2)  See store list that says "Current Store:No existing Stores!" 3)  Click "Create new Store" button at the bottom of the list of (no) stores. 4)  In the "Input Value" window that pops up, enter new Store name of:  "TestStore01" and click Submit Crash occurs in this moment very consistently. To repro via chat commands: 1) Type !store --create --name TestStore01 into the main chat and press enter. Crash occurs in this moment very consistently. Current Scripts installed: ChatSetAttr, Status FX, DL Darkness, Vector Math, MatrixMath, Path Math, Door Knocker, ShareVision, Walls, Page FX, libInline, SmartAoE, World Map Discovery, D&D 5E - ShortRest, libTokenMarkers, TokenMod, splitArgs, HTML Builder, Areas of Effect, Bump, ChangeTokenImage, MapLock, MonsterHitDice, WildHelpers, D&D 5E - WildShape, Character Sheet Utils, EncounterHelper, Teleport, TokenNameNumber, mapSizer.js, GroupCheck, rumorMill.js, GroupInitiative, Token Collisions, KillCounter, It's a Trap!, RecursiveTable, It's a Trap! - D&D 5E Generic, emas, Item Store (Manual), Customizable Roll Listener, ScriptCards-Manual.js, Aura/Tint HealthColors, TurnMarker1, TableExport, InitMaster, MagicMaster I hope this helps you better test what might be causing the issue I'm experiencing.  Thank you very much for your help! -James
1666596695

Edited 1666596766
Julexar
Pro
API Scripter
James S. said: timmaugh said: Can you share which metascript caused the conflict, and what the command line was you were trying? The above error is indicative that the store  property of the state had not been properly initialized as an array, which shouldn't have much to do with metascripts... or at least, should be work-around-able. Julexar said: Yeah, I would like to know as well, as so far I haven't been able to reconstruct the error Hello, sorry for the delay in getting back to you.  I'm not sure which one of the metascripts I had removed caused the "unresponsiveness issue" I reported, as I deleted all of the ones I had installed at the same time.  I believe the following are all the ones I had installed at the time: ZeroFrame, SelectManager, Fetch, Muler and Plugger.  They were all removed, one after the other, and I didn't think to stop and test in between each one.  But I think you may have misunderstood my edit comments,  I'm pretty sure the meta-scripts were causing the script to be completely unresponsive, but after removing them, I was subsequently able to then experience the crash which would suggest that it's (at least) one of the mods I still have, not one of the meta-ones deleted, or unrelated to any mods at all.  As I mentioned in my original post, the crash occurs when I try to create a new store either via the menu/gui, or by using the command directly.  To repro via menu/ gui: 1)  Type !store into the main chat and press enter 2)  See store list that says "Current Store:No existing Stores!" 3)  Click "Create new Store" button at the bottom of the list of (no) stores. 4)  In the "Input Value" window that pops up, enter new Store name of:  "TestStore01" and click Submit Crash occurs in this moment very consistently. To repro via chat commands: 1) Type !store --create --name TestStore01 into the main chat and press enter. Crash occurs in this moment very consistently. Current Scripts installed: ChatSetAttr, Status FX, DL Darkness, Vector Math, MatrixMath, Path Math, Door Knocker, ShareVision, Walls, Page FX, libInline, SmartAoE, World Map Discovery, D&D 5E - ShortRest, libTokenMarkers, TokenMod, splitArgs, HTML Builder, Areas of Effect, Bump, ChangeTokenImage, MapLock, MonsterHitDice, WildHelpers, D&D 5E - WildShape, Character Sheet Utils, EncounterHelper, Teleport, TokenNameNumber, mapSizer.js, GroupCheck, rumorMill.js, GroupInitiative, Token Collisions, KillCounter, It's a Trap!, RecursiveTable, It's a Trap! - D&D 5E Generic, emas, Item Store (Manual), Customizable Roll Listener, ScriptCards-Manual.js, Aura/Tint HealthColors, TurnMarker1, TableExport, InitMaster, MagicMaster I hope this helps you better test what might be causing the issue I'm experiencing.  Thank you very much for your help! -James Hiya, thanks for the reply. I have installed all the Scripts that you mentioned (at least the ones I could find) but it seems to be working without problem when using the newest version 1.7 Please check the version you have currently installed. If it's version 1.5 or 1.6, then the Issue has been fixed by version 1.7 The Update in the Roll20 Mod Library is currently pending, so currently you need to install it manually by copy-pasting the code.
1666848094
Julexar
Pro
API Scripter
Quickfix Fixed an Issue where the Script wouldn't work GitHub Repository
1666937226
Julexar
Pro
API Scripter
Update v1.8 Fixed some issues when renaming stores Added a button to change store names GitHub Repository
You API sounds like something I've been needing.  However, I've tried to use your API but I must be doing something wrong  The Item Store GM Menu opens and I can create a store but from there I'm stymied.  I've tried using the Item Menu and Generate Inventory buttons and filled out the pop ups using the correct Rarity and Types as shown in your Wiki but that's where things stop. Here's a typical error message from the console.   In addition to making sure I used the correct  Type and Rarity spellings, I looked through the item names in the script to make sure that I wasn't misspelling the few that I was testing with. Any idea what I'm doing wrong?  
1667123814
Julexar
Pro
API Scripter
Stik said: You API sounds like something I've been needing.  However, I've tried to use your API but I must be doing something wrong  The Item Store GM Menu opens and I can create a store but from there I'm stymied.  I've tried using the Item Menu and Generate Inventory buttons and filled out the pop ups using the correct Rarity and Types as shown in your Wiki but that's where things stop. Here's a typical error message from the console.   In addition to making sure I used the correct  Type and Rarity spellings, I looked through the item names in the script to make sure that I wasn't misspelling the few that I was testing with. Any idea what I'm doing wrong?   What items were you trying to generate?
1667999347
Julexar
Pro
API Scripter
Update v1.9 Fixed issues where Items wouldn't be displayed Fixed issues where crashes would occur upon generating items Important: Editing Items is still quite buggy, I will be working on releasing a Fix ASAP GitHub Repository
1668367815
Pat
Pro
API Scripter
If I can throw in a recommendation... I've got a couple of scripts with editable user interfaces that use notes or in-chat displays or both to make editing objects a little easier. One of them is emojibubble , which allows you to add or remove emojis from a player-accessible interface via the GMnotes. 
1668422121
Julexar
Pro
API Scripter
Pat said: If I can throw in a recommendation... I've got a couple of scripts with editable user interfaces that use notes or in-chat displays or both to make editing objects a little easier. One of them is emojibubble , which allows you to add or remove emojis from a player-accessible interface via the GMnotes.  Do you have one that would make editing Items easier? xD
1669225177
Pat
Pro
API Scripter
Julexar said: Do you have one that would make editing Items easier? xD The thing is, either that one or the unpublished "color" one both have built interfaces for adding an item to a list - so if you have a place where you're storing the data for an individual instance (the color overlay and emojibubble create data elements and element entries), you can build a quick one or two or however many step instance to create a record. With emojibubble and color overlay, both have at least a two-step process, as each needs the creation of the value and the common name, so both of those have a multi-step process for creating an entry that could be extended to however many steps you need. This was partly because early on in the emojibubble script people expressed the need to add to or edit the list of player-available emojis. Emojibubble might be a good pattern, as it has add and delete capability through a GMnotes interface, meaning it's controllable by the GM through the same interface that's referenced by the players. If only map-notes were a thing! 
Is there any way you can give a step-by-step on how to create an inventory? Every time I try, I get the following error: Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your script's code and click the "Save Script" button. We will then attempt to start running the scripts again.  More info...  If this script was installed from the Mod Library, you might find help in the Community API Forum. For reference, the error message generated was:  TypeError: Cannot read property 'includes' of undefined TypeError: Cannot read property 'includes' of undefined at handleInput (apiscript.js:19430:88) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:168:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:168:1), <anonymous>:70:8) at /home/node/d20-api-server/api.js:1762:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:400
1674816104
Julexar
Pro
API Scripter
Dungeon Master said: Is there any way you can give a step-by-step on how to create an inventory? Every time I try, I get the following error: Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your script's code and click the "Save Script" button. We will then attempt to start running the scripts again.  More info...  If this script was installed from the Mod Library, you might find help in the Community API Forum. For reference, the error message generated was:  TypeError: Cannot read property 'includes' of undefined TypeError: Cannot read property 'includes' of undefined at handleInput (apiscript.js:19430:88) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:168:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:168:1), <anonymous>:70:8) at /home/node/d20-api-server/api.js:1762:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:400 Hiya, sorry I just saw your post - the new Item Store script (v1.5+) is currently broken and I am working on a fix. In the meantime, please use the old (v1.3) script as it should work without issues.
any update on this?
1676402479
Julexar
Pro
API Scripter
Novercalis said: any update on this? I am working on it