Console
Console copied to clipboard
Adds console commands to your Tabletop Simulator game
Console
A Console module to add textual commands to your Tabletop Simulator mods, generally for debugging. console.ttslua provides the basics needed to add commands to your games, and console++.ttslua is an example module which adds a full debug system for accessing and monitoring your program's structure.
console.ttslua
Console module, allows you to add commands to your Tabletop Simulator mods. Commands are prefixed by a > (though
you can change this to w/e you want). You can also add validation functions to check the messages
players are sending.
Built-in console commands:
help/?Lists available commands or provides information on specified commandinfoDisplays help on all available commands. Alias forhelp -allaliasCreates an alias of another command with preset parametersechoDisplay textclsClear console text=Evaluates the specified expressioncmdEnter command mode: no longer required to type>before commandsexitExit command mode>Type this on its own to toggle command mode
Main functions it gives you access to:
console.add_validation_functionAdds a validation function all chat will be checked againstconsole.add_player_commandAdds a command any player can useconsole.add_admin_commandAdds a command only admins can use
console++.ttslua
Example module demonstrating how to use the base module, though this is a useful debug tool in its own right and will become more feature-rich over time.
The runtime envirorment is treated like a filesystem, allowing you to view and access global variables. Included commands:
ls/dirList tables, variables, objects and functions at your current location or location specfied.cdChange the table you are currently located in.cd..Change the table you are currently located in to its parent.addAdd a variable or table.setSet the variable specified to the value specified.tgl/toggleToggle the boolean variable specified.rm/delRemove the variable specified.callCall the function specified. You may then store the result withsetoradd.~Display result of most recent function call or expression evaluation.execExecute a series of commands.watchWatch a variable or object; display it if it changes.shoutBroadcast a message to all players
All commands in console++ except shout are locked to admin players only.
Also includes simple swear-word blocking message validation.
Installation
If you are using Atom with the TTS plug-in then put console.ttslua and console++.ttslua in folder <your user folder>/Documents/Tabletop Simulator/Console, and then in your code you can simply write #include Console/console or #include Console/console++ (be sure to enable the #include feature in the package settings).
If you're using a different editor then you can simply paste the code for console.ttslua into your own. If you want to use console++.ttslua then paste it below that, and remove the #include console it starts with.