Tabletop Simulator

Tabletop Simulator

Not enough ratings
The Bank - scripted money exchange system
   
Award
Favorite
Favorited
Unfavorite
Assets: Scripting
Tags: Misc, Templates
File Size
Posted
Updated
18.998 KB
19 Jul, 2016 @ 11:13am
19 Jul, 2016 @ 11:32am
2 Change Notes ( view )

Subscribe to download
The Bank - scripted money exchange system

Description
Tired of exchanging money back and forth in games like Monopoly? This is a scripted tool to replace the bank and money in general in some games. Transfer money to/from players and/or the bank all with a few simple clicks without tedious stacking of tokens.

How it works:
  • Press the indicated button to start up the tool, adding all seated players to it (Max: 6)
  • Select TO to decide who will receive money, then click the player. Defaults to the Bank receiving the money.
  • Select FROM to decide who will pay the money, then click the player. Defaults to the Bank providing the money.
  • Put in a dollar amount to be transferred.
  • Click Transfer to complete the transaction.
Features:
  • Works fully with save/load and undo/redo. Reset All is the only way to remove (or add in new) players.
  • Prints to chat. Every time a transfer is performed, the chat will log "NAME transferred AMOUNT from WHOITWASFROM to WHOITWASTO. Prevents accidents as well as traitorous fiends.
  • Reset confirmation. If you click Reset All, it will ask you to confirm your click.
  • Protection from mistakes. Doesn't let you transfer money from yourself to yourself, or transfer from Bank to Bank.
  • Clear button. Pressing CLR keeps all user bank values, but clears the currently entered dollar amounts and to/from players.
  • Waterproof.
After testing, this was in good working order. If any issue is found, please bring it to my attention so I can fix it for everyone. Also, there are 2 variables you can alter at top of the code. One will let you change the starting dollar value people get (Default: 0) and the other lets you change the character limit for displayed names (Default: 14).
9 Comments
Jas2188 3 Apr, 2020 @ 9:30am 
I would also agree with Karate Jesus. It would be awesome to be able to have a quick edit to let the calculator accept manually entered names.
fshore 31 Mar, 2020 @ 3:03am 
In my previous comment, I should have specified that it was the Log entry that had the wrong "from" player.
fshore 31 Mar, 2020 @ 3:02am 
Hi, MrStump.
I love this bank mod.
However, I noticed that the "from" value was always "Bank" and never the real player.
I believe I found the fix for this and am listing the code below.
I hope this helps.

if selectFrom != 0 then
-- added next line to get proper "from" name
nameFrom = players[selectFrom].name
-- deleted next line since it always had "from Bank"
-- nmeFrom = paramValues[selectFrom].name
local oldValue = players[selectFrom].value
local totalValue = oldValue - newValue
players[selectFrom].value = totalValue
paramValues[selectFrom].label = tostring(totalValue)
self.editButton(paramValues[selectFrom])
end
Serp 27 Oct, 2019 @ 11:49am 
I just published my version of emoney, based on your mod :) I would have never be able to make this without your code as sample :D And yes, I can confirm while there are alot of script possibilites, some kind of basic stuff is really terrible (especially button indexing).
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1900392941
Serp 24 Oct, 2019 @ 4:55pm 
GREAT work. I just played my first time monopoly and Game of life with tabetop and we ended up using the ingame calcualtor to represent the money. I already thought of a tool like this and that I would like to make one, but although I know how to code lua, I'm not yet familiar with tabletop simulator and it looks like scription for TTS really sucks?! At least the ingame editor is the worst I have ever seen :D And other scripted games complain about many still unfixed bugs and problems.
Anyway, thank you very much for this and all your other brilliant mods :)
Volg 4 Dec, 2018 @ 5:55am 
can this be used in conjunction with other objects to represent a players cash? so for instance have a small tile for each player with a text box on it. then when this bank machine does the transfer it will update the text box on that player's tile?
Karate Jesus 1 Oct, 2018 @ 1:42pm 
Also, I was wondering if there is any way to alter to script to not check for players to be seated, and just start with two players with custom names. I typically use tts to play games with my girlfriend or a few friends locally, either with their laptops, or with me controlling everything. In these cases I just use single player, so it would be nice if I could make a few "not too complex" edits to accomplish this. I'm assuming this would take a lot of work, so I understand I probably can't, but it was worth an ask. Seeing as I have pretty much everything of yours from your workshop to learn scripting, I thought I'd ask! Thank you so much for all your mods and help for me and the community to learn scripting and make better games!
Karate Jesus 1 Oct, 2018 @ 1:42pm 
Amazing mod. Thank you so much. The only issue I've noticed is when transferring money from player to player, it prints that the money was transferred from the bank, however the money does come from the correct source. My guess it this is related to it being a hotseat game.

I've never been a fan of coding, but using Lua for TTS and seeing it come to life has definitely got me into it!
gitc4t 20 Aug, 2016 @ 6:44am 
Thanks a lot for making this