![]() Once source for your script is displayed, you may proceed to place breakpoints by clicking to the left of a line number in VSCode. Alternatively, you can right-click on a script (Main Thread) and chose "Pause" which will cause your script to break (and its source to be shown) as soon as possible. However, if an error is encountered execution will pause and than your code will be automatically displayed, you'll also see a stack trace on the left and be able to mouse over variables to see their values. As such, VSCode won't automatically display your code. Press "OK" to debug them all, otherwise deselect any scripts you don't want to debug, then press "OK".īecause Tabletop Simulator is loading several scripts from one workshop save, we unfortunately don't have file paths available to us (because all the scripts are coming from one file). You will now be presented with a list of scripts loaded within your mod. When prompted for a port, simply hit enter (we're using the default MoonSharp debug server port). Your scripts and UI should be nothing more than a single #include file or įrom the drop-down, select "MoonSharp". Note: Please don't only store your code in a TTS mod. Technically, you can open any directoy you chose, but if you want to do code editing in VSCode then you should have a dedicated directory somewhere. Launch VSCode and open (File -> Open) the directory where you keep all your Lua code. ![]() You probably also want EmmyLua and to configure the ".ttslua" extension to be treated as "lua" files. Once installed, disable automatic updates for the plugin.Ģa. If you have previously install the official MoonSharp plugin - please uninstall it first. Unfortunately, the setup process is a bit clunky.ĭownload the latest release of our enhanced MoonSharp VSCode extension and install it. If you get an error (red text) then you're still running the original MoonSharp TTS interpreter. If you see white text printed, you're not sandboxed. The simplest way to check this is to paste the following in TTS' chat window (in game): If you're running this enhanced MoonSharp interpreter, your Lua environment won't be sandboxed. On macOS application contents are hidden, right click on "Tabletop Simulator" and chose "Show Package Contents", then navigate to Contents/Resources/Data/Managed. From here it's platform specific, but you're looking for the directory Data/Managed, it is in this directory that you should drop the enhanced interpreter DLL (overwriting the existing file with the same name). To find your Tabletop Simulator directory, in Steam right click on TTS and chose "Properties -> Local Files -> Browse Local Files.". You may wish to backup the original file, however you can also retrieve the original by, in Steam, right clicking on TTS and chosing "Properties -> Updates > Verify Integrity of Game Files." which will cause the original DLL to be downloaded again. Once you've either downloaded or built the DLL, it's simply a matter of copying the DLL over the version distributed with Tabletop Simulator. (builds to src/MoonSharp.Interpreter/bin/Release/net35/MoonsharpDef.dll) Msbuild /p:Configuration=Release src/MoonSharp.Interpreter/ Msbuild /t:Restore src/MoonSharp.Interpreter/ We provide releases (available above), however, if you have Mono installed you can also compile this yourself with: Berserk Games have the sandbox enabled for a reason! How do I use this? You still won't be able to develop and distribute mods to end-users that aren't sandboxed because to disable the sandbox you need this DLL running on your computer.Ī Note on Security: It's suggested you only run Tabletop Simulator with this modified MoonSharp interpreter only for development (and perhaps hosting) of your own mods, and never when running someone else's code (e.g. As such, this fork also disables the sandbox for you. However, being in a sandbox can make development a bit frustrating (e.g. This is actually a good practice as Berserk Games are protecting users from distributing harmful mods. What we've done here is built a drop-in replacement, for TTS' MoonSharp DLL, which comes with VSCode debugging support pre-enabled.Īdditionally, Tabletop Simulator runs workshop mods in sandbox. However, the version of MoonSharp that ships with TTS does provide (limited) debugging capabilities, however the functionality has not been enabled within Tabletop Simulator. However, there's no official way to debug your workshop mods - if something goes wrong in your mod's Lua, there's usually a lot of trial and error trying to work out what is going wrong. There's even an official TTS plugin for Atom. Tabletop Simulator allows you to script your mods in Lua. This is a fork of MoonSharp the Lua interpreter utilised by Tabletop Simulator (and many other games) that has been modified to improve the Tabletop Simulator mod development experience. Tabletop Simulator Enhanced MoonSharp (with Debugging)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |