-
Notifications
You must be signed in to change notification settings - Fork 27
Commands
These commands are accessible via Atom's Packages->Tabletop Simulator
menu, or via the right-click Tabletop Simulator
context menu. You may assign your own keyboard shortcuts to them in your keymap.cson
file (use the command name listed under the command title).
tabletopsimulator-lua:getObjects
Downloads all existing scripts in a loaded Tabletop Simulator game. When you activate this command the state of the table will be transferred to Atom - the location and size of all objects in the game. When you subsequently do a Save And Play
it is this state that will be restored in Tabletop Simulator; i.e. no matter how your script changes the objects in the game (or you manually edit the objects in the game), they will be restored to this condition when you Save And Play
. If you make changes to the game in TTS and wish to keep them you have to do another Get Lua Scripts
to store those changes in Atom.
tabletopsimulator-lua:saveAndPlay
Save all open scripts and send them to Tabletop Simulator, as well as restore the state of the game to that which was stored on the last Get Lua Scripts
. By default this will close all open scripts, though this behaviour can be changed in the package settings.
tabletopsimulator-lua:openSaveFile
Opens the TTS save file for the active game, allowing you to manually edit it. Warning! Only do this if you know exactly what you are doing; making a backup of the file before overwriting it would be a good idea.
tabletopsimulator-lua:gotoFunction
Displays all functions in the current script and in scripts #included by it. Typing a function name will filter the view, and hitting enter
will open the relevant file and set the cursor at the start of the function.
If you type a number then it will jump to that line number instead (this command replaces the normal Go To Line shortcut). You may type a +
or -
before a number to jump that many lines relative to your current row.
If you are using the experimental #include feature and use this command while inside a file which #includes other files it will work out which file/line it would be in and go there instead (i.e. if Tabletop Simulator has told you an error occurred on row X you can type X to go to the correct row, even if it's in an #included file).
tabletopsimulator-lua:jumpToFunction
Jump the cursor to the start of the function whose name the cursor currently resides in, if one exists. Otherwise it will open the Go To Function
dialog with the cursor text automatically entered.
tabletopsimulator-lua:gotoLastError
Jump the cursor to the file and row of the last error reported by Tabletop Simulator.
tabletopsimulator-lua:displayCurrentFunction
Flash a notification popup displaying the name of the current function and its location (as well as any parent functions). Useful if you would like this information but don't want to turn the status bar function display on.
tabletopsimulator-lua:selectFunction
Selects the function the cursor currently resides in. Repeating will select the parent function, if present.
tabletopsimulator-lua:expandSelection
When used with no selection will select the control block of code currently around the cursor. Repeating will expand the selection to the current block's parent.
tabletopsimulator-lua:retractSelection
The negative operation of Block Expand Selection
.
tabletopsimulator-lua:toggleSelectionCursor
If the cursor is at the start of the current selection then move it to the end of the current selection (while still maintaining the selection), otherwise move it to the start of the selection.
tabletopsimulator-lua:executeSelectedLua
Send the code currently selected in Atom to TTS for it to run. Note that this does not affect the save file in any way; it only affects the current runtime. If you do this within an object editor then the code will run under that object, otherwise it will run globally. If you tell it to return a value (i.e. if the last statement in the block is a return statement) then it will be sent back to Atom and displayed to you there (and logged to console).
tabletopsimulator-lua:generateGUIDFunction
This will open a dialog in which you may select object types; hitting one of the Generate
buttons will then insert a block of code with the GUIDs pulled from your game for those types. Formatting of the code can be controlled in the Style
area of the package settings. Coupling this with the Highlight GUID Objects
setting is recommended for maximum ease of variable naming, though you will need to run TTS in windowed mode if you don't have two monitors.
Tabletop Simulator by Berserk Games: Knowledgebase | Forums | Forum post for this package