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] CashMaster 5e - a simple script to manage a party's money.

1516977989
Kryx
Pro
Sheet Author
API Scripter
So my plan for the wording was to provide 2 options: wording and the route I suggest. Both can work in parallel. I'm still working through the specifics, but this is the route I suggest: Command Result Notes Equivalent !cm overview of selected characters !cm !cm 5gp add 5gp, split among all characters Distribute among party to make it even if smaller coins exist !cmhoard !cm -5gp subtract 5gp, split among the characters Pay in lesser coins if possible, otherwise get change back !cmpay !cm 5gp --each add 5gp to each character !cmadd !cm -5gp --each subtract 5gp from each character — Still unsure about the "each" name, but this way those who want specific words can use those and those that want simple simple can use that.  !cmshare and !cmconvert I don't understand the use case so I'd just leave them as is for those that want it.
Kryx said: So my plan for the wording was to provide 2 options: wording and the route I suggest. Both can work in parallel. I'm still working through the specifics, but this is the route I suggest: Command Result Notes Equivalent !cm overview of selected characters !cm !cm 5gp add 5gp, split among all characters Distribute among party to make it even if smaller coins exist !cmhoard !cm -5gp subtract 5gp, split among the characters Pay in lesser coins if possible, otherwise get change back !cmpay !cm 5gp --each add 5gp to each character !cmadd !cm -5gp --each subtract 5gp from each character — Still unsure about the "each" name, but this way those who want specific words can use those and those that want simple simple can use that.  !cmshare and !cmconvert I don't understand the use case so I'd just leave them as is for those that want it. I too like this suggestion 
1516979348

Edited 1516979374
Kryx
Pro
Sheet Author
API Scripter
Some of the notes will be a bit tricky. For example it's probably best to keep ~10-15 of each lower value coin on hand if possible, but get rid of the rest for higher value coins when possible due to weight.
In general, I like it. I still would like to keep the current behavior of cmhoard, as it's closer to what I expect what a party would do when they get some cash somewhere in a dungeon with the next enemy around the corner (grab the treasure, quickly split it up, even if it is not perfectly fair). They are adventurers, not bookkeepers, after all... And it could lead to some interesting roleplaying after the party came comes from an adventure (Halfling bard: "You grabbed one platinum more, mate. I think you should pay for all of us here for the night!" - Half orc fighter: "Nah, not doin' that! Bugga off!").. The original idea for cmshare/cmconvert is actually connected to that: Once back in safety, the party members go to a shopkeeper and exchange their coins to split the total cash evenly. But now I realise that not everyone is having a party of communists as I seem to have ;) (sorry for any typos - just broke my hand and have to type with the left right now...)
1516981468
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Instead of --each, would it be better to do it as |Character_Name_01|Character_Name_02|Character_Name_03... or something along those lines? That way, you could pay sub-groups instead of all pcs, in case not all pcs are present or you are running a large campaign with more than one group. I agree that the general command structure you suggest is far more intuitive and easier to use on the fly. A single macro with a drop down could handle most cases.
1516982189
Kryx
Pro
Sheet Author
API Scripter
Arthur B said: I still would like to keep the current behavior of cmhoard, as it's closer to what I expect what a party would do when they get some cash somewhere in a dungeon with the next enemy around the corner (grab the treasure, quickly split it up, even if it is not perfectly fair). They are adventurers, not bookkeepers, after all... The whole point of this app is to handle the bookkeeping. Uneven split will not even out in the end due to how the order is determined. You could try to randomize it and that'd make it better, but it's still insufficient. If you're going for realism they would likely grab the bag and distribute it later. Then you should add the value to a collection and distribute it later. Then an uneven split is acceptable, though it'd likely be quite minimal. I think that method is likely a better method anyways. Splitting each room would result in having to move around coins quite a bit. Arthur B said: it could lead to some interesting roleplaying after the party came comes from an adventure (Halfling bard: "You grabbed one platinum more, mate. I think you should pay for all of us here for the night!" - Half orc fighter: "Nah, not doin' that! Bugga off!").. The script effectively removes the roleplaying of splitting money - the primary purpose is to save time and effort, which is the roleplaying aspect. That's the primary purpose... If the rogue grabs more coins then that can be handled separately. @keith Paying is determined by who is selected, so no need to do groups. So based on above I actually would refine what I wrote above to add some kind of "add to lootbag to be divided at the end of the dungeon" functionality.
A lootbag... I didn't think about that. How would you handle that? Especially, when it comes to weight? One (or maybe even several) characters would need to have an item "lootbag" with calculated weight...
1516984480
Kryx
Pro
Sheet Author
API Scripter
A general view of a dungeon that I see in Pathfinder Adventures (which is what I run) will have about 2-10 rooms with loot. The party likely isn't looking to distribute that loot equally at the end of each room - that is probably a silly workflow. Instead the lootbag could be some kind of temporary holder. If weights matter you could calculate the weights and have the character with the most extra carrying capacity carry it until division, but that seems like extra effort that isn't so worth it as the weight typically wouldn't be that much. If the weight would be that much then the group would probably divide it there and then.
1516985424
GiGs
Pro
Sheet Author
API Scripter
Arthur, for the lootbag, you could add a dummy character, called Lootbag, and store the treasure in that character's inventory. That also calculates the weight for you.
G G said: Arthur, for the lootbag, you could add a dummy character, called Lootbag, and store the treasure in that character's inventory. That also calculates the weight for you. That would be a workaround that would even work for the current version already, yes.  Another idea would be to store the loot in a separate array in the state object. That would require a "add to lootbag", "show lootbag" and "distribute lootbag" function...
1516986245
Kryx
Pro
Sheet Author
API Scripter
State would definitely be the way to go for a lootbag imo. Though the complexity is already growing quite large if we add a lootbag. I'll explore how difficult it is to do an immediate distribution and split properly. That'd likely be way less effort and would be what I'm after. I already use a lootbag - this script is intended to replace it, not change it to a script.
1516987617

Edited 1516987852
Arthur B
API Scripter
Yes, but I think we need to do something about the weight then. I just had a look at my last sessions' logs, and the party found hoard treasures between 50 and 75 lbs of coins in their last runs.  I also compared it to the loots on donjon and get similar values. So a treasure with an overall value of 150 or 200 gp can consist of 3000 or 4000 coins - that's 60 to 80 lbs. So unless we throw in a bag of holding for free, I really would like to cover that somehow.
i would rename hoard to lootbag. my party's will bulk collect what they can in the moment larger items they will take to a common hallway or near it then once safe they have there npc crew load up the carts. They sell it off or claim what they want on the spot in town. then all money is divided to the players and some is stored in a party supplies sheet. party supplies pays for the NPC's who only provided support after the encounters. things that could be useful are loaded onto the party wagon things for sale are taken sold and the total value is then split in safety so in my case the --each is either @selected|target or @|character|name  so for me the pay and sell  Command Result Notes Equivalent !cm overview of selected characters !cm !cm 5gp add 5gp, split among all characters Distribute among party to make it even if smaller coins exist !cmhoard !cm -5gp subtract 5gp, split among the characters Pay in lesser coins if possible, otherwise get change back !cmpay !cm 5gp --each add 5gp to each character !cmadd !cm -5gp --each subtract 5gp from each character !cmhoard becomes !cmloot after the items are sold with the use of EP, PP for weight if needed everything else in this suggestions is perfect for my uses. i set in session 0 that either the party shares all money or each member is responsible for carrying there own items. so the party either agrees to share all or not to and fight over it
A question brought up by a GM buddy of mine... how hard would it be to make this compatible with 5e Community Contributed sheet?
1517002388
Kryx
Pro
Sheet Author
API Scripter
The community sheet hasn't been supported in over 2 years I believe. Not something we should do imo, though that's up to Arthur.
Kryx said: The community sheet hasn't been supported in over 2 years I believe. Not something we should do imo, though that's up to Arthur. So for my buddy to have CashMaster work on his game, he would have to edit the script to work on it himself?
I'm not that familiar with the community sheet, tbh.. I can have a look into it, but I'm not very eager to change bigger parts of the script for it. Did he try it already?
Ok, I gave it a quick look. It seems that all I need to change is the roll template (and I have already a logic in place to switch between two different roll templates here). So that shouldn't be a big problem.
correct me if i am wrong but is the community sheet different from the OGL sheet?
If I'm not completely wrong, we are talking about this sheet:
no arthur i am completely wrong this was the one i was talking about 
lordmage said: no arthur i am completely wrong this was the one i was talking about  That's the OGL sheet that I'm using as well. The script was originally made for the OGL sheet.
Looking great Arthur. Thanks a lot for making this!
Please stick to your guns on this project, Arthur.  Encumbrance matters!
1517068577
Kryx
Pro
Sheet Author
API Scripter
Encumbrance definitely matters, but perhaps not in between looting and distributing. Though knowing users that time would likely grow and the complexity of a lootbag system is likely beyond a simple script. Immediate distribution may be less realistic, but handles encumbrance and removes the extra complexity, assuming that the distribution can be done correctly.
I love the idea of a lootbag, but I agree with Kryx that this is probably too complex. In addition, you can already simulate it with an additional lootbag character if you really want to go down that road. The next version will have a slightly cleaner output, and it will also show the total weight for the coins. Probably something like this:
1517169267

Edited 1517170399
i am working on creating a nested macro abilities to help manage how i want to use this with in my party i am sure i got the coding wrong i have linked tokens set for testing purpose. using the code below no matter the option the overview outputs that party total is NaN  !cm?{||share|convert|add|hoard|pay}?{amount| }?{Currency|cp|sp|ep|gp|pp}
1517169360
Kryx
Pro
Sheet Author
API Scripter
!cm --hoard is not a command. The documentation in the OP specifies the possible commands. !cmhoard is the current command.
1517170115

Edited 1517170146
been testing with add but thanks for that catch think that answered my nest question 
1517170170
Kryx
Pro
Sheet Author
API Scripter
Can you please provide a screenshot of the character sheet (currency section) and the chat window?
Lordmage, just wondering - are you using the script from github directly? If so, it would actually be !cm --hoard  but that version of the script isn't finished yet. Otherwise, the macro you have won't work at all, as you are using the syntax for the new version already.
Kryx said: Can you please provide a screenshot of the character sheet (currency section) and the chat window? yep i sorted it out the edit code above makes it work the way i wanted  !cm?{||share|convert|add|hoard|pay}?{amount| }?{Currency|cp|sp|ep|gp|pp}
Arthur B said: Lordmage, just wondering - are you using the script from github directly? If so, it would actually be !cm --hoard  but that version of the script isn't finished yet. Otherwise, the macro you have won't work at all, as you are using the syntax for the new version already. yes from git directly asd it works 
1517170690

Edited 1517170880
Arthur B
API Scripter
I should probably continue to support the old syntax as well in the new version... otherwise it'll break the macro. lordmage said: Arthur B said: Lordmage, just wondering - are you using the script from github directly? If so, it would actually be !cm --hoard but that version of the script isn't finished yet. Otherwise, the macro you have won't work at all, as you are using the syntax for the new version already. yes from git directly asd it works If you got it from the gist in the first post, then it's fine. But you shouldn't take the script from the github repo that I posted later, as this is the development version and changes all the time. In addition to that, it doesn't contain the help text.
1517170711
Kryx
Pro
Sheet Author
API Scripter
Arthur means the version specified in the OP, not from the github link he provided for me to contribute to the uncompiled version.
1517170777
Kryx
Pro
Sheet Author
API Scripter
Arthur B said: I should probably continue to support the old syntax as well in the new version... otherwise it'll break the macro. --hoard is an atypical syntax for roll20 scripts. -- should indicate modifiers, not base commands. With your words commands it should be !cm-hoard or !cm-add.
Ok, it's time to fish or cut bait here. We need to agree on a proper syntax, otherwise we fiddle around with the syntax all the time instead of making progress. If there is no real advantage of cleaning up the syntax, then we will go with what I have already. To be honest, it's faster to type !cmhoard 50gp instead of !cm --hoard 50gp or !cm -hoard 50gp .
1517171888

Edited 1517171973
Kryx
Pro
Sheet Author
API Scripter
-- syntax is for a modifier. You could have many modifiers per command. For example: !shaped-spells --lists Wizard --level 7 --school Abjuration --concentration false -- should not be used for a base command. If you're going to use words then !cm-COMMAND (example: !cm-pay) or !cmCOMMAND should be the syntax used. The first syntax is far more common and more sustainable if there are ever 2 word commands. I agree that we should agree on command structure, but so far you haven't bugged an inch even with myself and others in the thread saying that hoard for example is a poor name. Nor have you been willing to adopt the syntax without the words that I made into a table above. 2 syntaxes is fine as we can allow either to work.
Kryx said: -- syntax is for a modifier. You could have many modifiers per command. For example: !shaped-spells --lists Wizard --level 7 --school Abjuration --concentration false -- should not be used for a base command. If you're going to use words then !cm-COMMAND (example: !cm-pay) or !cmCOMMAND should be the syntax used. The first syntax is far more common and more sustainable if there are ever 2 word commands. I agree that we should agree on command structure, but so far you haven't bugged an inch even with myself and others in the thread saying that hoard for example is a poor name. Nor have you been willing to adopt the syntax without the words that I made into a table above. 2 syntaxes is fine as we can allow either to work. Ah, that's not true. I'm open to any suggestions, both for the wording and the syntax (and I think I mentioned that several times here already). "Hoard" was the first proposal for that function, that's why I called it cmhoard. But I wouldn't mind at all calling it "cmtreasure" or "cm-reward" or something else. For the table you posted - I even said I like it. The only problem that I see right now – what happens when someone is using both negative and positive amounts? Currently, I look for the command word, then parse the currency string inside the respective subroutine. With that syntax, I probably have to start with the currency string and then call several subroutines... which means I'd have to shuffle things around quite a bit. 
yep i always get my code from the OP as i understand any other codes are unofficial and in testing.  personally i intend on using this as a store front so it will be alot of !cmpay then cmshare for in the moment money shares. i just personally wish it had a chat command menu that could scan for sheets set controlled by players and ask if i want them to be part of the party. sort of how easy experience ask for active vs inactive players. so this way when i use !cmshare 300gp it could auto share it to the active party members. rather than selecting tokens. 
lordmage said: yep i always get my code from the OP as i understand any other codes are unofficial and in testing.  personally i intend on using this as a store front so it will be alot of !cmpay then cmshare for in the moment money shares. i just personally wish it had a chat command menu that could scan for sheets set controlled by players and ask if i want them to be part of the party. sort of how easy experience ask for active vs inactive players. so this way when i use !cmshare 300gp it could auto share it to the active party members. rather than selecting tokens.  Yes, I noticed I need some opposite to the !cmhoard function when I summarised the different commands now. Would this work? Current command Example Description New command Alternative Example Example Base commands !cmhelp !cmhelp Shows the help text !cm !cm -h !cm !cm -h !cm !cm Gives overview !cm-overview !cm -o !cm-overview !cm -o Payment commands !cmadd !cmadd 50gp Adds a certain amount to every selected character (opposite to cmpay) !cm-add !cm -a !cm-add 50gp !cm -a 50gp !cmpay !cmpay 5sp Subtracts a certain amount from each selected character, starting with the lowest coin type, with conversion !cm-pay !cm -p !cm-pay 5sp !cm -p 5sp !cmhoard !cmhoard 500gp Distributes a certain amount of coins between characters. No conversion will be done. !cm-treasure !cm -t !cm-treasure 500gp !cm -t 500gp !cmxxxx !cmxxxx 500gp Subtract a certain amount, split up equally between selected characters (currently still missing) !cm-xxxx !cm -x !cm-xxxx 500gp !cm -x 500gp Conversion/Cleanup commands !cmconvert !cmconvert Splits up the money between selected characters, converting in all 5 coin types for lowest weight !cm-best-share !cm -bs !cm-best-share !cm -bs !cmshare !cmshare Splits up the money between selected characters, converting only into the three most common coin types for lowest weight !cm-share !cm -s !cm-share !cm -s
The syntax command structure aside my suggestion is to parse the sheets for controlled by. Players and not only gm. Then out out a list of possible party members that you could then on/off this way when you do a share you no longer need to select tokens. Where pay and add. Makes.@selected
lordmage said: The syntax command structure aside my suggestion is to parse the sheets for controlled by. Players and not only gm. Then out out a list of possible party members that you could then on/off this way when you do a share you no longer need to select tokens. Where pay and add. Makes.@selected I was thinking about an option to save a selection, and then use the saved selection as an additional parameter. Something like !cm-pay 5cp --groupname
Arthur B said: lordmage said: The syntax command structure aside my suggestion is to parse the sheets for controlled by. Players and not only gm. Then out out a list of possible party members that you could then on/off this way when you do a share you no longer need to select tokens. Where pay and add. Makes.@selected I was thinking about an option to save a selection, and then use the saved selection as an additional parameter. Something like !cm-pay 5cp --groupname That certainly is one was to do it but a more. Flexible way is how the easy experience API define. Especially active vs inactive players which can be changed on the fly thur a configuration menu
I don't like the way EasyExperience is handling the character selection, for two reasons: First, it's an all-or-nothing thing. You can only select all tokens that are controlled by a player.  I don't really want to come up with a complex config menu when all you have to do is to quickly select the tokens you need. In addition, many players might have additional token that they control (e.g. a familiar, or a mount, or some magic globe thing). They would mess with the way EasyExperience works as well, I assume.
1517250211
Kryx
Pro
Sheet Author
API Scripter
Thanks for taking the time to respond. Command Structure I assume the 1 letter versions are meant to be !cm-p without the space before the hyphen? I would skip the 1 letter commands - at least I wouldn't want to use them as it adds more complexity to think about which command is which until it becomes muscle memory. Mixing and matching positive and negative is weird, but it can be done with the word commands already. Either support it or detect it and display a message. I would take the later option. The most intuitive command structure, imo, is based on arithmetic. Adding them would not impact those who don't want to use them. !cm 5gp would equate to !cm-treasure !cm 5gp --each would equate to !cm-add !cm -5gp would equare to !cm-xxxx !cm -5gp --each would equate to !cm-pay Random notes: !cm-xxxx and !cm-treasure are far more likely commands to run than !cm-add and !cm-pay. !cm-xxxx covers cases like the party paying a shop keeper for group equipment. If only 1 player paying is desired then only selecting 1 character is the option. I'm not seeing the value in !cm-pay besides precalculating.. !cm-treasure covers cases like the party receiving a quest reward or finding treasure in a dungeon. If only 1 player getting money is desired then only selecting 1 character is the option. I'm not seeing the value in !cm-add besides precalculating.. loot is probably a better name than treasure !cm !cm should ideally output a list of all possible command options, but in a short version with a link to expand to the detailed text. Setting permanent party members I agree that selecting all controlled characters is bad. Best to let the GM add players to a list (storing the character id) if such a feature is desired (would be nice, but not necessary) Coin holding/splitting I know you're not so concerned about uneven splitting, but I suspect it'll have a far larger impact than you suspect due to the non-random order of characters. I think in the long term allocating each character to hold ~20 of each coin to then move to other characters to make splits even would probably be the best option. Though that's a bit tricky to make work. For now I'd definitely recommend !cm-pay doesn't start with the lowest, but starts with the most accurate and then goes lower as needed while still reducing overall weight (aiming for ~20 coins) I've been super busy lately and haven't had time to contribute. Sorry for that. Likely won't have much time this week either. :(
1517254714

Edited 1517255158
Arthur B said: I don't like the way EasyExperience is handling the character selection, for two reasons: First, it's an all-or-nothing thing. You can only select all tokens that are controlled by a player.  I don't really want to come up with a complex config menu when all you have to do is to quickly select the tokens you need. In addition, many players might have additional token that they control (e.g. a familiar, or a mount, or some magic globe thing). They would mess with the way EasyExperience works as well, I assume. Just a correction easy xp is not an all or nothing you can set which or on or off based on the controlled by and all it take is to turn of the active familiar. You are right that it makes its selection based of the control by... And once it knows who is active unless that needs changed no need to reconfigure it.    How ever maybe a way to have the API store the token id's in a list as suggested is also a good way to work out who the party is vs the @selected  My suggested was to store who gets the splits in a list of some kind then if you do not have an @selected the system would route the command to the known party.  But it's your script you code it how you want. I'll just have to use it in a way that I can adjust to
Kryx said: Thanks for taking the time to respond. Command Structure I assume the 1 letter versions are meant to be !cm-p without the space before the hyphen? I would skip the 1 letter commands - at least I wouldn't want to use them as it adds more complexity to think about which command is which until it becomes muscle memory. Mixing and matching positive and negative is weird, but it can be done with the word commands already. Either support it or detect it and display a message. I would take the later option. The most intuitive command structure, imo, is based on arithmetic. Adding them would not impact those who don't want to use them. !cm 5gp would equate to !cm-treasure !cm 5gp --each would equate to !cm-add !cm -5gp would equare to !cm-xxxx !cm -5gp --each would equate to !cm-pay Random notes: !cm-xxxx and !cm-treasure are far more likely commands to run than !cm-add and !cm-pay. !cm-xxxx covers cases like the party paying a shop keeper for group equipment. If only 1 player paying is desired then only selecting 1 character is the option. I'm not seeing the value in !cm-pay besides precalculating.. !cm-treasure covers cases like the party receiving a quest reward or finding treasure in a dungeon. If only 1 player getting money is desired then only selecting 1 character is the option. I'm not seeing the value in !cm-add besides precalculating.. loot is probably a better name than treasure !cm !cm should ideally output a list of all possible command options, but in a short version with a link to expand to the detailed text. Setting permanent party members I agree that selecting all controlled characters is bad. Best to let the GM add players to a list (storing the character id) if such a feature is desired (would be nice, but not necessary) Coin holding/splitting I know you're not so concerned about uneven splitting, but I suspect it'll have a far larger impact than you suspect due to the non-random order of characters. I think in the long term allocating each character to hold ~20 of each coin to then move to other characters to make splits even would probably be the best option. Though that's a bit tricky to make work. For now I'd definitely recommend !cm-pay doesn't start with the lowest, but starts with the most accurate and then goes lower as needed while still reducing overall weight (aiming for ~20 coins) I've been super busy lately and haven't had time to contribute. Sorry for that. Likely won't have much time this week either. :( Hi Kryx, I don't completely agree with you on the random notes... cmpay is intended for situations where all characters need to pay a certain amount x (e.g. 5sp in a tavern, or a toll). But I'll agree on the treasure/loot part. I'll think about the other comments. I feel that you're right with most of it, but I don't want to admit it yet ;) And don't worry about contribution. I'm not able to do much either with my broken hand. Typing with only the left hand right now...
Script is crashing on me. It's on OGL and latest. Just started a new campaign 
Nover C. said: Script is crashing on me. It's on OGL and latest. Just started a new campaign  Can you give me some more information? Did the console give any error message?