![]() The game has been translated with the help of google translate but we also added support for creating your own translations and sharing them on the Workshop. The headline feature is Tabletop Simulator now supports translations for all 29 languages supported by Steam. To avoid this, you could include an if … then test to not trigger the function if the object is a deck (e.g., if obj.tag = “Deck” then return end).Hey everyone it's been a while, but we have a huge patch for you guys today! For example, if you a*sign a number key it could conflict with drawing cards from a deck. One point of caution is that the key a*signed should not conflict with other hotkeys in the game. The objects could move around or be used in other ways without changing the selection. The benefit of the approach here is that the selection can stay in place indefinitely, until the actOnSelectedObjs() function is called. For example, they would move around together. However, that would cause all the selected objects to be grouped for other purposes. You could use the getSelectedObjects() function in the TTS API in a similar way. Note that because the table uses guids as the keys to the table, you must use pairs and not ipairs to iterate through the table. Alternatively, the table could be copied to another variable or pa*sed to another function. In this example, the table is set to empty after the action occurs. ![]() When that point is reached, the action can occur on all the objects in the selection. That way, the player can change the selection up until a certain point. To make this work, the script should call the actOnSelectedObjs() function only when the player has finished adding or removing objects from the selection. It allows the onKeyPress() function to work as a toggle. This example shows a globally-defined table that the function iterates through.Īlthough many say that global variables should be avoided, one is useful here. The actOnSelectedObjs() function is a function you write to do whatever needs to be done with the selected objects. The tags and highlighting are optional the function would still work without them. And for visual flair, it highlights the selected objects in red. The script also shows how to use the Tag feature in TTS for the selected objects. If the guid of the object is already in the table, the function will remove it from the table by making its value nil.Īs shown, you could include other tests to apply before adding the object to the SelectedObjs table. (Adding the guid as the key in the table makes it easier to test whether that guid is already present). If an object has not been selected, the function will add the guid of the object to a globally defined table called SelectedObjs. In this example, the onKeyPress() function will work as a toggle. It will happen when the a*signed key is pressed. The onKeyPress() function is a function you write. If not, then if the player presses the key while the mouse is not hovering over an object, TTS may throw an error. You must use the “if obj then …” test here. There are other features described in the API. The addHotkey() function pa*ses the color of the player pressing the key and a reference to the object. You could define the entire function here, but you can also refer to a function defined elsewhere, as shown. The second parameter is the function that will be called when the a*signed key is pressed while the mouse is hovering over the object. The first parameter sets the name that will appear for this action in-game, in the Options | Game Keys menu. To set up this feature, this function must be included in the onLoad() function in the Global script (it will not work if you put it somewhere else). The addHotkey() function is in the TTS API. Another function can take some action on the selected objects. ![]() It allows the players to hover over an object and press an a*signed key. This script uses the Game Keys that are configured in-game under the Options menu. And there is the matter of putting them back. When players put objects in the bowl, they are automatically counted.īut it can be awkward to move a lot of objects. MrStump created a mod called the Counting Bowl that serves this purpose. This intermediate guide a*sumes basic knowledge of lua scripting.Ī scripted game may need to count objects selected by the players, or take another action on a group of objects they select. Use the TTS Game Keys feature to select objects and group them for counting or other purposes. ![]()
0 Comments
Leave a Reply. |