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

Purse Strings API - Trouble giving coin between players

Hi! I've been messing around with the Purse Strings API (<a href="https://github.com/blawson69/PurseStrings#--party" rel="nofollow">https://github.com/blawson69/PurseStrings#--party</a>)&nbsp; recently and it's absolutely fantastic.&nbsp; I have set up all player characters and added them up to a 'Party Members List'. I would love to create a macro to enable players to send coin between each other. Any help would be greatly appreciated. Using the give command with the example of 50gp, I have been unable to get this to work for me when inputting the token id. Is there any way I could turn this command into a macro with a drop down option to choose which 'Party Member' or 'taker' would receive the coin? &nbsp; !ps --give --giver|&lt;giver_id&gt; --taker|&lt;taker_id&gt; --amt|50gp&nbsp; Many thanks, Sam
1617284759

Edited 1617288213
David M.
Pro
API Scripter
Not familiar with the script, but does something like this work? Replace&nbsp;Char1/Char2 with current charNames !ps --give --giver|?{Giver?|Char1,@{Char1|character_id}|Char2,@{Char2|character_id}} --taker|?{Taker?|Char1,@{Char1|character_id}|Char2,@{Char2|character_id}} --amt|50gp
Hi David, Thanks for the reply! I input your suggestion substituting Char1/Char2 with current charNames (Ben and Keo Imanan)&nbsp; and came back with this as a response: Transaction Error The following errors were encountered: Buyer character was not found.
1617288295

Edited 1617288440
David M.
Pro
API Scripter
Do you get anything if you just type&nbsp;@{Ben|character_id} or @{Keo Imanan|character_id} directly into chat?
1617288765
David M.
Pro
API Scripter
I may have misread the documentation. You may need to use token_id in the api call instead? If that is the case, the dropdown selection won't be the best solution. You would have to hardcode the token_id values into your query, and the token_id will change every time you make a copy or re-drag a new version of the character token onto the map, which would break your macro. You use @{selected|token_id} and @{target|token_id} instead of making a query macro. !ps --give --giver|@{selected|token_id} --taker|@{target|Give money to|token_id} --amt|50gp
When I type into chat @{Ben|character_id} I get:&nbsp; -MPGGVbDwTjFZDhuKYTa When I type chat&nbsp; @{Keo Imanan|character_id} I get:&nbsp; -MPjx3TpdoUeJ3Fs9gG2 @{Ben| token_id } @{Keo Imanan| token_id } I get 'no attribute was found for..'
1617289116
The Aaron
Roll20 Production Team
API Scripter
token_id is a property of a token, not a character.&nbsp; You can only access it via @{target|token_id} or @{selected|token_id}.
Thanks Aaron for explaining the difference. David, the macro worked great. I would just like to be able to choose the amount to send to the other player, not just a static amount of 50gp. Any ideas? &nbsp; !ps --give --giver|@{selected|token_id} --taker|@{target|Give money to|token_id} --amt|50gp&nbsp;
1617290910
The Aaron
Roll20 Production Team
API Scripter
This will prompt for an amount and be filled in with 50gp by default: !ps --give --giver|@{selected|token_id} --taker|@{target|Give money to|token_id} --amt|?{Amount|50gp}
Thanks so much. Works just as intended.&nbsp;