Tabletop Simulator

Tabletop Simulator

View Stats:
calgorn Aug 21, 2017 @ 10:50pm
Lua Editor Assistance
I have recently started using the Lua Editor to create character sheets for my game that people can edit since TTS won't support anything larger than a notecard. I have some prior experience with HTML so while I am not advanced in coding I can understand some of what I see when I edit scripts.
The difficulty I am having is when I need to add something in. I tried looking online broadly, on Beserks website and even here in forums and there is little information about Lua and very brief or poor guides. It is difficult to find basic scripting commands that say xx.xx does this.
The Lua Editor doesn't seem to like commands from other scripting languages so this creates a barrier to learning Lua scripting.
In the short term if someone can help me find a script command that allows me to tell the text fields to align Left instead of defaulting to Centered that would be appreciated. I don't want the text running off to the left off the edge of the document but can't find any help on this topic.
< >
Showing 1-6 of 6 comments
Eskander Aug 22, 2017 @ 6:28pm 
a couple of notes from my experience:

text tools in the game are frustrating; they don't bind to objects, so if you want a sheet that can be moved around, you're better off using buttons as text fields.

if you create a button, use the label as the text you want to display, and set the size of the button to '0' for all dimensions, and the click_function as a token null function like "function null() end" or whatever you choose to name it.

you'll still run into the centering text issue as I 'm not aware of an align left/right param for any text related objects.

there's some char sheet examples on the workshop. if you want to see a really complicated one, look at KDM achromatic or scripted versions.
calgorn Aug 23, 2017 @ 9:08am 
I actually did just that. I copied the script from some of those existing sheets like the KDM and pasted it to my custom board with my character sheet. I edited it to remove the extras I didn't want, I adjusted the coordinates to get the fields where I want so I have the edit button to add text to a spot. The only barrier now is the text centering. If there is no way to force it to align then I guess I will have to adjust the coords for them to be centered in the box and just let people put spaces and such to make sure nothing spills over.
Markimus Aug 23, 2017 @ 12:51pm 
Text fields are in the works. If you can wait until next update they'll likely have them included. They'll work similarly to buttons, so you'll be able to attach them to objects and such.
Last edited by Markimus; Aug 23, 2017 @ 12:51pm
calgorn Sep 2, 2017 @ 5:43pm 
So they added a script that has to do with text boxes but no information on how its used so no help at all. I really need to find something that works since I found additional problems with the custom button text field thing that the KDM sheets are using. Works find for single line items like character name, race, etc. Not so great for larger fields like a list of equipment or in game notes. Not only does it center text horizontally but it centers it vertically too. It also limits the number of lines you can see on the token to only 3 or 4. Less than you see with a notecard so any decent list of items becomes a pain to list. On top of after you edit it 2 or 3 times suddenly TTS develops an error where the area you are editing no longer matches where your cursor is.
Dudrie Sep 3, 2017 @ 6:10am 
They have a documentation on their LUA api and all functions you can use (and "where"): http://berserk-games.com/knowledgebase/api
For every function you have a short text that explain what it does, what it returns and which parameters the function "accepts".

To add an input field (aka text field) to an Object use the createInput(parameters) function of the "Object"-Class - have a look: http://berserk-games.com/knowledgebase/object/ (they are found right un the "UI Functions" section.

I have not used these in a project but maybe the suit your need.

Maybe you can look on Google or YouTube if you find some general Lua tutorials if you want to learn the language. I don't have a tutorial at hand, sorry :( But if you know how Lua works (at least the basics) you can simply "add" the information from the documentation mentioned above.
calgorn Sep 3, 2017 @ 10:11am 
Mr Stump created a text field that was exactly what I was looking for. Customizable alignment and no token editing.
Character Sheet Template by Mr Stump in the TTS Workshop was everything I was looking for.
< >
Showing 1-6 of 6 comments
Per page: 1530 50

Date Posted: Aug 21, 2017 @ 10:50pm
Posts: 6