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

API for handling player cash - stores - etc.

1586071637

Edited 1586073859
Hey all!  I have been trying out CashMaster (v 0.9.1 - after I found out that v 0.10.0 is no longer working) but it keeps degrading on me and buttons will eventually appear with text next to them and no longer work.... Are there any other D&D roll20 sheet compatible API's that handle this sort of thing? Ive done a little bit of digging and found another one (pursestrings) but it would almost instantly disable after attempting any commands... I would love this functionality in my games and I hope there is another solution out there!
I only know about Cashmaster and Pursestrings so can't help you there. I don't think there are any other money handling scripts. Me, I use Cashmaster 0.9.1 currently using my own setup for shops and trade and it works fine for me. 
I keep having a very off problem with 0.9.1 - it was running fine for a while but then after adding over 5 items to a shop the buttons started degrading. The API text for the button would appear next to it causing it to become unclickable. No amount of removing and re-adding the script would fix the issue.  
1586101564
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Screen shots might be helpful. I have been running Pursestrings with the D&D 5th Edition by Roll20 sheet with no issue. What sheet are you using?
1586110034

Edited 1586110075
I re-uploaded purse strings and it seems to be working fine now... I'm not really sure what happened last night. I will update this with a picture/more details if it happens again. @keithcurtis, while ive got an API god here, how do you set up your pursestrings merchants with gold so the players can "sell" an item too them? Do they have to be listed with a full character sheet, not just an NPC? Also any other tips on using pursestrings? It seems much simpler that cashmaster but I'm sure youve got some tricks up your sleeve for it! 
1586113217

Edited 1586118635
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
First off, I am anything but an API god. :D I have one published script that took me forever to hack my way through. I use  a lot of scripts, though. One of the reason I used PurseStrings instead of CashMaster was that the stores were set up on the tokens GM notes, instead of a character. Tokens take up little to no overhead, while character bloat can kill performance. I have found that once I set up stores though, I never actually used them. It's a good idea, but it just doesn't suit my play style. I mostly use PS for assigning and divvying loot. I have a macro that uses PS and ChatSetAttr (and for one command, Universal Chat Menus). I can use it to assign or divvy coins, or write any specific item to a character sheet's treasure field. It can also report the treasure or coins of a selected character. /w gm &{template:npcaction} {{rname=Purse Strings}} {{description=[Help](!ps --help) | [Config](!ps --config) [Set Up Token](!ps --setup) | [Set Party](!ps --party --reset) **Party** [Split Award](~PS-Distribute) [Award Same Amount to All](~PS-Distribute) **Selected Players** [Give Money](~PS-Add) [Take Money](~PS-Subtract) [Give Item](~Give-Treasure) **Report** [Cash](!ps --show --whisper) [Treasure Items](~Report-Treasure) *Single token* [Equipment List](~Equipment)  *Single token* }} This chat menu calls up a number of other commands on my  Macro Character Sheet . I deeply dislike the rigmarole of escaping queries in roll templates, so I make my macros modular. It also allows me to use the sub macros in other menus. For instance, the equipment reporter I use as part of other macros that make character reports. Here are the ones it calls: PS-Distribute !ps --dist ?{Distribute amount between selected characters, separated by spaces|100gp} PS-Add !ps --add ?{Add amount to selected characters, separated by spaces|100gp} PS-Subtract !ps --subt ?{Subtract amount from selected characters, separated by spaces|100gp} Give-Treasure (appends the entered item to the treasure field of a selected token on its own line) !setattr --sel --replace --treasure|%treasure% \n ?{enter the treasure to give to character of selected token|object} Potioner (Not listed here as it would require its own entry, i use a complex macro with discounts and other stuff. I have removed it from the code, though it still shows on the screen shot.) Report-Treasure /w gm &{template:npcaction} {{rname=@{selected|character_name}}} {{name=Treasure Report}}{{description=@{selected|treasure}}} Equipment (This one requires the Universal Chat Menu API, by GiGs) !chatmenu @{selected|character_id} {template:npcaction}{{rname=@{selected|character_name}}}{{name=Weight total @{selected|weighttotal} lbs. Encumbrance = @{selected|encumberance}}}{{description=CHATMENU}} --separator: |    --title:Equipment --repeating_inventory|itemname|itemcontent!
How would I add that first awesome chat button macro to my game? I attempted a simple copy/paste but when selecting it states "cannot red properly 'substring' of undefined. Do I need to replace or add too  the (~PS___) portion. Something like @{selected|character_id} etc. ?
Ok so if I copy paste what you have written it automatically calls the first macro in the line of "selected players". does the ~ represent calling another macro from the macro list? sorry for all the questions still week 1 using all this and really diving in head first lol. 
1586118572

Edited 1586118653
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That first chat button needs to be saved as an action on a  Macro Character Sheet , and all of the other macros need to also be on the same sheet. The first on calls all the others, and expects everything to be written as Actions on the same sheet. That's seven actions in total. I have removed the Potion section since it's very campaign-specific. It's in the screen shot, but I took it out of the code. You will also need to have the following API scripts installed: PurseStrings ChatSetAttr Universal Chat Menus The first two are available through One Click install, the other one is linked.
I gottchyah now THANK YOU SO MUCH!!! Im going to have to play round with all of this a good deal but this is really cool and really cleans everything up. 
Keith! if youre still reading this...... how do I get the buttons in the chat to be as clean as yours? Mine currently show up as big red/ping buttons with white text rather than your much cleaner simple text (no "buttons")? 
1586121514
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
My favorite style: Inline Links on OGL Roll Templates Installation instructions in top post. There's LOTS more goodness in these threads: Show Off Your Style , and Show Off Your Style 2: The Stylening!
I am trying to use the trick you just showed me to create chat buttons for my players attacks so that they are not individually listed as token actions.  This is what I have so far /w @{selected|token_name} &{template:npcaction} {{rname=Melee Attacks}} {{description=[Quarterstaff 1-Handed](~Quarterstaff-1H)}} with ~Quarterstaff-1H being a macro in the same sheet calling %{selected|repeating_attack_$0_attack} I get the window to pop up in chat but when pressed It reads back " TypeError: Cannot read property 'substring' of undefined" I am assuming there is something wrong with calling the general %{selected|repeating but I do now really know how to work around this. 
1586125189
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That approach is working for me: Chat Menu: /w @{selected|token_name} &{template:npcaction} {{rname=Melee Attacks}} {{description=[Quarterstaff 1-Handed](~AttackOne)}} AttackOne %{selected|repeating_attack_$0_attack} Make sure you have the token selected while running it, but that would have called up a different error. Copy and paste the exact text in the format shown above (use the code style in the magic wand dropdown of the text editor.) It may be a syntactical error.
1586129437

Edited 1586129519
Still not working after copy and pasting your code, when hitting the up arrow it is showing that it is calling %{AttackOne} but still showing the same error code....  Are there any API's that may be interfering with this? I have: Tokenmod, OGL companion, char sheet utils, HTML Builder, vectormath, matrixmath, pathmath, token collisions, itsatrap, chatsetattr, roll20am, itsatrap 5e, groupcheck, combat master, groupinint, torch, drunk, pursestrings, tokennamenumber, universal chat macro.
Welp, tested it on another character and it seems to work just fine for them.... there may be something wrong with that specific charactersheet. Can they become corrupted somehow? I wish I had tested it on multiple characters first, sorry about that!  I may just end up rebuilding that character for my player....
1586133633
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
My guess is that it's something annoying, like a space somewhere that you can't see.
I’ll try a couple more times and if I can’t get it I’ll spend the 15 min to rebuild the character lol. May I ask what other helpful tricks you have in terms of macros/APIs? Or the APIs you find you use most? You are truly a god in my opinion Mr. Curtis!!! 
1586140228
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Probably the best answer to that is to just read through the  Stupid Tricks  thread. That's why I created it. :D There's a lot of macro tricks with and without API in there. Also check out the links to other threads at the end of the index in the top post.