TTS Scripting Tutorial Part 1
If you are a tabletop game developer or a board game enthusiast wanting to enhance your mods with limited to no coding experience, this is the series for you! This is a 4 part tutorial for beginners looking to learn the basics of scripting for TTS. We will walk through everything from basic concepts and terminology to navigating the TTS scripting editor to putting your new knowledge to use! Learning to code can be daunting but hopefully, through this series, we can simplify the more complicated concepts and show you some tips and tricks to be successful in adding scripting to your mod.
In part 1 of this series, we will be sharing a brief overview of what scripting is in the context of Tabletop Simulator.
Tabletop Simulator is a physics-based sandbox with a lot of built-in functionality for playing tabletop games such as cards, dice, and other components. But Tabletop Simulator goes a step further by allowing users to customize their mods with their own programming through a scripting interface. This allows users to implement features beyond what Tabletop Simulator itself provides.
TTS Customization Tools:
There are two tools provided by Tabletop Simulator to enable this customization:
Access to a Scripting Language - In the case of Tabletop Simulator, this is Lua. Lua is not created by, or exclusive to, Tabletop Simulator, but understanding its usage will be important when writing your own scripts.
A Scripting API - This “Application Programming Interface” defines all of the functions provided by Tabletop Simulator that allow the user to manipulate the game environment with custom code. The full documentation for the Scripting API, which details all of the functions and how to use them, can be found on the Tabletop Simulator website: https://api.tabletopsimulator.com/ .
The Lua scripting language is what will let users structure the logic of their custom functionality, while the functions from the Scripting API are what the logic will utilize to actually affect the Tabletop Simulator environment.
If you are new to programming, it is important to understand that, just as human languages have rules about proper grammar, programming languages like Lua have specific rules of usage known as syntax. If you break these rules, your Lua code will fail to execute and result in a syntax error. Any errors in your code will appear in the Tabletop Simulator chat.
You can pick up a lot of Lua basics from the examples in these tutorials, but it may be beneficial to supplement with some Lua-specific instruction. You can find many Lua resources online, but we have linked one guide written from the perspective of a Tabletop Simulator user HERE.
That completes our high-level overview of scripting in Tabletop Simulator! In the next tutorial, we will dive into the Scripting Editor which serves as the interface for writing your scripts.
About Ryan!
Ryan works by day as a Software Engineer but has had a lifelong interest in game and puzzle design. He creates videos for game designers on his Ludo Lodge YouTube channel, develops video games with his older brother as Bullet Squid, and dabbles in tabletop game design with Tasty Humans being his first published board game. You can check out Ryan’s portfolio on his personal website, or follow him on Twitter.