Tabletop Simulator

Tabletop Simulator

Not enough ratings
E-Money
   
Award
Favorite
Favorited
Unfavorite
Number of Players: 1, 2, 3, 4
Assets: Scripting
Tags: Misc, 4+, Templates
File Size
Posted
24.579 KB
27 Oct, 2019 @ 11:28am
1 Change Note ( view )

Subscribe to download
E-Money

Description
E-Money / Emoney / electronic cash.
Use this instead of paper money from games like Monopoly and such, for up to 6 players.

Usage:
- spawn the item in, by default it is assigned to the bank (unless you save the object assigned to sth else)
- You may spawn as many of the items as you want, recommended is one for each player and one for the bank.
- The admin can type a color name, eg "Red" into the text box and if there is currently a player with this color, the card will change its owner to that player. Only the owner or admin can use the card.
- Players can only send money to other players or the bank, they can not take money from the bank or other players on their own. So either the other player (or admin) has to send them the money or the admin has to use the bank to send the player money.
- The admin can also rightclick the "Transfer" button, instead of leftclick, which will make the sent amount negative, so will revert the direction of the transfer.
- only the admin can use the bank card. The bank also has a RESET button, which will set all balances to startingValue (default 0) again.

Advanced:
Within the script you can adjust:
startingValue (default 0)
hideothers (default false) -> if true then there wont be a message who transfered what and player will only see their own balance, not the one from others. Dont forget to put the cards within hidden zones in this case.
BankColor (default Grey)


Known Problems:
- If a player changes color, the card will track the colorchange itself, but wont change its assigned color while still being attached to the player. To solve this simply type the new color of the player into the text field and everything works fine again.
- (This is only a problem if you spawn a new card, while others already have balance values assigned): When assigning a new color to a card, it will search for any other already existing card and load their player/balance data. So if you have 1 card with correct data and 2 cards with wrong/empty data, one empty card may load data from the other empty card, instead from the correct one. To solve this, only add new cards + assign color one after the other, so the new card will always load correct data.


Save it to your chest.

Based on MrStump's The Bank mod:
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=727658836

IMPORTANT:
In the current uploaded version, only the admi is allowed to change tha amounts. Unfortunately uploading anything to workshop and updating this mod is a real pain and I would have to spent hours to find out how (the object saves the current players, so it would save "Serp" when I upload it, but you dont want to have "Serp" as a player on your card :D).
###
Therefore: Spawn an emoney object, go to modding->scripting, open the code from the emoney object, delete all the code there, and copy paste this instead in:
https://pastebin.com/s5qpt9Q4
Then save the object to your chest and use this from now on.
11 Comments
Serp  [author] 21 Oct, 2020 @ 2:01am 
Don't remember, but most likely the code only includes up to 6 players, so simply copy paste the code into any text editor. then you can try to add more players/colours.
just skimmed trhough the code and I think you only need to add new "ppx" functions and link it.
So simply search for pp1/pp2 and so on up to pp6 and copy paste the code and add pp7/pp8 and so on. I think this will already work.
The Lapis Fox 17 Oct, 2020 @ 2:43pm 
Question, why does it only work for up to 6 players? Is it a coding or a design issue?
Harloneti 3 May, 2020 @ 6:25pm 
Nice work. You can put a code to do if i try transfer 30 but i have enough money. don transfer and put in chat mesagge no money or something?. I said it because if play hidden to cheat... Sorry my english is not good XD
Serp  [author] 23 Apr, 2020 @ 5:09am 
Just tried to find out how I could update this for the past 1 hour, but I have no clue, so I put the whole code in the description above in a pastebin link.
Serp  [author] 23 Apr, 2020 @ 4:42am 
@DrMigas:
Meanwhile you can fix it yourself in the script, spawn 1 emoney object and go to modding->scripting and open the code for the emoney object. Search for
"function input_amount(".
There you will see as 2nd line
"if player~=nil and player.admin then"
Change it to
"if player~=nil then"
And then change the line:
"elseif inputNum==nil and inputString~=nil and type(inputString)=="string" then"
to
"elseif player.admin and inputNum==nil and inputString~=nil and type(inputString)=="string" then"

this way the admin check is in the correct location.
Serp  [author] 23 Apr, 2020 @ 4:42am 
@DrMigas:
Unfortunately I was not able to test this with real players (we never played game of live or monopoly afterwards).

At first glance I think I found the problem in the script, I only allow the admin to change the value. That is of course not correct.

Unfortunately I dont remember how to update the mod. The problem is, that this card remembers the current players, so in my case it will remember "Serp". So if I upload this card, everyone downloading it will have Serp as one player. I can not remember how I solved this when I uploaded the mod...
DrMigas 22 Apr, 2020 @ 2:06pm 
Ok now I can put the name Green, Red, etc. on it but most of the time i have problems due i just only can modify the amount to pay. Ex the other player has problems to pay, i put the amount and i send the money, then the other player changes the value of the amount and sends the same quantity as before. What I'm doing wrong. Thx
Serp  [author] 17 Apr, 2020 @ 9:25am 
@DrMigas: copy pasting will do (or drag'n'drop multiple from the mods "folder"). They will have the same configuration then, but typing a name or bank into the text field will solve this.
DrMigas 17 Apr, 2020 @ 6:29am 
" You may spawn as many of the items as you want, recommended is one for each player and one for the bank."
How can i spawn may of those items like in the picture, i supose that copy pasting doen't run XD, sorry I'm a noob. Thanks
Serp  [author] 3 Apr, 2020 @ 9:37am 
hm, a short test shows that everything is working fine.
Please make sure you understood the usage description above.
To send money to the bank, you simple click the "bank" text on your card, then the send button will include text "transfer money to bank", enter the amount and click the send button.