Tabletop Simulator

Tabletop Simulator

Universal Counter Tokens
50 Comments
iMaxed0ut 8 Jan @ 9:16am 
This is an amazing counter token! If there a way to have a second counter on the back side of the token? I have a game where the unit can be upgraded and that is indicated by flipping the token over. I'd like to be able to flip the token, then continue to track health without having a set of base tokens on one bag then upgraded tokens in another. I thought maybe I could repeat the code and then edit the positions, but I'm not knowledgeable enough in LUA coding to know how to do that...
Sean2111 15 Dec, 2023 @ 12:28am 
This is great.
I used my own image and saved to the cloud ,thought maybe for the best.
Then I made this counter really small.
Then I attached a Miniature Model (W40k infantry) to the counter.
Put the counter to rear of model.

Now I can still use the buttons ,and at present using for range. So I know this particular infantry man can shoot so far for example.

Works good.
Iron-Claw 6 Jul, 2023 @ 3:05pm 
Yes, same here. So far it has always worked fine for the host, but sometimes the client players report that the numbers overlap for them and/or the buttons don‘t work. When this happens, saving and reloading the game seems to fix it. Also, rewinding time also fixed it at least in one case. Strange… not sure whether this behaviour is caused by a TTS bug or a mod bug (or both :).
Minesteper 25 Feb, 2022 @ 11:01am 
does anyone else have any problems with the counters it seems fine to me but my players say the the numbers overalap on top of each other
MarcusRaven 5 Jul, 2021 @ 10:25am 
Is it possible to have two counters on the same token?
BeautifulMountAiryLodge 6 Mar, 2021 @ 12:11pm 
This is fantastic! Thanks!
Becbunzen 30 Jan, 2021 @ 10:42am 
The counters seem broken with the update to TTS yesterday. Are you getting errors too?
Nogge 27 Dec, 2020 @ 11:41am 
These counters are exactly what I was looking for, for a mod I'm putting together of a dying game.

Would it be alright if I use these in it, giving credit and linking here of course?
rULmismo 7 Nov, 2020 @ 2:43am 
Thanks four your guides and assets. I am trying to use your counter in a script, but when access the getvalue() or increment() methods I always get a NIL result error.
It puzzles me that it works right if I use an standard TTS counter, but not with custom counters I tried. Any suggestion what I am doing worng?
Keanu Weebs 13 Jul, 2020 @ 2:36am 
Any thoughts on how to add multiple counters to a single image? I am trying to edit a counter for armor and structure for a battletech game.
Professor "Fannybaws" Dax 2 Jul, 2020 @ 7:23am 
Thank You Mr Stumps. I'm going to be uploading two verisons of a steam punk engine deck builder named Widget Ridge and just wanted to make sure it is ok with you that your counters will be in it.
gravem 2 May, 2020 @ 1:07pm 
Thank you for this. It would be great if these also could do negative numbers.
Brodieman 21 Apr, 2020 @ 6:06pm 
Thanks for making this! When I right click to save to chest, as stated, I do not have that option?
sequeira.pedro.rc 21 Apr, 2020 @ 2:46pm 
I'm trying to change one of these to write the changes in the console for everyone to see. it could be useful in spotting mistakes. I've seen it first in TFMars, but the counter there only has the +-1 button
Jboy11 17 Apr, 2020 @ 2:46pm 
i made some modifications to make a damage counter for pokemon tcg, can i upload in the workshop? since i havent saw none
giving all the credits to you of course
Becbunzen 15 Apr, 2020 @ 10:47am 
Thank you, this works great!

On my wishlist would be to allow increasing/decreasing by 1 at a time, by scrolling up/down with the mousewheel while holding down LMB over the middle counter for example. Then I would not need to zoom in to be able to hit the small buttons if there is just a small change. I have multiple counters per players (tracking resources), so each counter has to be kind of small to fit on screen.
Sirzento / Nico 25 Mar, 2020 @ 12:59am 
The way I did it was to extend the transparents so that the desired counter location is in the middle of the picture
Flyndad 22 Mar, 2020 @ 10:39pm 
how would I move the location of the counters relative to the object?
AJBruner77 21 Dec, 2019 @ 3:27am 
This is a nice complimentary package for any game that requires tracking amounts. Easy to configure and simple to alter.
kakashi 22 Jul, 2019 @ 10:22am 
Is there a way to add shift click +5 or Ctrl +10 functions to this? I tried a couple ideas but it seems to mess up a bit. So i figured is ask instead :)
Groule 17 Mar, 2018 @ 7:08am 
Awesome
Minty 18 Feb, 2018 @ 3:37pm 
Would it be possible to edit the counters to either show the button while it's in your hand, or set the name/ description to show it's current value when updated?
Rose 2 Dec, 2017 @ 10:03am 
modesty is cute and all, but seriously, you dont need modesty :D youre one of the pillars of this modding community. thank you so much
MrStump  [author] 2 Dec, 2017 @ 9:53am 
haha thanks!
Rose 1 Dec, 2017 @ 11:16pm 
Same dude who does the turn trackers and egg timers. this guy is the man. it would litterally be impossible to play RPG on table top without this dude
Marquise* 10 Oct, 2017 @ 1:11am 
What a great idea!!! :D
MrStump  [author] 16 Aug, 2017 @ 9:59pm 
Check out this guy https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=730142339&searchtext=counter

It lets you put multiple counters on an object with some setup. Might be able to poke it into doing what you want.
Luap26 16 Aug, 2017 @ 8:16pm 
yeah I dont know any lua, sadly.
MrStump  [author] 16 Aug, 2017 @ 7:32pm 
You'd need to know lua to know how to format the code correctly. In concept, you just make 3 "display" buttons, 3 + buttons and 3 - buttons.
Luap26 16 Aug, 2017 @ 12:04pm 
Hey, I am lookin for a counter similar to this. I am lookin for a counter similar to the 3 dail combination lock of a brief case. How would I make an object that contains 3 different counters that go between 0 - 9?
Axis 17 Jun, 2017 @ 6:37pm 
I appreciate the help. Thanks very much.
MrStump  [author] 17 Jun, 2017 @ 6:29pm 
I purposefully disabled them with a couple of lines of code. If you wanted them to go below 0, then you can remove the following little bits of code in 2 steps. On line 44 is this: --Prevents count from going below 0

Right beneath that is if count > 0 then . Delete that line. Then 3 lines down is the word end . Delete that.

Now go down to what was line 59. Again it says --Prevents count from going below 0 . Erase the line right below it that says if count > 4 then . Then skip the next line and delete the following 3 lines that say else , count = 0 , and end .

That's it. It should now count down into the negatives. Sorry for the trouble, its an old script and I didn't write in nearly as much flexibility as I do now. I might revisit this concept if I ever thing of a good addition to make besides the negative thing.
Axis 17 Jun, 2017 @ 5:43pm 
As far as I can tell, this doesn't seem to support negative numbers. Am I correct in saying so?
kensuaga 10 Jun, 2017 @ 11:29am 
Thank you!
MrStump  [author] 10 Jun, 2017 @ 6:48am 
If you look in the code, you can see position={number, number, number}. Those are the coordinates of where the buttons are placed. Don't change the middle number. The first number is left/right, second number is up down. 0 is centered, -1 would be left/up and 1 would be down/right
kensuaga 9 Jun, 2017 @ 11:57pm 
Is there any possibility to move the numbers and button to the side of the token?
Mag Roader 2 Jun, 2017 @ 8:06am 
I was adding a feature to Terraforming Mars, which uses this counter. I needed to add some stuff. Maybe consider adding these to the default script!

Read and set value externally
I can now check and modify the counter value externally. This let me add a feature to Terraforming Mars in which you frequently transfer one counter (Energy) to another (Heat).

This just required I add 2 functions:

function getCount()
return count
end

function setCount(t)
count = t[1]
updateDisplay()
end

Usage from elsewhere:
local counterValue = counterToken.call("getCount")
counterToken.call("setCount", {whatever})
Mag Roader 2 Jun, 2017 @ 8:06am 
I was adding a feature to Terraforming Mars, which uses this counter. I needed to add some stuff. Maybe consider adding these to the default script!

Add buttons externally
I can now add buttons externally from Global. There was a bug where the code was assuming the display index was 1 all the time, which if you add buttons from Global it won't be. To do this, I removed the index from b_display in generateButtonParamiters and changed the button creation calls to this:

self.createButton(b_display)
self.createButton(b_plus)
self.createButton(b_minus)
self.createButton(b_plus5)
self.createButton(b_minus5)

-- Find the index if b_display because we will need to update it later
local allButtons = self.getButtons()
for i,bt in ipairs(allButtons) do
if bt.click_function == b_display.click_function then
b_display.index = bt.index
end
end
Dot0Dot 25 Feb, 2017 @ 2:00pm 
Hi. Made use of your code in - SPI's Barbarian Kings (scripted) - very helpful. Thanks
MrStump  [author] 23 Sep, 2016 @ 6:20am 
The solution to this one was to make a tiny image with a lot of transparent background.
Olsen 22 Sep, 2016 @ 9:14pm 
any chane a counter could be loaded on blank tile i tried an empty png and smaller 100x100 images no such luck
Heyzel 24 Jun, 2016 @ 8:33am 
i love u 4 this awesome dude!!!!!!!!!!!!!!
Vic 23 Jun, 2016 @ 12:25pm 
This is amazing!
_n 22 Jun, 2016 @ 4:17am 
This is really useful! Thanks a million
WEAPON 20 Jun, 2016 @ 1:47pm 
@MrStump -- Bingo! Thank you. I must have disabled scripting at some point...
Paffers 17 Jun, 2016 @ 10:51am 
I also did not see buttons until I turned on scripting :) I actually looked at your code as I have never looked at TTS scripting, and following what you had done managed to add a 'clear to zero' button in about 10 minutes . So thanks for again for these.
MrStump  [author] 17 Jun, 2016 @ 10:42am 
@WeApOn I've checked. The scripting is fine, and loads for people. Maybe you have scripting disabled? Go to Host > Options > Scripting and make sure the box is checked.

Also, the buttons appear once the loading is complete. Did the loading finish? Did you get any errors popping up or in chat?
WEAPON 17 Jun, 2016 @ 10:18am 
I am not seeing the counters on these tokens? I load the workshop to see the following... http://i.imgur.com/N7Qmofi.jpg

How do I get the counters to appear?
Paffers 17 Jun, 2016 @ 2:14am 
Nice
darleth 16 Jun, 2016 @ 11:54pm 
Great work...