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

Logic problem with coinage in script

I've created a script that lets me add and subtract coins for my players, and everything works great except for the subtraction of coins. I am having a hard time working the logic to account for all scenarios. I make a general check to make sure they have enough overall for the transaction by comparing cp equivalents, and if they have enough coinage downstream (in smaller denominations) it makes change just fine. It's when they don't have enough downstream but they do upstream that I can't figure out. For instance, if a player has enough cp and sp to cover change for the gp they are spending it works great. However, if the player has 0 cp, 0 sp, and 5 gp and they want to buy something that costs 10 sp, so all I'll get is a negative cp covering the expense and never touch the gp. I need to figure out how to know to look upstream for coins to convert. Anyone ever figure this out? I'm banging my head against the wall. Maybe that's why...  ¯\_(ツ)_/¯   Thanks! BTW I'm trying to leave coins as they are as much as possible so it is up to my players to convert their coins when they get too many.
I have not used it, so I do not know the details, but there is a script called CashMaster that has a lot of functionality: <a href="https://app.roll20.net/forum/post/5950228/script-cashmaster-5e-a-simple-script-to-manage-a-partys-money" rel="nofollow">https://app.roll20.net/forum/post/5950228/script-cashmaster-5e-a-simple-script-to-manage-a-partys-money</a>
Rabulias said: I have not used it, so I do not know the details, but there is a script called CashMaster that has a lot of functionality: <a href="https://app.roll20.net/forum/post/5950228/script-cashmaster-5e-a-simple-script-to-manage-a-partys-money" rel="nofollow">https://app.roll20.net/forum/post/5950228/script-cashmaster-5e-a-simple-script-to-manage-a-partys-money</a> CashMaster does not work with the 5e Shaped Sheet. Already tried it, which is why I'm writing my own. On the up side, I think I've got it figured out. I guess we'll see tomorrow when I start the laborious process of testing.
Ben L. said: Rabulias said: I have not used it, so I do not know the details, but there is a script called CashMaster that has a lot of functionality: <a href="https://app.roll20.net/forum/post/5950228/script-cashmaster-5e-a-simple-script-to-manage-a-partys-money" rel="nofollow">https://app.roll20.net/forum/post/5950228/script-cashmaster-5e-a-simple-script-to-manage-a-partys-money</a> CashMaster does not work with the 5e Shaped Sheet. Already tried it, which is why I'm writing my own. On the up side, I think I've got it figured out. I guess we'll see tomorrow when I start the laborious process of testing. Hi, if it's of any help: I temporarily removed support for the Shaped sheet after they did a bigger change that affected how money is handled in the sheet.&nbsp; Once I have some time to wrap my head around it, I might add support for the Shaped sheet again (it will require quite some rewriting of the code). Right now I'm too busy with real-life stuff (just changing job, toddler starting at daycare, lots of family visits and so on), and I don't even have time playing D&amp;D, leave alone doing some programming for roll20. Sorry.
1536665639

Edited 1536665941
GM Michael
API Scripter
CashMaster may presently be incompatible, but that doesn't mean it can't be a reference point for you. The underlying logic (for the stock coins) is the same in both, it's just that interfacing with the Shaped Sheet is a bit weird since the update.&nbsp; It's not impossible though, and I've been slowly adding functions that can be sheet agnostic.&nbsp; The underlying principle of updating its coins is actually the same as what we use in the new ShopMaster update for inventory alteration.&nbsp; It's just a matter of propagating that logic through the rest of the code that's a pain. And like Arthur, I've also got a ton of life things going on at the moment.&nbsp; My party uses the OGL sheets, so I've not been overly incentivized to do the Shaped Sheet either.&nbsp; I'd guess at least a month before I can get around to it. I would recommend taking a look at the function ChangeMoney() in the intervening time though.
Just finished my script last night. Works like a charm. I'll share once I clean it up a bit. :)