Scripting in Tabletop Simulator - Intro for Beginners

  Рет қаралды 55,704

Ludo Lodge

Ludo Lodge

Күн бұрын

Introduction to the basic concepts related to scripting in Tabletop Simulator. Full Prototyping in Tabletop Simulator playlist here: • How to Prototype in Ta... .
Scripting in Tabletop Simulator allows you to add your own functionality, automating process like setup and upkeep, and making it easier for players to enjoy their experience. This video introduces some of the basics of scripting, intended for beginners with no prior programming experience.
Tabletop Simulator Website: www.tabletopsimulator.com/
Tabletop Simulator Scripting API: api.tabletopsimulator.com/
Tabletop Simulator LUA Tutorial: steamcommunity.com/sharedfile...
SUBSCRIBE for more content that sparks growth in your journey as a game designer.
0:00 Intro
1:16 What is Scripting in TTS?
4:44 TTS Scripting Editor
8:18 Basic Terminology and Concepts
13:22 Printing to the Chat
19:37 Randomize Die on Load
21:21 Click Button to Roll Die
30:38 Outro

Пікірлер: 95
@Lavoye
@Lavoye Жыл бұрын
You've got to be one of the best teachers I've ever seen. Very structured and not skipping a thing. All that with a good flow. Well done sir!
@SuperWaistcoat
@SuperWaistcoat 3 жыл бұрын
Bruh, my project was to make a button that makes the die roll and I never thought I'd find a video so straightforward. Thank you!
@Spyderjav
@Spyderjav 3 жыл бұрын
Dude, this is my first Intro to coding ever, and you made it totally accessible and easy to understand. The good people who developed TTS need to pay you to help game designers!
@saxman7575
@saxman7575 2 жыл бұрын
Just starting to learn different programming languages, I definitely appreciate hearing about the best practices upfront! I look forward to watching more of your videos and getting a lot more out of TTS!
@PhonicNoteStudio
@PhonicNoteStudio 3 жыл бұрын
My first introduction into Lua Scripting for Tabletop Simulator and it was a fantastic time of learning how it's all done. I first saw just how far it could go when someone made Catan a long while back, along with another person who added auto resource card distribution to their version, and it really sparked the interest in me to make my own stuff like that. I really liked the video and enjoyed going through the whole process and even having a few bumps and figuring it out on my own. Eventually, I started experimenting with some of the lines of code, trying to get the button to roll two dice at once. Haven't quite figured it out yet, though... I definitely intend to go through the rest of your videos to better learn how I can do more of this in the future. This was really helpful. Thanks a whole bunch for opening the door to a really fun experience.
@jjsoety
@jjsoety 2 жыл бұрын
Outstanding series for learning scripting from scratch. I tried to digest the TTS wikis, but found that they assumed too much for the non-coder and skipped lesson one. But here you demystified the API calls and basic function design so anyone could understand. And from that basis, the entire library opens up. Then you went above that and showed practical game applications that anyone could apply. If I were TTS, I'd link your videos into the documentation, since they are a great showcase of the app and a great intro. Well done.
@DarkshanubiMedia
@DarkshanubiMedia 5 күн бұрын
Great video, looking forward to going through the rest of this playlist. I am building up to scripting my own board game, which would need to feature things like drawing cards equal to the remaining HP a player has. And somehow figuring out how to script damage tracking across the entire game. Hoping your videos can help me build the foundation I will need to tackle this.
@SlendySWIRS
@SlendySWIRS 2 жыл бұрын
Ryan: "Nothing I do in this session is gonna be particularly useful" Practically everyone who got up to this point: "I just got 19 minutes of proof against that statement" ;) But seriously, this video is so educational and so clearly explained at the same time which makes it a great tutorial for everyone! Absolutely recommended!
@jasongravitt5565
@jasongravitt5565 Жыл бұрын
Best practices I wish I knew back when I started! Love it. Spot on job, I look forward to learning more.
@mikeritter7629
@mikeritter7629 2 жыл бұрын
29:33 i just love how realistic this tutorial is made, even the "standard protocol" of implementing new code is shown :D Jokes aside, very good video! It helped me a lot already
@andrewwilson895
@andrewwilson895 3 жыл бұрын
THANK YOU. I look forward to more scripting tutorials.
@joerihessels8230
@joerihessels8230 3 жыл бұрын
Thanks for the introduction Ryan! Looking forward to a tutorial on automatic setups :)
@marcusburnham9920
@marcusburnham9920 3 жыл бұрын
Hey Ryan, thank you so much for these videos. They're really well made and really useful.
@caryxiao1603
@caryxiao1603 3 жыл бұрын
Pretty awesome introduction. I have always felt a little intimidated using Lua since I was a child because my little kid mind years ago tried to mod a game that's in Lua. Didn't realize it was that much similar to a lot of other programming languages I'm now used to writing in.
@Duke_Blitzein
@Duke_Blitzein 3 жыл бұрын
This is great! Thank you Ryan. I made my first button! and it's working. I got snagged for a little bit because I had (a) captial/s on the "F" and or "E" on function and end.
@mrreddragon4164
@mrreddragon4164 3 жыл бұрын
Thanks for making these videos, they were a big help in getting me started in modding for TTS
@DaleHarty
@DaleHarty 2 жыл бұрын
This is so very helpful and the way you presented the info is so elegant. Thanks so much.
@creepincat7399
@creepincat7399 2 жыл бұрын
Great introductory video. Thank you
@mFurb988
@mFurb988 3 жыл бұрын
Wonderful, great first look at scripting of tabletop simulator thank you.
@WegderPain
@WegderPain 7 ай бұрын
Really really well done tutorial! I am looking forward to the next videos
@WhiteGaming5883
@WhiteGaming5883 2 жыл бұрын
definitely awesome intro to scripting in TTS~!
@jesusmaldonado4596
@jesusmaldonado4596 3 жыл бұрын
Thanks for the video, it was really helpful and you're a very nice teacher.
@koyapachi
@koyapachi Жыл бұрын
Very understandable. You are a great teacher!
@TheFowo
@TheFowo 3 жыл бұрын
Thanks for the series mate! I've been slowly learning scripting throughout last week to script my card game (ideally it'll go to my portfolio to secure that game design job one day). Found your channel today and looks like lots of useful information that will significantly speed up that process. Keep up the great work!
@middleclassjoe
@middleclassjoe 3 жыл бұрын
Great intro, Ryan. It’s the series I’ve been waiting for and I’m really looking forward for what’s coming next. A couple of things I’d like to see: Auto setups Exploding dice Auto score calculation
@LudoLodge
@LudoLodge 3 жыл бұрын
Great suggestions Joe, thanks!
@middleclassjoe
@middleclassjoe 3 жыл бұрын
@@LudoLodge I'll add one more: Is there a way to turn off the auto rotation of cards as they move into and/or out of decks? (For games that use card rotation to represent various cards states). Thanks again for all your hard work.
@Zaki-pi9kq
@Zaki-pi9kq 3 жыл бұрын
thank you so much for these videos.
@tommcfly2731
@tommcfly2731 Жыл бұрын
Thanks, very useful.
@connorjensen9699
@connorjensen9699 3 жыл бұрын
great video!
@LeeHeluo
@LeeHeluo 2 жыл бұрын
This tutorial is helpful and easy to understand for a noob like me haha, hope you will make more video about script OuO.
@reissarud
@reissarud 3 жыл бұрын
Thank you !
@captaindragon
@captaindragon 3 жыл бұрын
pretty awesome introduction, if come with more projects, it should be better.
@ciitrix3529
@ciitrix3529 3 жыл бұрын
Nice video 😁
@FerintoshFarmsPhotography
@FerintoshFarmsPhotography Жыл бұрын
I'm totally going to add function onload to randomize the POI's in the flashpoint mod i'm modding.
@herrvorragend325
@herrvorragend325 3 жыл бұрын
thanks, appreciate it =)
@tuff-luck4946
@tuff-luck4946 3 жыл бұрын
That was good, I’m well beyond beginner at this stage, but everything you explained was clear and easy to follow. Looking forward to some more advanced ideas. My current weakness is xml UI coding. It doesn’t come natural, and I just have to keep iterating until I achieve what I want. I can’t seem to visualize the code the way I can LUA.
@merezko4339
@merezko4339 3 жыл бұрын
As do I buddy, I can't get my head around the XML, I've done some cool things for my card games but I still can't figure it out, if Ludo could do some tutorials on that I'm subscribed so I can watch those soon hopefully
@FabioSpelta
@FabioSpelta 3 жыл бұрын
@@merezko4339 lol you're the gui of the mtg importer
@merezko4339
@merezko4339 3 жыл бұрын
@@FabioSpelta Yep that's me! the one with my face on it :D
@adrianwaynereavill7899
@adrianwaynereavill7899 2 жыл бұрын
Good video
@pirincio2015
@pirincio2015 4 ай бұрын
Hi, I saw your video today: just a I hope useful note for everyone: Atom editor no longer support tabletop plugin.
@rszarvas
@rszarvas 2 жыл бұрын
Great tutorial, thanks! It possible to change a specific custom model's color after clicking the button? I'd like to change a lightbulb color for 5 seconds after the button is pressed.
@wishmeheaven
@wishmeheaven 2 жыл бұрын
Thank you very much for this video. If I dream to be a programmer who able to combine my love to board games and programming capabilities does Lua is my best option? Or you recommend to learn other programming language? One that will actually companies in the world are looking for programmers in, and it is actually possible to fund your life with?
@mrluke0660
@mrluke0660 3 жыл бұрын
Hey Ryan, this video is great and has helped me on my way to setting up some cool basic tabletop stuff! I just have a question, can you make a button activate a pull-out slide (on a table) or other already scripted events? like making a secondary form of activation? Thanks!
@LudoLodge
@LudoLodge 3 жыл бұрын
I'm not sure about the slide on the table, but in general, if you want to call a function on a different object, you will want to find that object by GUID and then use the "call" method: api.tabletopsimulator.com/object/#call
@Milhenar
@Milhenar 9 ай бұрын
Actually I think this is very helpful because I'm making a prototype of a The Stars Are Right game on TableTop and the middle zone needs to be randomized onLoad, I just need to know if this will apply to the entire zone of randomization :D
@bigal115
@bigal115 3 жыл бұрын
Thank you for the turtorial. Just curious is it possible if you can play music as soon as the game is loaded?
@LudoLodge
@LudoLodge 3 жыл бұрын
I haven't used the Music Player functionality myself, but it looks like there are functions for setting the audio clip and playing it (api.tabletopsimulator.com/musicplayer/), which you would just need to call in the onLoad() event for it to trigger when the game loads.
@user-ts3ln8by8y
@user-ts3ln8by8y 2 жыл бұрын
очень хорошо рассказал для новичков, что куда нажимать чтобы начать
@ktrldkhaos
@ktrldkhaos 3 жыл бұрын
Would you be doing a tutorial of creating / importing figures like meeples, custom miniatures, etc.?
@LudoLodge
@LudoLodge 3 жыл бұрын
I have it on my list to get to at some point!
@avennine
@avennine 10 ай бұрын
I am pretty clueless when it comes to scripting, and I had a question. I have 2 hidden zones. I want to bind a key (maybe the ''J'' key, I don't think that is normally used for anything else) that when pressed will change the position of both hidden zones (maybe below the table) so their contents are no longer hidden. and if pressed again, they will move back (making this a toggle switch). how do I do this? I know I prolly need to use addHotkey , but I can't understand how to structure the code and such.
@Noisymedal
@Noisymedal 4 ай бұрын
I'm making a dungeon-generator for Tabletop Simulator as a university project and I'm running into a hurdle that I thought you might be able to help me with. I have thrown this problem at Reddit as well. As it stands, I'm capable of generating a board through a Json file by accessing image files on the local disk, but these dungeons are not visible in multiplayer. I can upload these images to the cloud in-engine, but that defeats the purpose of the generator. Is there a way I can prompt the user to upload the images upon load? I'm seeing a glimmer of hope in Lua scripting (for which I've grasped the very basics) but I can't seem a way to prompt the user with the option to upload the images to the cloud. Is there another example I can reference?
@MadMax-mw3og
@MadMax-mw3og Жыл бұрын
Hey man, Love your work, question: is it worth getting Atom, and whats the difference?
@LudoLodge
@LudoLodge Жыл бұрын
Hey, unfortunately Atom was discontinued, but you might check out Visual Studio Code as it has a similar plugin: github.com/rolandostar/tabletopsimulator-lua-vscode The main advantage is that it is just a lot nicer text editor than what is built into TTS, so it tends to be easier to work in without running into weird glitchy behavior.
@pcuimac
@pcuimac 3 жыл бұрын
You need to isolate your mic from the desk. Every time you press buttons or put your hand on the desk, it makes a bump noise in the audio track.
@King_Change
@King_Change 3 жыл бұрын
I was pretty sure I typed the write sequence for the button code and then my button just wasn't clickable and the text was backwards and using some strange characters, do you somehow know why?
@King_Change
@King_Change 3 жыл бұрын
Nevermind, my checker was upside down ;(
@stickmanster914
@stickmanster914 2 жыл бұрын
@@King_Change Thank you so much for saying that! I was going crazy over that exact same problem
@johndragonrider88
@johndragonrider88 9 ай бұрын
I had the same problem! Thank you so much!
@milesk2406
@milesk2406 5 күн бұрын
Hey, great video. I want to add to my game a button that can either say "Start Turn" or "End Turn" depending on when it makes sense. But I want one for each player, and any player can only hit their "Start Turn" button once the player before them has hit their "End Turn" button, AND (unfortunately, this goes on), when a player hits their start turn button I want a card to be drawn from their deck into their hand, unless they have reached the hand limit or their deck is empty, in which I want their discard pile to be shuffled and made into their deck (and then a card is drawn). AND, when they hit the end turn button I want all of the dice that they have drawn from an infinite bag (which act as trackers of how many turns need to pass for an ability to activate) to move one number down, unless it has already reached the "0" side, in which it should do nothing. ...Any chance you could help me with that?
@japanaman2
@japanaman2 3 жыл бұрын
What would be useful currently is I want a marble to pass through a scripted zone and then when that happens trigger poker chip generation/deletion (basically payout, and deletion of chips) on betting spaces. and then if able to pay out directly to the hand of players sitting at the table rather then just making chips on the betting spaces.
@LudoLodge
@LudoLodge 3 жыл бұрын
So first you would want to use the "onObjectEnterScriptingZone()" function and check if the object is the marble by comparing the GUID. If it is the marble, then you can create the chips at the appropriate places, and use the "deal()" function if you want the chips to go to specific players' hands. You can check out my tutorial on Card Auto-Refill for an example of generating chips at locations: kzfaq.info/get/bejne/nb2ClphptrTDmKM.html
@japanaman2
@japanaman2 3 жыл бұрын
@@LudoLodge Thank you this helps a lot.
@ShaharHarshuv
@ShaharHarshuv Жыл бұрын
Am I actually expected to work with the built in code editor? It doesn't syntax-color the code, has no auto-completion features / syntax error checking, and it really struggles with large files. Is there any alternative?
@LudoLodge
@LudoLodge Жыл бұрын
There used to be an official Atom editor plugin that I did a tutorial for, but now Atom has been discontinued. However, it looks like this VS Code plugin is similar, and probably your best bet: github.com/rolandostar/tabletopsimulator-lua-vscode
@dePokke
@dePokke 3 жыл бұрын
Would it be possible to have tokens show a 'back side' to certain players, while showing the other side to the 'owner' of the token? And to add a 'show hidden' button so that in certain cases you can show the opponent the state that you are seeing? As in the many 'blockgames' (Hammer of the Scots, Sekigahara, ...) or as in the old classic 'Stratego' for instance? That would prevent players from simply rotating around the board to cheat and watch the front side.
@LudoLodge
@LudoLodge 3 жыл бұрын
As far as I know, there isn't a way to do this with scripting. It really can just simulate how the game would be at the table, where you also technically can't prevent players from just looking at the other side. Maybe defining some custom saved cameras and then agreeing not to manipulate the camera would be close? But it likely boils down to the players agreeing to not cheat.
@dePokke
@dePokke 3 жыл бұрын
Yes, that's what I feared. As a fan of the Columbia blockgames (and Sekigahara) I was thinking about this again when I saw your movie about 'invisble hiding zones' (?). So I was hoping that maybe you can have two of these zones over each other (one for each player) and both would see only the 'state' of counters in what their particular zone allows. Or using cards instead of tiles and having the so-called 'hand zone' spread out all over the map. So that the opponent can only see the backside of the card while the player who owns the card can see the front. But I did assume that this was wishful thinking as if it was possible someone would probably have done that before. Thanks for the reply and keep up the good work!
@dePokke
@dePokke 3 жыл бұрын
[Quote: Maybe defining some custom saved cameras and then agreeing not to manipulate the camera would be close?] To continue on this: Would it be possible to trigger some warning if any of the seated players rotates their view so that they end up at the opponent's backside? Or even block such attempts in a script? That would have the same effect as hiding pieces from the non-owner.
@LudoLodge
@LudoLodge 3 жыл бұрын
@@dePokke The short answer is that there is probably SOME way to accomplish that kind of thing with scripting, it's just a matter of how "hacky" or unconventional your approach would need to be. Hard to say for sure without really diving in and giving it a try, but let me know if you figure it out!
@foodforthemoon7
@foodforthemoon7 3 жыл бұрын
How did you add the button? I can’t find buttons in any menu. Tx
@LudoLodge
@LudoLodge 3 жыл бұрын
If you watch from 23:00, you can see how the button is added through scripting. 👍🏻
@zerobadideas
@zerobadideas 3 жыл бұрын
I have programming experience, but for some reason I was hesitant to bother with TTS scripting. This was very informative, thank you. But I must be losing it, because I tried that simple "local die = getobjectbyid(guid)" and it returns a nil value. I can use getallobjects and use a for loop to list them, but if i try to get an id value, they somehow don't exist.
@LudoLodge
@LudoLodge 3 жыл бұрын
I would double check that you specifically called getObjectFromGUID, that the GUID for sure matches the object, and that you put the GUID in quotes, e.g. getObjectFromGUID("a1b2c3").
@zerobadideas
@zerobadideas 3 жыл бұрын
@@LudoLodge yeah, i don't know what it's deal was, but it seems to work fine now. User error, most certainly. Thanks for responding, though. I also didn't think I needed Atom, since I already have two text editors (np++ and vscode), but the integration with TTS is wonderful. I actually thought TTS was broken when I would right click an object an go to scripting and the scripting window didn't open (because it was opening new tabs in Atom) And I realized a good way (for me, at least) to get familiar with it all was to open a scripted mod for a game I'm familiar with and just read the code, so I went for the scripted Clank! mod. It's a little over-engineered, so that's perfect lol
@BennettProductions99
@BennettProductions99 2 жыл бұрын
I would love to know how to tie this kind of function to a hot key rather than a button
@LudoLodge
@LudoLodge 2 жыл бұрын
TTS has got you covered! api.tabletopsimulator.com/base/#addhotkey
@agentskazzers3482
@agentskazzers3482 9 ай бұрын
Is it possible to make Ai Opponents?
@stopaskingme
@stopaskingme 3 жыл бұрын
I have a question How to remove sript from object?
@LudoLodge
@LudoLodge 3 жыл бұрын
I think technically every object always has a script attached, but you should be able to open the script editor for that object and just delete all of the code.
@Alex-qf9js
@Alex-qf9js 3 жыл бұрын
How to make fillable pdfs perhaps?
@LudoLodge
@LudoLodge 3 жыл бұрын
I'm not sure I follow, do you mean like a user interface where the players can fill out a form?
@Alex-qf9js
@Alex-qf9js 3 жыл бұрын
@@LudoLodge Character sheets for RPG groups is what I'm thinking but pretty sure that there are wider applications / implications.
@LudoLodge
@LudoLodge 3 жыл бұрын
@@Alex-qf9js Got it, good idea!
@Tomatriox
@Tomatriox 2 жыл бұрын
I have a prototype that I think is impossible to put in Tabletop simulator. I tried various things but nothing really works. It's 8 different D4 that are tumbling from face to face to go foward. The rotate anchor only remembers 1 position and don't care about what face is facing where, before and after tumbling. Here's a little video that shows how the pieces are moving on the board: kzfaq.info/get/bejne/p8eJkphzzrG1lnk.html
@good4usoul
@good4usoul 3 жыл бұрын
If you don't set a width and height to your button, you're gonna have a bad time.
@good4usoul
@good4usoul 3 жыл бұрын
If your fontsize is bigger than your height, you're gonna have a bad time.
@VielofDarkness
@VielofDarkness 3 жыл бұрын
Damn Dude, you took 10 minutes to actually get started with talking about how to do anything. It gets painful to sit through a bunch of chit chat, just to get to something helpful.
@LudoLodge
@LudoLodge 3 жыл бұрын
It is meant to be an introduction for complete beginners, so hopefully the bookmarked chapters make it easy to skip ahead if you feel you already know the basics. :)
@ArdentSM
@ArdentSM 3 жыл бұрын
*casually uses programming and scripting language interchangably*
@LudoLodge
@LudoLodge 3 жыл бұрын
Scripting is still programming. :) Scripting languages are typically interpreted versus compiled, but that's getting a little into the weeds.
@ArdentSM
@ArdentSM 3 жыл бұрын
@@LudoLodge yep! The first minute or so of the video taught me how to get to the scripting API site, aswell as how to open the editor. I now have atom installed, and haven't looked at most of the video, but that's all I needed. Thank you for being clear and concise, earned a like and subscribe :)
Scripting Card Setup in Tabletop Simulator
29:59
Ludo Lodge
Рет қаралды 43 М.
How to Make Custom Cards in Tabletop Simulator
16:29
Ludo Lodge
Рет қаралды 66 М.
Каха ограбил банк
01:00
К-Media
Рет қаралды 10 МЛН
ОДИН ДЕНЬ ИЗ ДЕТСТВА❤️ #shorts
00:59
BATEK_OFFICIAL
Рет қаралды 7 МЛН
He sees meat everywhere 😄🥩
00:11
AngLova
Рет қаралды 9 МЛН
Top 10 Board Games to Play Online on Tabletop Simulator
17:19
Actualol
Рет қаралды 200 М.
Why do cozy games suck?
14:46
koramora
Рет қаралды 1,3 МЛН
Rust and RAII Memory Management - Computerphile
24:22
Computerphile
Рет қаралды 218 М.
A new way to generate worlds (stitched WFC)
10:51
Watt Designs
Рет қаралды 511 М.
How to Make Custom Dice in Tabletop Simulator
13:31
Ludo Lodge
Рет қаралды 14 М.
Automate your job with Python
6:07
John Watson Rooney
Рет қаралды 370 М.
Tabletop Simulator Tutorials Part 1 - Basic Controls (2017)
6:42
Berserk Games
Рет қаралды 60 М.
How to Use States in Tabletop Simulator
10:58
Ludo Lodge
Рет қаралды 12 М.
How to Make a Good 2D Camera
11:38
Game Maker's Toolkit
Рет қаралды 387 М.
😨 Это реально Самый Высокий миф в Майнкрафт
37:29