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] PurseStrings - Manage currency and more

1567531683

Edited 1569534025
I've avoided posting this script for a while now, but I figured now is the time to share. I originally wrote this script to give an easy way for my players to use and collect money. It allows players to collect coins from loot, exchange money, and more. You can add the PCs to a Party Members list and automatically distribute loot money evenly amongst the Members. I have also added a rather simple yet robust inventory system to create merchant NPCs. Merchants have an inventory that can be shared with players in chat. Characters can click an item in a merchant's inventory to buy it, and they can sell items to merchants as well. This script is for use with the 5th Edition OGL sheet, and the 5e Shaped Sheet with the default SRD currency system.&nbsp; Enjoy! <a href="https://github.com/blawson69/PurseStrings" rel="nofollow">https://github.com/blawson69/PurseStrings</a>
Currently using this myself, a great alternative to CashMaster seeing as it's not readily available for the Shaped sheet.
Hmm. Curious about this since my cash master is currently busted. I'll give it a try.
Update: I just posted an update for GMs using characters as merchants (instead of having multiple tokens using the same character). You now have a command to update the default token on the character after inventory changes so you can maintain those changes after removing the token from the VTT.
Update: PurseStrings is now compatible with the 5th Edition OGL Sheet. I know no one was asking for it, but still... Also, I changed the characters as merchants settings so that inventory is automatically updated if the name on the token is the same as the character name. Should speed up game play and/or alleviate some headaches.
Ben L. said: Update: PurseStrings is now compatible with the 5th Edition OGL Sheet. I know no one was asking for it, but still... Also, I changed the characters as merchants settings so that inventory is automatically updated if the name on the token is the same as the character name. Should speed up game play and/or alleviate some headaches. Are you kidding? I'm delighted by OGL compatibility, since Cash Master is giving so much trouble. Will check this script out pronto. Thank you!
1569590755
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That's great Ben. I prefer your implementation of merchants to Cashmaster's. I'm going to rewrite some macros this weekend...
1569605398

Edited 1569606586
keithcurtis said: That's great Ben. I prefer your implementation of merchants to Cashmaster's. I'm going to rewrite some macros this weekend... And you'll appreciate that I have made the merchants tokens instead of characters. You can have multiple merchant tokens using the same character for a money pool. ;)
1569607352
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Ben L. said: keithcurtis said: That's great Ben. I prefer your implementation of merchants to Cashmaster's. I'm going to rewrite some macros this weekend... And you'll appreciate that I have made the merchants tokens instead of characters. You can have multiple merchant tokens using the same character for a money pool. ;) That is exactly the feature I was talking about. :) I can set up a whole market square with very little overhead.
Awesome just started converting to use this script, is there a way to have a player version of the subtract feature? I wanna give my players the ability to just type in the amount of money they spent and have it take it off their sheet.
The buy command built into the merchant inventory screen does that for them when they buy from a merchant. Are they spending money in away that cannot be supported by the merchant system? Anthony V. said: Awesome just started converting to use this script, is there a way to have a player version of the subtract feature? I wanna give my players the ability to just type in the amount of money they spent and have it take it off their sheet.
1569618465

Edited 1569618577
Ben L. said: The buy command built into the merchant inventory screen does that for them when they buy from a merchant. Are they spending money in away that cannot be supported by the merchant system? Anthony V. said: Awesome just started converting to use this script, is there a way to have a player version of the subtract feature? I wanna give my players the ability to just type in the amount of money they spent and have it take it off their sheet. Idk the Merchant thing seems a little confusing, what macro would I use to find buyer ID's, etc? Can I just use Selected or targeted? Edit: can any of you guys post some sample macros that you have to show Inventory's and sell items.
1569618644
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
It seems like a merchant could also be set up to act as a banker for the party. Lots of possibilities.
So I am using this macro !ps --invlist @{selected|token_id} and in the token's GM Notes I have Pursestrings Menu Armor Breastplate|20gp| Half-Plate|500gp| Weapons However when I use the macro it says the token has no inventory.
1569620510
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Capitalization? Docs say: "PurseStrings", not "Pursestrings"
keithcurtis said: Capitalization? Docs say: "PurseStrings", not "Pursestrings" Hmm that worked it now shows in chat but it's just a blank chat message :(
Anthony V. said: Ben L. said: The buy command built into the merchant inventory screen does that for them when they buy from a merchant. Are they spending money in away that cannot be supported by the merchant system? Anthony V. said: Awesome just started converting to use this script, is there a way to have a player version of the subtract feature? I wanna give my players the ability to just type in the amount of money they spent and have it take it off their sheet. Idk the Merchant thing seems a little confusing, what macro would I use to find buyer ID's, etc? Can I just use Selected or targeted? Edit: can any of you guys post some sample macros that you have to show Inventory's and sell items. Here is the macro I added as a token action on the character I'm using for my merchants: !ps --invlist @{selected|token_id} That will work for all of them. I can post some more examples of merchant inventories I've been using, too.
Here is a menu I recently used for a small diner at an inn: PurseStrings Menu Drinks Mug of Ale|6cp| Pitcher of Ale|4sp| Bottle of Wine|2gp| Food Hearty Meal|2gp| Loaf of Bread|4sp| Hunk of Cheese|2gp|
Here's an inventory for an alchemist I had in my last game: PurseStrings Inventory Potions &amp; Things Philter of Love|100gp|1 Potion of Healing|100gp|0 Potion of Greater Healing|300gp|3 Potion of Climbing|300gp|1 Potion of Water Breathing|300gp|1 Potion of Heroism|300gp|3 Alchemist's Fire|80gp|2 Acid|50gp|4 Antitoxin|140gp|2 Oil|5gp|0 Extras Empty Vial|2gp|10 Glass Bottle|5gp|7 Component Pouch|50gp|3 Healer's Kit|15gp|2
Anthony V. said: keithcurtis said: Capitalization? Docs say: "PurseStrings", not "Pursestrings" Hmm that worked it now shows in chat but it's just a blank chat message :( You can always invite me to your game a make me GM so I can take a look. It's probably something simple. ;)
1569638179
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I'm getting the same behavior, but only on OGL. Shaped seems to be working.
1569638730
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I have discovered that Roll20 makes the text formatting very picky. When copying the sample shop inventory, I need to run it through a plain text editor, otherwise, I get error messages: Inventory Error Merchant has no inventory! But that's most likely Roll20's quirky text handling.
I just pushed a fix to the inventory display. It should be working for both of you now. As for the cutting and pasting of the inventory, yes it is 100% Roll20's fault. ;) If you paste it into a plain text editor as keithcurtis suggested, it will work. That's how I store all of my various merchant inventories.
1569645989
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Thanks Ben! I'll give it a whirl.
Ben L. said: Update: PurseStrings is now compatible with the 5th Edition OGL Sheet. I know no one was asking for it, but still... Also, I changed the characters as merchants settings so that inventory is automatically updated if the name on the token is the same as the character name. Should speed up game play and/or alleviate some headaches. Woot! Thanks Ben! I will give it a try. Cashmaster have been wonky lately and this script sounds just about right.
I am still having issues, I will invite you Ben if you have some free time to take a look at it.
I get the no inventory error whenever I try to paste something in. (OGL)&nbsp;
1569683820

Edited 1569684362
Ravenknight said: I get the no inventory error whenever I try to paste something in. (OGL)&nbsp; Yes same. That was my issue I figured out. Tried copying and pasting from google docs but that didn't work either.
1569686729

Edited 1569688680
Anthony V. said: Ravenknight said: I get the no inventory error whenever I try to paste something in. (OGL)&nbsp; Yes same. That was my issue I figured out. Tried copying and pasting from google docs but that didn't work either. It's the way with Roll20's Notes fields. If you cut-and-paste, it must be from a text editor. Not Goggle Docs or any other word processor. Notepad++ is what I use, but your computer's built-in text editor (Notepad, TextEdit, etc.) I guess I'll need to add a note to this point in the readme file...
1569687421

Edited 1569688216
Ravenknight
KS Backer
Ben L. said: Anthony V. said: Ravenknight said: I get the no inventory error whenever I try to paste something in. (OGL)&nbsp; Yes same. That was my issue I figured out. Tried copying and pasting from google docs but that didn't work either. It's the way with Roll20's Notes fields. If you cut-and-paste, it must be from a text editor. Not Goggle Docs or any other document editor. Notepad++ is what I use, but your computer's built-in text editor (Notepad, TextEdit, etc.) I guess I'll need to add a note to this point in the readme file... Hi Ben, I still get the error while using Notepad sadly. Edit: It works when writing it directly in Roll20 though. But not everytime. I guess the note-functions really are broken. :/
Ravenknight said: Ben L. said: Anthony V. said: Ravenknight said: I get the no inventory error whenever I try to paste something in. (OGL)&nbsp; Yes same. That was my issue I figured out. Tried copying and pasting from google docs but that didn't work either. It's the way with Roll20's Notes fields. If you cut-and-paste, it must be from a text editor. Not Goggle Docs or any other document editor. Notepad++ is what I use, but your computer's built-in text editor (Notepad, TextEdit, etc.) I guess I'll need to add a note to this point in the readme file... Hi Ben, I still get the error while using Notepad sadly. Edit: It works when writing it directly in Roll20 though. But not everytime. I guess the note-functions really are broken. :/ I just did a test where I cut from the readme on Github and pasted into Notepad++ then cut and paste into the GM Notes and it worked like a charm. What did it look like when it didn't work correctly? P.S. Make sure you have the update from last night (v5.3.1).
1569690922
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
When you paste, Ctrl- Shift -V to paste without formatting. It shouldn't be necessary when pasting from a text editor, but every step can help. Also, if you've done a lot of testing, try a fresh token to ensure you don't have any lingering formatting.
keithcurtis said: When you paste, Ctrl- Shift -V to paste without formatting. It shouldn't be necessary when pasting from a text editor, but every step can help. Also, if you've done a lot of testing, try a fresh token to ensure you don't have any lingering formatting. Tried to do that command with a fresh token from Notepad and am still getting the no inventory error. It seems like writing in the notes is the only way I can get it to work. I know this is more of a roll20 issue than script but just thought I'd share.
Anthony V. said: keithcurtis said: When you paste, Ctrl- Shift -V to paste without formatting. It shouldn't be necessary when pasting from a text editor, but every step can help. Also, if you've done a lot of testing, try a fresh token to ensure you don't have any lingering formatting. Tried to do that command with a fresh token from Notepad and am still getting the no inventory error. It seems like writing in the notes is the only way I can get it to work. I know this is more of a roll20 issue than script but just thought I'd share. Same for me. However, the script works great when I avoid pasting. And I LOVE it! Fantastic work, Ben. The shops and services are far easier to manage then my old setup. My only issue is that I would like for the players to check out shop-inventory on their own, hopefully in a whisper, instead of requiring the GM to use the Invlist macro. But that is nitpicking.
Ben L. said: I just did a test where I cut from the readme on Github and pasted into Notepad++ then cut and paste into the GM Notes and it worked like a charm. What did it look like when it didn't work correctly? P.S. Make sure you have the update from last night (v5.3.1).
1569702364
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Why double returns?
Ben L. said: Ravenknight said: Ben L. said: Anthony V. said: Ravenknight said: I get the no inventory error whenever I try to paste something in. (OGL)&nbsp; Yes same. That was my issue I figured out. Tried copying and pasting from google docs but that didn't work either. It's the way with Roll20's Notes fields. If you cut-and-paste, it must be from a text editor. Not Goggle Docs or any other document editor. Notepad++ is what I use, but your computer's built-in text editor (Notepad, TextEdit, etc.) I guess I'll need to add a note to this point in the readme file... Hi Ben, I still get the error while using Notepad sadly. Edit: It works when writing it directly in Roll20 though. But not everytime. I guess the note-functions really are broken. :/ I just did a test where I cut from the readme on Github and pasted into Notepad++ then cut and paste into the GM Notes and it worked like a charm. What did it look like when it didn't work correctly? P.S. Make sure you have the update from last night (v5.3.1). Tried to recreate that on my end and couldn't get it to work.&nbsp; Are you on windows or mac just curious? (Windows Here)
Ravenknight said: Ben L. said: I just did a test where I cut from the readme on Github and pasted into Notepad++ then cut and paste into the GM Notes and it worked like a charm. What did it look like when it didn't work correctly? P.S. Make sure you have the update from last night (v5.3.1). Change your text version to single returns and it should work fine.
Anthony V. said: Ben L. said: Ravenknight said: Ben L. said: Anthony V. said: Ravenknight said: I get the no inventory error whenever I try to paste something in. (OGL)&nbsp; Yes same. That was my issue I figured out. Tried copying and pasting from google docs but that didn't work either. It's the way with Roll20's Notes fields. If you cut-and-paste, it must be from a text editor. Not Goggle Docs or any other document editor. Notepad++ is what I use, but your computer's built-in text editor (Notepad, TextEdit, etc.) I guess I'll need to add a note to this point in the readme file... Hi Ben, I still get the error while using Notepad sadly. Edit: It works when writing it directly in Roll20 though. But not everytime. I guess the note-functions really are broken. :/ I just did a test where I cut from the readme on Github and pasted into Notepad++ then cut and paste into the GM Notes and it worked like a charm. What did it look like when it didn't work correctly? P.S. Make sure you have the update from last night (v5.3.1). Tried to recreate that on my end and couldn't get it to work.&nbsp; Are you on windows or mac just curious? (Windows Here) I'm on Windows too, but if you're using a text editor it shouldn't make a difference. Theoretically at least.
Ravenknight said: Anthony V. said: keithcurtis said: When you paste, Ctrl- Shift -V to paste without formatting. It shouldn't be necessary when pasting from a text editor, but every step can help. Also, if you've done a lot of testing, try a fresh token to ensure you don't have any lingering formatting. Tried to do that command with a fresh token from Notepad and am still getting the no inventory error. It seems like writing in the notes is the only way I can get it to work. I know this is more of a roll20 issue than script but just thought I'd share. Same for me. However, the script works great when I avoid pasting. And I LOVE it! Fantastic work, Ben. The shops and services are far easier to manage then my old setup. My only issue is that I would like for the players to check out shop-inventory on their own, hopefully in a whisper, instead of requiring the GM to use the Invlist macro. But that is nitpicking. That's definitely something I could look at. It wouldn't be difficult. For the next update, I'm thinking of adding a currency exchange function so players can convert their millions of coppers into a few gold, etc.I could throw that one in as well. :)
1569705567

Edited 1569705671
Here's mine and it does not work single spaced, copied from with github. Edit: Not a big deal, still a huge a fan of the script and will use it either way.
1569707603
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Having much fun with this. There's all kinds of things you can do. For instance, I have a city map filled with&nbsp; Map Pins . Each map pin describes the establishment, but this uses up GM notes field. If I place the merchant somewhere else (even on a master page full of merchant tokens), I can put the token id for the merchant into bar 1 of the map pin. Then when the pin is selected, I can either run my normal info macro, or an inventory macro: !ps --invlist @{selected|bar1} That calls up the corresponding merchant. This would allow me to for instance take each tavern on the map and assign it a high-, medium- or low-fare menu, just by putting the token id for that merchant token into bar1. Further, if I want to have the option to whisper an inventory, I can put "--whisper" into bar2 and run this: !ps --invlist @{selected|bar1}&nbsp;@{selected|bar2} If I leave bar2 blank, the inventory is sent normally.
For everyone having problems with cutting and pasting into the GM Notes of your token, I have found that if you pasted from a word processor or the web and saved it (causing problems, of course) you have to delete all of the contents and save again before pasting from a text editor. The Notes field will retain the unwanted formatting even after you delete unless you save a blank Notes field first.
1569714931

Edited 1569715283
Ben L. said: For everyone having problems with cutting and pasting into the GM Notes of your token, I have found that if you pasted from a word processor or the web and saved it (causing problems, of course) you have to delete all of the contents and save again before pasting from a text editor. The Notes field will retain the unwanted formatting even after you delete unless you save a blank Notes field first. Sorry it's still not working for me but its okay man don't stress it, might just be something on my end.
1569718507
GiGs
Pro
Sheet Author
API Scripter
There should be a way to sanitise the input to avoid this problem. Using a regex or string replace to discard all character but valid ones should handle most issues.
GiGs said: There should be a way to sanitise the input to avoid this problem. Using a regex or string replace to discard all character but valid ones should handle most issues. There is some sanitizing being done, but it was originally written for info being written directly into the field. I'm working on a more robust version of it now.
Anthony V. said: Ben L. said: For everyone having problems with cutting and pasting into the GM Notes of your token, I have found that if you pasted from a word processor or the web and saved it (causing problems, of course) you have to delete all of the contents and save again before pasting from a text editor. The Notes field will retain the unwanted formatting even after you delete unless you save a blank Notes field first. Sorry it's still not working for me but its okay man don't stress it, might just be something on my end. +1 The script works fine, this is just an annoyance.
I just pushed an update that more aggressively processes the GM Notes to remove HTML formatting. Give it a try and let me know if it solves your issues.
1569778882
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Thanks Ben! Here's the inevitable feature creep request: For goods (not services), would it be possible to have the name of the item purchased added to the equipment line of the buyer? I know for things that have compendium drop interaction, this is not possible to reproduce. I.e. a sword added will not add an attack. But it would be nice to buy rations or rope and have them added. Perhaps a query ("Add item to Equipment? Y/N")? I had considered using a combination of Customizable Roll Listener and ChatSetAttr to do this, but that approach sounds rather wonky and prone to error.
Ben L. said: I just pushed an update that more aggressively processes the GM Notes to remove HTML formatting. Give it a try and let me know if it solves your issues. Hi Ben, then copy/paste seems to work better but now I get a wierd API error whenever I try to buy stuff.
keithcurtis said: Thanks Ben! Here's the inevitable feature creep request: For goods (not services), would it be possible to have the name of the item purchased added to the equipment line of the buyer? I know for things that have compendium drop interaction, this is not possible to reproduce. I.e. a sword added will not add an attack. But it would be nice to buy rations or rope and have them added. Perhaps a query ("Add item to Equipment? Y/N")? I had considered using a combination of Customizable Roll Listener and ChatSetAttr to do this, but that approach sounds rather wonky and prone to error. +1 that would be a great add on feature.