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 .
×
May your rolls be chill this holiday season!
Create a free account

Assistance with PurseStrings API

Hello everyone, I am currently DM'ing a 5e D&D game using the D&D Character Sheet by Roll20. I am attempting to use the PurseStrings API to allow my players to buy/sell items at their leisure. I have read the PurseStrings README.md text file and I see that the --invlist command is a GM only command, thus I am able to populate my merchant's template in the chat and my PC's are able to interact with it accordingly with the appropriate update to their Purchased items in their treasure box. However, I am interested in allowing my players to interact with merchant's independently by selecting the Merchant Token and running the --invlist command via a token action. Unfortunately it seems as if this is not an option. There is no display in the chat box if my player presses a token Macro set up to run --invlist, and I was curious if anyone has a workaround or knows of a solution that I am unaware of. As the GM I can run --invlist at their request, which is really nice and is how I am running things presently, but my idea was to drop my players in an area allowing them to engage with NPC's with minimal GM input allowing me to focus on individual PC's during downtime without making everyone else in the party sit on their hands while I go through dialog/discuss individual PC development. I have reviewed several threads and have not found any solution to this issue. Basically, my question is this: is PurseStrings universally dependent on the GM running the --invlist function or is there a way for my players to perform this task independently? Any advice would be fantastic. Thank you!
1658326130
The Aaron
Roll20 Production Team
API Scripter
give, buy, show, convert. and help are all executable by the player.  I've never used this script before, but I can tell that much from the code.  You could probably modify it so that players can run --invlist, you just need to remove " if ( playerIsGM ( msg . playerid ) ) " from line 85.  I don't know what that gives the players access to, so it might be a bit of security through obscurity...
I love this plugin.  When going to town, I will set up 2 or 3 shops with inventory and click on them to show in the chat window for the players.  In the chat window, the characters click on the items and buy what they want.  This automatically deducts the money from their sheets and adds the item to a list on their sheet.  I especially like to sell things without inventory like ale and food as those things just take money from the characters without adding anything back to their sheets :)  I have also found that creating artificial scarcity for goods makes players spend ridiculous amounts of money for trivial things.  Oh, I am sorry, we only have 1 packet of the finest pipe weed for 10gp each, but we have 8 packets of this other type for 2sp each :)  My favorite feature is the treasure distribution function.  !ps --dist  It splits up any coins you want to distribute and moves them to the characters sheets automatically.   I usually use it like !ps --dist ?{Group Treasure|0:0:0:0:0} so it pops up and prompts me for how many of which types of coins I want to distribute.  This saves SOOO much math time at the table :)  I tested what you want to do in my campaign, and no, I cannot get the --invlist function to run as a non-GM.  I changed my merchant sheet to be edited & controlled by all players, and all of the other macros I have on that character work except the --invlist function.  (I have added multiple macros to my Merchant token that do useful things when we are buying and selling things.)  I have to push the button as the admin for the characters to interact with it in the chat window. 
I personnaly have an issue with the Dist command that crashes my sandbox directly... I don't know what i do wrong on that command but it doesn't seem to work for me.... I'm still trying to go round all the functions...
Hi all, just a note as i found out what my issue was. If a character has a blank box in some currencies, then the script crashes. So if you want everything to work as intended, all currencies should at least contain a 0 value instead of a blank box, because the script is looking for some attributes that don't exist and crashes. I sent a message to BEN L. (creator of the script) to let him know and maybe correct this if he wants to.