IMPORTANT NOTE (pinned for visibility): For my example, I was working from a new TTS file that hadn't been saved yet, and you'll notice that when I hit "Save and Play" from the scripting editor at 16:22, it flashes the "Error no save found. You must load a save first" message. Since I hadn't saved the mod yet, it just applied the scripting changes without loading anything. However, if you are working from a mod that has been saved and loaded (which is going to be more common in the long run), it is important to understand that hitting "Save and Play" will first LOAD the last saved version of that mod, and THEN apply the changes. This means that any non-code additions to the game that haven't been saved yet will be lost when it loads the save file. Long story short, if you add a scripting zone, you will need to save the mod before saving code changes, ensuring that the scripting zone is in the save file. Then when you hit "Save and Play" from the scripting editor, you won't lose that scripting zone when it reloads.
@RefugeeOfReality4 жыл бұрын
The scripting part is spicy! I am setting up a Pen & Paper pool group table right now and I just got the Idea of implementing a tool for a player who uses an invisibility spell to ACTUALLY turn their character figurine invisible for the other players. This is gonna add some more depth to the gameplay! Thank you for this comprehensive guide!
@Dark_Peace11 ай бұрын
"But Tabletop Simulator is more powerful. It is not limited to the physical realm." That got very ominous
@ryanmscot4 жыл бұрын
Just a heads up @Ludo Lodge, I believe the "See-Through" option on hidden zones only has an effect on the 'targeted' player. Since you were the white player toggling see-through on a white hidden zone, you saw no change. For any other player's view, the box would have toggled from a transparent cube to a fully opaque cube. This can be useful if you want to allow the art on the gameboard to be visible while hiding components for example.
@DavidDaSilvaConceptions4 жыл бұрын
Thanks! that was very informative. I knew about hidden zones, but not about using scripted zones to make "invisible hidden zones"!
@ddade113 жыл бұрын
Oh yes! This video is what I have been searching for! Thank you , thank you! I have a hidden planning phase in my game and I need a way to temporarily hide player setup between rounds. I had overlooked the scripting zones because I had not found anything on them. I think this is my answer. Move the zones up during hidden setup and then move them down to reveal the decisions. Tie that to a button and Bob's your uncle!
@DipsticksOfficial4 жыл бұрын
Thanks, this video was an awesome introduction, and it helped me get rid of those ugly boxes lol. I made an invisible scripting zone on top of a "cauldron" that I locked to the table, and now I'm working on how to make the cauldron produce specific potions depending on what ingredients are dropped in... either way, there is no ugly translucent box around the cauldron, so thanks again!
@larrye4 жыл бұрын
I'd Love to see more on scripting.
@perryb.27323 жыл бұрын
Wow man, your videos are helping me so much, thank you. I'd be lost in the sauce, but thanks to your videos I actually have a really streamlined prototype for my board game that is really helping me test it
@Paul_M_Bedford3 жыл бұрын
Thank you for this. Solved all my zone problems. Much appreciated!
@mesmith70153 жыл бұрын
This was exactly what I was looking for. Thank you!
@rorobear1940 Жыл бұрын
Thanks a lot for this wonderful tutorial. Is it possible to have a hand of cards where some of the cards are hidden and some of them are “reverse hidden”, aka facing outward from the player holding them? Is it possible to assign two hands per player, one where the cards are hidden and the other where cards are reverse hidden?
@GavinAndMartin3 жыл бұрын
Hi! I think you’re just brilliant and extremely pedagogic. I wonder if you would like to make a video showing how to script a button for toggling a hidden zone on/off. It would be desirable if it is the same button which you press to turn on the hidden zone and, when you press it again, turn off the hidden zone. A kind of screen when dealing with hidden bidding.
@BishNufc3 жыл бұрын
Hi Ryan. You can also change the opacity of hidden zones in the 'Configuration' menu (Menu Button-->configuration-->interface-->Misc settings) where there are options to show and hide hidden zone opacity values. Setting these to zero makes the zones invisible to either the owner and/or every other player, it does show the zones' outline however when you drag something into it. Edit - However this effect is applied to every module you play (i.e. it is Global) so if you need different settings for individual modules then your scripting zone example may need to be used. I bet there is a function that changes the capacity in LUA :)
@LudoLodge3 жыл бұрын
Interesting! I didn't see an opacity parameter for zones on a quick scan through the API, but perhaps there is a way to do it!
@damonmosier36513 жыл бұрын
@@LudoLodge Is there a way to set invisible zones for teams instead of colors? Like the "Spade" or "Hearts" teams. I know you can set a zone to be a hidden zone for a particular color, and then anyone on that team can see it, but that only works if someone is playing as THE color specified. I'd rather specify a team and then anyone of any color can see it if they just join that team.
@St34mPunkPrivateer3 жыл бұрын
adding comment cause this was a nice overview of a simple mechanic!
@andreasthedude38434 жыл бұрын
Thank you for this helpful video. I'm very interested in seeing more of this topic. Keep up the good work! Maybe I learn it by watching the following content or you have the solution to my problem: Beeing the host of a game, I deleted a counter by accident when i wanted to change the number i typed in. Respawning it from saved objects didn't fix the function of it. It was a Standard tts-Counter with some buttons attached to it, to move player money from and to the bank. And it had a button to pay a certain amount of money to players depending on the number of Share cards in their hand. You can see it in the workshop module of 18Chesapeake. Is there a way of protecting game pieces from beeing deleted by the Host or promoted players? Or is there a way of regaining the scripted function of such a piece? Also would love to See, how to implement such a function in a game. Thanks for your excellent Work so far. Really enjoying the stuff.
@josemariaalvarezcejudo404 Жыл бұрын
Great tutorials! I'd like to make a mod about the Resistance (werewolf too), you know, the spies (wolves) know each other but not the rest. How can I make a script to do that? When they receive the spy card, they get a text? Is there a better way? Thanks un advance!
@Lasrin4 жыл бұрын
Brilliant! I can make a model with a state that is invisible to the players, but I can still see it!
@lbwstrategygaming Жыл бұрын
Thanks for the info, love it, going to use it for RPG's
@BNutsАй бұрын
The game I'm working on is cooperative. How can I make the Hands visible to all players?
@Jhakaro4 жыл бұрын
I want to place in two hidden zones, one on each side of the board for the beginning of play. Think of it like setting up pieces without the other being able to see until the main game actually starts. I have tried multiple times to absolutely no avail and feel like pulling my hair out to be honest. I've set it to work where one side, let's say white, can't see what's placed inside the other's zone (green) but for some reason, the green player can still see what's placed in White's zone. The code is the exact same save for the replaced ({"Green"}) instead of white and the new code for the scripting zone identifier itself. I've double checked everything and it's still just not working. Any help is much appreciated.
@damonmosier36513 жыл бұрын
hah I came here to say I am having the exact same problem. It seems like one scripting zone overrides the other one or something. Like only the last one in the LUA code works and all previous ones do not. I've tested this by adding the "--" in front of each line of code to turn them "off" and run one or the other, but they can't seem to both work at the same time. The only thing I can think of is putting all of the scripting zones within the same "onObjectEnterScriptingZone" function and then maybe using the "if", "elseif" functions to see if you can stack them that way? But I haven't tried it yet.
@noahfeldman33773 жыл бұрын
Just tried out the elseif and it works. I was having the same problem
@caioteixeira15413 жыл бұрын
Is there a way to do it, but instead of triggering when the obj "enter or leaves" the zone make it trigger if the object is "INSIDE" the zone? Because lets say you make a zone that is visible only to player Blue, if you have previously saved objects inside the zone it will not trigger the script because it never "entered" the zone. Thanks for the help
@LudoLodge3 жыл бұрын
I suppose at the very beginning of the game you could check for objects in the zone, but then after that those objects will only change if the enter or leave event is triggered. You can use the getObjects() function on the zone to get all the objects currently in that zone.
@caioteixeira15413 жыл бұрын
@@LudoLodge ty I'll try with that function and see how it goes
@LudoLodge3 жыл бұрын
Here is the documentation for that function that might be helpful: api.tabletopsimulator.com/object/#getobjects-zones
@Konstrukto_spons4 жыл бұрын
for some reason my code doesn't seem to work either, that is to say, once I click 'save and play' my scripting zone disappears and the code doesn't function which makes sense with no scripting zone present... here's my code: function onObjectEnterScriptingZone(zone, obj) if zone.getGUID() == '660b6d' then obj.setInvisibleTo ({"Blue", "Purple", "Yellow"}) end end function onObjectLeaveScriptingZone (zone, obj) if zone.getGUID() == '660b6d' then obj.setInvisibleTo ({}) end end
@LudoLodge4 жыл бұрын
You bring up something that I really should have mentioned in the video! For my example, I was working from a new TTS file that hadn't been saved yet, and you'll notice that when I hit "Save and Play" from the scripting editor, it flashes the "Error no save found. You must load a save first" message. Since I hadn't saved the mod yet, it just applied the scripting changes without loading anything. However, if you are working from a mod that has been saved and loaded (which is going to be more common in the long run), it is important to understand that hitting "Save and Play" will first LOAD the last saved version of that mod, and THEN apply the changes. This means that any non-code additions to the game that haven't been saved yet will be lost when it loads the save file. Long story short, once you add your scripting zone, you are going to want to first save the mod. This ensures that the scripting zone is in the save file. Then when you hit "Save and Play" from the scripting editor, you won't lose that scripting zone when it reloads. Hope that helps!
@Konstrukto_spons4 жыл бұрын
@@LudoLodge I'm going to try that, thanks!
@Konstrukto_spons4 жыл бұрын
Worked like a charm, and hovering over the save &play button actually mentions it as well There's another issue I encountered with this though The game I have up on TTS has up to four players, and I would like to have a hidden zone for each of them Repeating the code a second time annuls the first time though, even though one color differs and another object is mentioned I tried a few times, experimented with saving first etc., unfortunately to no avail
@LudoLodge4 жыл бұрын
@@Konstrukto_spons So for each of the scripting zone events, you will need to duplicate the "if" statement four times, with each one checking for a different GUID, one for each of your scripting zones. If that doesn't help, feel free to paste your code here and I can see if I spot anything.
@Konstrukto_spons4 жыл бұрын
@@LudoLodge so what you're saying is that instead of repeating the code four times, I should just repeat the 'if' statement four times within the code?
@erikmisiego26762 жыл бұрын
great video
@gabrieldespres44104 жыл бұрын
Thank you for that! But it keeps showing "Error in script, unexpected symbol". I wrote the exact same thing as you and it does not work... :-( Do you have an idea why?
@LudoLodge4 жыл бұрын
That error indicates that there is some kind of syntax error; that is, text that doesn't follow the rules of the programming language (Lua). If you paste the full contents of your script here or link to it, I'd be happy to take a look and see if I notice something.
@gabrieldespres44104 жыл бұрын
Yeah, sure! Here it is: --[[ Lua code. See documentation: api.tabletopsimulator.com/ --]] --[[ The onLoad event is called after the game save finishes loading. --]] function onLoad() --[[ print('onLoad!') --]] end --[[ The onUpdate event is called once per frame. --]] function onUpdate() --[[ print('onUpdate loop!') --]] end function onObjectEnterScriptingZone(zone, obj) if zone.getGUID() == '1295c3' then obj.setInvisibleTo ((Red)) end function onObjectLeaveScriptingZone(zone, obj) if zone.getGUID() == '1295c3' then obj.setInvisibleTo(()) end
@LudoLodge4 жыл бұрын
@@gabrieldespres4410 Ah caught it! The inside of the setInvisibleTo() function should use curly braces, i.e. obj.setInvisibleTo ({Red}). Hopefully changing that it both places fixes it for you!
@gabrieldespres44104 жыл бұрын
It did not work :( It keeps saying that there is an error near "(", but when I deleate the function, same. When I deleate the first part (the one that is there by default) same error message. I don't understand. But thank you for your support, I appreciate! Last question, would it be possible to set a specific object invisible, no matter where it is on the table?
@LudoLodge4 жыл бұрын
@@gabrieldespres4410 Ah sorry, it sounds like another syntax error, but hard to say what it might be without seeing it. Best I can recommend is to very carefully check it against the code in the video. SetInvisibleTo() is a function that is called on an object (in this example, it is the object that is passed into the onObjectEnterScriptingZone() function). If you pass all of the player colors to that function, then it will be invisible to all of those players. The location of the object will have no impact (the only reason it does in the example is because we explicitly set the visibility back when it leaves the scripting zone). All of this can be a little confusing without prior programming experience, but I am planning on eventually doing some more introductory tutorials for scripting functionality. Just wanted to touch on it in this video since it was related to the topic of zones. :)