Tabletop Simulator

Tabletop Simulator

Button Visualizer - Now works with Inputs!
67 Comments
Unreal Ed 22 Sep, 2021 @ 1:45pm 
You'd have to make the button call a function that uses one of the looping effect functions. See https://api.tabletopsimulator.com/behavior/assetbundle/
BA|Oddbod 12 Feb, 2021 @ 2:02pm 
This is great!

However, I'm getting an error when I try to edit an object that I've already added some input fields to (using data from the tool). I can move them around using the arrows on the controller, but if I try to type in the position field (which worked when initially creating one) I get this strange error and the object disappears:

Error converting Lua Table entry position to Type UNityEngine.Vector3 on Class LuaUIInputState. Value = MoonSharp.Interpreter.Table. (Error converting Table to Vector, (x,y,z or 1,2,3))<2>

Any thoughts?
a.f.waltz 3 Feb, 2021 @ 6:32pm 
Not sure if anyone else has brought this to your attention, but there is a slight bug with the tooltip input. Regardless of what's put into that field, the export text just puts the label as the tooltip. Just FYI. This mod is an absolute lifesaver!
Nomadicus 25 Jan, 2021 @ 12:32pm 
Ok thank you very much. I'll try that out.
Unreal Ed 25 Jan, 2021 @ 9:18am 
@Nomadicus: The data that gets exported needs to be saved in an object's script into a Lua table and then, in the onLoad function, you put the table into the parameter for self.createButton(). Here's an example with 2 buttons:

function onLoad(save_state)
local data = {
click_function = "setupLeft", function_owner = self,
label = "Choose\nLeft", tooltip = "Choose Bad player",
position = {0.6, -0.3, 2.5}, rotation = {0, 0, 180}, scale = {0.2, 0.2, 0.4},
width = 2600, height = 1600, font_size = 700,
}
self.createButton(data)
data = {
click_function = "setupRight", function_owner = self,
label = "Choose\nRight", tooltip = "Choose Good player",
position = {-0.6, -0.3, 2.5}, rotation = {0, 0, 180}, scale = {0.2, 0.2, 0.4},
width = 2600, height = 1600, font_size = 700
}
self.createButton(data)
end
Nomadicus 23 Jan, 2021 @ 3:58am 
I cannot get this to work to save my life. Clearly something more is required than "copy and paste." Does the exported data need to be inserted inside of some function or something else? Because just copying and pasting off the note card onto an object and running Save & Play doesn't work for me.

And yes, I know how to properly save/load your own copy of a table. I've successfully installed scripts to auto-shuffle decks of cards so I at least know that much. But I am very very green with this stuff. Like, if LUA was a spoken language, I'm at the "Hello my name is..." stage of learning.
maximo1984 15 Jun, 2020 @ 1:56am 
The Button Visualizer is no longer exporting all of the data. For example, "font_size and width". Any idea why?
Unreal Ed 14 Feb, 2019 @ 5:47am 
Any update on a version that works with the UI?
machineguy 13 Feb, 2019 @ 3:12pm 
Amazing tool. Thank you so much.
Jonathan Daar 13 Sep, 2018 @ 1:35pm 
This was so helpful thank you!!
Used in Time Barons
https://gtm.steamproxy.vip/sharedfiles/filedetails/?id=1505924807
Unreal Ed 16 Jul, 2018 @ 3:03pm 
Amazing! Can't wait! Hopefully, it will get people to start making mods with the new UI, because I'm seeing surprisingly few mods with it, despite how awesome it is
GiantDwarf01  [author] 16 Jul, 2018 @ 11:34am 
@Unreal Ed, I am actually working on such a tool now. Not sure when I'll be done (since it's a bit trickier dealing with the XML than buttons) but it should be completed soon.
Unreal Ed 16 Jul, 2018 @ 7:24am 
@GiantDwarf01, any chance you'll make a tool like this one that uses the new XML UI?

It would be super awesome, especially for on-screen UI (though it would easily be able to move that XML from on-screen UI to obect UI)
Unreal Ed 16 Jul, 2018 @ 7:22am 
You have to make sure that: 1. You're using a save. So just create a save, and load it. then paste your code and Save and Play. 2. make sure you're pasting the code in the part meant for code, not for XML. XML is used for UI, not for any sort of logic code like buttons (that this tool creates)
TheCrimsоnFакер (aka Alucar 15 Jul, 2018 @ 12:29am 
Ок, I'm total 0 in LUA scripting, so I have a problem. What I want is to add editable text box to custom tile. Here's the steps:
1. I'm loading my tile (Character sheet);
2. Creating input box in the location I need and clicking "export data" or "export all"
3. ctrl+c text written on the note;
4. loading custom table and then adding my char sheet to it;
5. in scripts ( right click + edit scripts) I'm adding created script. ''Save and Play''
6. Nothing happens. I tried to save this table and add script, but with same result.

couple of questions then...
What am I doing wrong?
what is "Tooltip"and "Value"
Unreal Ed 24 Apr, 2018 @ 1:08am 
Have you considered allowing the visualizer to export the button data in a (or several) notebook pages? The advantage of this would be that you could include line returns as part of the export text.

I still adore the tool, but the worst part about it imo is having to go over the really long lines to add the line returns after each comma manually, so saving that time would really make this tool truly lightning fast at implementing buttons

Ideally we could choose between cards and notebook pages for exports. Some ppl will prefer text in 1 line or might want to keep their notebook clean
Ukilop 14 Apr, 2018 @ 1:44pm 
same here, i use this thing pretty much DAILY i love it, btw i tried editing a copy of itself and i ended up with this: https://imgur.com/a/RwNzg
im tempted but scared to click export all
Unreal Ed 9 Apr, 2018 @ 10:30am 
Another light "bug" is that if you start editing an object with inputs on it already, the inputs get set to buttons by default, so you have to change them back to inputs manually, which is kind of annoying. I'd imagine that would be an easy fix too

I'll take this moment to reiterate that this is one of the best mods on TTS. I use it so often!
Unreal Ed 6 Apr, 2018 @ 12:00am 
I got a bug where all the values of the label, tooltip, and "value" for an input were all exported as what was entered for "label"
GiantDwarf01  [author] 19 Nov, 2017 @ 3:05pm 
You can insert the GUID of an object you want to put a button/input on, edit it's appearance, and once you're done, export the data so you can use obj.createButton() or createInput() so you can more precisely create buttons for your scripts.
Top Bloke Gman 19 Nov, 2017 @ 12:17pm 
So we have a button on the table. What generic purpose would such a feature have? The game is quite full of buttons as-is.
GiantDwarf01  [author] 19 Nov, 2017 @ 4:54am 
Ha well im glad it's useful for ya ha
tieren 18 Nov, 2017 @ 8:31pm 
For modders like me. this is amazing. thank you
Unreal Ed 14 Nov, 2017 @ 1:39pm 
(idk if that was a joke or not)
It's a tool that helps you create buttons for scripting without having to do it in the code and switching back and forth between your code. It's very handy to placing and prettifying buttons
Top Bloke Gman 14 Nov, 2017 @ 6:19am 
Ok. Interesting. Informative.

But what does it do?
Unreal Ed 11 Nov, 2017 @ 6:55am 
Yea it's a great tool. I think tools, in general, should be featured more often
GiantDwarf01  [author] 10 Nov, 2017 @ 9:57pm 
:D Yay thanks!
Kimiko 10 Nov, 2017 @ 5:54pm 
Your mod has been chosen for this week's Spotlight!
GiantDwarf01  [author] 3 Sep, 2017 @ 4:07pm 
A few minor changes plus a few big ones - Labels, Tooltips, and Values now support line breaks (Enter/Return) so you have more room to write what you need to,
Unreal Ed 3 Sep, 2017 @ 12:26pm 
I found out that when you press enter in an input field the characters "\n" get added to the string. You can use that to have an input field react to pressing enter by analyzing the string. For the button visualizer it'd be good to have this on the first input field that prompts you for the object's GUID
Unreal Ed 2 Sep, 2017 @ 10:39pm 
Oh wait, one more thing: When you clear the link to the object you're editing, the color buttons don't get destroyed. That means that when you start editting another object another set of "color pellets" get created, which gets confusing
Unreal Ed 1 Sep, 2017 @ 2:22pm 
Ohhh yea that's right, it IS the broadcasting that needs a color!
GiantDwarf01  [author] 31 Aug, 2017 @ 11:15pm 
Alright - so the toggle button error occurs if you have the input select open while addign a new button, the other error didnt have anything to do with color - rather the way TTS likes it messages (Why they don't defult to white is beyond me). Quotation marks are fixed aswell
Unreal Ed 31 Aug, 2017 @ 9:49pm 
The click_function is also missing its quotation marks.

Also, if you're editing an object that already has buttons it still adds one, which i don't think it should do, especially since you can't remove a button from the list. Using the tool simply to edit existing buttons is a very valid use of the tool.
Unreal Ed 31 Aug, 2017 @ 9:11pm 
That error is because of the colors that you put in are only {r,g,b} whereas the actual color Table in TTS is {r,g,b,a} (for alpha). See here [berserk-games.com].

For the copy/paste buttons, "data" made me think of the data of all the buttons. I think "values" would be a bit more clear, personally. As for tooltips something like "copy all the values of for this button" and "Paste in all values copied from another button"

Also found a couple other (important this time) problem: The text on the buttons and tooltips that gets printed in the exported notecards don't include quotation marks to make the text strings. Also, i think notecards have a character limit, and the colors/font_colors print with huge decimal values. These huge values tend to hit the notecard character limit, thus cutting out the tooltip strings short decently often. I don't think we need that many decimals for colors...
GiantDwarf01  [author] 31 Aug, 2017 @ 6:50pm 
The converting table to color is a weird TTS error that I been trying to track down - as far as i can tell it doesn't actually affect anything. Can't toggle button - when did that occur?

Not entirely sure how I can make copy and paste data clearer - it copy and pastes the button data.

Scripting shortcuts aren't supported yet as far as I know - you can script the num button checks but not other buttons yet - hopefully they can allow for that in the future.
Unreal Ed 31 Aug, 2017 @ 3:38pm 
Also getting lots of errors about "error converting Table to Color (r,g,b or 1,2,3)" and also got one about "<Error> Can't toggle button [select_button8]"
Unreal Ed 31 Aug, 2017 @ 3:01pm 
Also some tooltips explaining what your buttons do, specifically the ones in the bottom right, as I wasn't sure which one was Paste Data and Copy Data
Unreal Ed 31 Aug, 2017 @ 10:54am 
Only few suggestions I have now is that when you click the button to put down the list of buttons is to change the color (slightly grey out) of the one button we're currently editing. Very minor tbh. Love all the changes!

Also, I wish we could have a scripting shortcut so that we can cycle between each of the inputs. I'm not sure if that's possible, but if it is id totally put one shortcut to Tab so that i can cycle between them, coz I just have that reflex when editing lots of inputs like this.
Unreal Ed 30 Aug, 2017 @ 5:47pm 
Looks amazing! Thanks for the update!
GiantDwarf01  [author] 30 Aug, 2017 @ 5:20pm 
The update is out - A much improved version of my Button Visulaizer!

Inputs are now working. Much finer control over Values is there. And other minor improvements for editing.
GiantDwarf01  [author] 26 Aug, 2017 @ 1:33am 
So the new input buttons are actually going to allow me to update this tool with some pretty mayor improvements - more control and features. So look forward to that. I'm rewriting the tool practially from stratch so depending on a few things I'll hopefully be able to get it done in the next few days.
GiantDwarf01  [author] 25 Aug, 2017 @ 7:59pm 
I just saw the update and was planning on doing just that ha - I may release it as a seperate mod depending on if I can combine buttons and inputs in one tool or not. We shall see
Unreal Ed 25 Aug, 2017 @ 7:52pm 
Will you update the tool for the input buttons that were just added to TTS?
Unreal Ed 20 Jul, 2017 @ 7:48pm 
It's probably not a bug with TTS or even Unity really. That sounds like a floating point calculation error. The way it works is similar to how with our decimal system we can't really divide 10 by 3. You just get 3.33333... Well with 1s and 0s, similar stuff can happen. I would see it sometimes in Unity when working on stuff. It's annoying but just a reality of programming.

One thing you might be able to do for the 5.99999999 problem is cut it off at a certain number of decimals, instead of rounding to the increment unit. So you'd always cut off the number after 5 or 6 decimals (coz who needs smaller precision than that anyway?). I'd expect that to be part of Lua's math class
GiantDwarf01  [author] 20 Jul, 2017 @ 1:31pm 
Those are some good suggestions. I've been a bit hesitant to reorganize all the buttons again, since even with the tool, it is 70+ buttons ha. But I could potentially get around to it. For the smaller increments last, that's something that I would do, but for some reason TTS is weird with certain numbers - going from 5.9 to 6 or something will make it read 5.999999999999999, so to fix that I round it to the current increment unit. It's a really annoying bug or glitch but idk how to work around it currently.
Unreal Ed 14 Jul, 2017 @ 3:27pm 
One more thing (and this one could be up for debate): If you set a value to be 1.5 for example, and then decrease its value by 1, it should go to 0.5 (not 1, like it currently does).

The way it works right now means you kind of HAVE to do smaller increments last, whereas if we did it the way I suggest, you could do smaller increments first and then bigger ones. Or not ! You'd have the choice!
Unreal Ed 14 Jul, 2017 @ 3:23pm 
I generally find i want a specific increment amount for position (from 1s to 0.1s), another for rotation (from 1s to 10s), another for scale, and another for button size/font size (usually 100s). So i think it would be nice (and make sense) to have an increment number for each of them.

If you did add those specific increment numbers, I think it would be good to re-organize and give a bit more room to the visualizer. Maybe make it larger, have 4 columns (1 for: position, rotation, scale, button stuff), each with their own increment above or below. I also wouldn't mind if the x/y/z labels were color coded.

The increment amounts should stil have the same range they have now, but maybe they could default to 1s for positon, 10s for rotation, 0.1s for scale, and 100s for button stuff. At least that's my suggestion
Nedok 14 Jul, 2017 @ 5:22am 
I do have to congratulate. You have created an awesome tool!

Just one question...
Why using floating buttons on the Tool?
I do believe that 0.14 shod be quite a good value for the height (y).
Aurik 10 Jul, 2017 @ 12:57am 
Super helpful! Awesome work!:steamhappy: