Tabletop Simulator

Tabletop Simulator

Not enough ratings
[Tool] Counter Points & Objects + Examples
   
Award
Favorite
Favorited
Unfavorite
Type: Utility
Complexity: Low Complexity
Number of Players: 10+
Tags: Templates
File Size
Posted
Updated
50.301 KB
May 2, 2020 @ 8:05am
May 29, 2020 @ 3:08pm
4 Change Notes ( view )

Subscribe to download
[Tool] Counter Points & Objects + Examples

Description
A general tool to count Points and number of Objects. The mod contains different examples, how to use the mod.

Can be used on any Objects. The easiest examples are cards, with that you can count the numbers and the card points. The mod works based on the description field. You can get the counted values also by a script call to use it with your own code e.g. for visualisation by yourself.



ADVANTAGES:
  • It can be applied to any items (objects) to count the numbers and the points.
  • The code can be copied also into any item (object) and it works, it is a standalone version.
  • You do not need any LUA knowledge to get it work. For this purpose, everything can be done by modifying the description of the items (objects).
  • You can keep your description text or add some text to your description is does not effect the mod.
  • Works with stacked, unstacked items (objects).
  • Works with forward and rewind time.

Instruction to get it work:
The description of the Controller and the items, which shall be considered needs to be modified.
The description of the Controller is always read at the loading of the game. But if modified in game, the Controller can be dropped to read the new description.
The are two steps: ASSIGN POINTS & ASSIGN GUID DISPLAY & PLACE ITEM.


1. ASSIGN POINTS
  • To assign points to an item (object) write the key word:
    COUNTER_OBJECT_POINT=’pointValue’ in the description. ‘pointValue’ needs to be replaced by a numeric
    value.

EXAMPLE: COUNTER_OBJECT_POINT=5
Assigns a value of 5. Negative values, like -2 and also floating values like 1.23 are supported.

  • Only items with the key word COUNTER_OBJECT_POINT=’pointValue’ are considered for the counting of items. If you want a counting of items, without considering the points, you have to assign COUNTER_OBJECT_POINT=0 to the item.

2. ASSIGN GUID DISPLAY & PLACE ITEM
There are 3 keys values:

GUID_PLACE_OBJECTS['ID']='GUID'
GUID_DISPLAY_COUNTED_POINTS['ID']='GUID'
GUID_DISPLAY_COUNTED_OBJECTS['ID']='GUID'

'ID' := needs to be an positive integer. For example: 1, 2, .... different ID's can be for example used to count points for different players.
'GUID' := is the guid of the respective item.

The 1. Key (MANDATORY): GUID_PLACE_OBJECTS['ID']='GUID'
  • represents an item (object), which is typically a flat rectangle, where you can place items (objects) like cards or figurinne.
  • you can place on top of the flat rectangle a board or something to cover it complety, if you want to hide it. the counting works with the help of a script zone, which covers the whole furface of the rectangle and has a specific height. So covering does not affect the counting.
  • The script zone is created dynamically and covers the rectangle. Therefore, it is possible to change the dimensions of the rectangle during the game.
  • The script zone moves with the rectangle all the time.
  • The counting and the updating of the script zone is done every second. I do not think that a real time update is necessary. It is only an unnecessary burden from my point of view.


The 2. Key (OPTIONAL): GUID_DISPLAY_COUNTED_POINTS['ID']='GUID'
  • define the item (object), where the counted points shall be shown.
  • the text is created at the top surface with the local coordinates {0,+y,0}. If you dont see it, flip the item.

The 3. Key (OPTIONAL): GUID_DISPLAY_COUNTED_OBJECTS ['ID']='GUID'
  • define the item (object), where the counted items (objects) shall be shown.
  • the text is created at the top surface with the local coordinates {0,+y,0}. If you dont see it, flip the item.

EXAMPLE:
GUID_PLACE_OBJECTS[1]=ba818e
GUID_DISPLAY_COUNTED_POINTS[1]=735861
GUID_DISPLAY_COUNTED_OBJECTS[1]=e27be5

GUID_PLACE_OBJECTS[2]=18ff40
GUID_DISPLAY_COUNTED_POINTS[2]=7def0d
GUID_DISPLAY_COUNTED_OBJECTS[2]=7def0d

GUID_PLACE_OBJECTS[3]=18dd40
GUID_DISPLAY_COUNTED_OBJECTS[3]=7defee

The 1. one shows the counted items and points on two different items (objects).
The 2. one shows both at the same item.
The 3. one shows only the counted items (objects).

I would recommend writing the content of the description outside of the tabletop sim. in an editor, like notepad or notepad++ and to copy in into the description field. From my experience, it is the best way for a long description due the fact, that the description field seems sometimes a little bit buggy.


ADDED
  • get counted points and objects by function call
    a table is returned with the format table: { id = { POINTS = points, OBJECTS = objects }, ... }
    EXAMPLE CALL
    local objController = getObjectFromGUID("XXXX") -- replace "XXXX" by guid of the controller
    local countedObjPoints = objController.call("getCountedObjectsPoints" )

FUTURE TASKS:
  • implementing additionally a code based mode
    • for some cases, the description based controlling could be unfavorable.


If you find a bug, just let me know.
4 Comments
Jedius IX Bakka Oct 25, 2024 @ 9:06am 
Would it be possible to use this to count (and sum) objects/points from multiple sources? Like, have two different boards to place objects on and have the script show the value of points from those two boards combined?
I tried to look a bit at the script itself but yeah, even if I found out how to change the font and color, I have no idea how to manipulate the values.
_TheCarrot_ Jul 30, 2020 @ 12:45am 
Hello, I need help, can I make it so that instead of
COUNTER_OBJECT_POINT=X
was, for example:
Value=X
In order to write less and work with it easier:csgo_explosion:
AufderWelt  [author] Jun 28, 2020 @ 10:06am 
@LycanDragon you can use the calls

get counted points and objects by function call
a table is returned with the format table: { id = { POINTS = points, OBJECTS = objects }, ... }
EXAMPLE CALL
local objController = getObjectFromGUID("XXXX") -- replace "XXXX" by guid of the controller
local countedObjPoints = objController.call("getCountedObjectsPoints" )

to get the values. after that you can do whatever you want.
LycanDragon Jun 27, 2020 @ 11:04pm 
hi - is there a way to grab the values of these tokens and use it to run some additional code?