Tabletop Simulator

Tabletop Simulator

View Stats:
emaralha Feb 26, 2016 @ 8:05am
TTS Scripting question
Hello i'm a web developer i started using TTS a few days ago, i love it, guys, realy, this is genius. I want to explore more the programming aspect of it.

So lets say if i want to move an object to some point, how can i know the x = 0, y = 0, z= 0 of a game table? I come from a web background so i need some direction understanding coordinates to move things arround.
< >
Showing 1-12 of 12 comments
TheLimeyDragon Feb 26, 2016 @ 9:02am 
I might be wrong but I don't believe there is currently an in-game way of seeing co-ordinates of objects. You can see them in the .json file (it's plain text). The scripting is still in very early beta so things will change/improve
Dark Tekken Feb 26, 2016 @ 9:25am 
HI, in Host turn on Grid. The squares go by Inch so scale them all the way down (Small) and starting from the center of the Game Board would be zero. It's 88 little squares to the right ( X ) and 88 squares to the left ( -X ), 52 squares up ( Z ) and 52 squares down ( -Z ), and (Y) goes up towards the celing and ( -Y ) to the floor. That's 104 x 176 squares on the Board. I am learning how to use lua script so check out my other post for error fix's and maybe helping out fix some error's :) Happy Gaming!!!
emaralha Feb 26, 2016 @ 9:45am 
Originally posted by TheLimeyDragon:
I might be wrong but I don't believe there is currently an in-game way of seeing co-ordinates of objects. You can see them in the .json file (it's plain text). The scripting is still in very early beta so things will change/improve

I have in mind that things will change.

Originally posted by Dark Tekken 2016:
HI, in Host turn on Grid. The squares go by Inch so scale them all the way down (Small) and starting from the center of the Game Board would be zero. It's 88 little squares to the right ( X ) and 88 squares to the left ( -X ), 52 squares up ( Z ) and 52 squares down ( -Z ), and (Y) goes up towards the celing and ( -Y ) to the floor. That's 104 x 176 squares on the Board. I am learning how to use lua script so check out my other post for error fix's and maybe helping out fix some error's :) Happy Gaming!!!

Thanks thats a start for me!
Last edited by emaralha; Feb 26, 2016 @ 9:46am
Dark Tekken Feb 26, 2016 @ 10:13am 
Your Welcome!!! :steamhappy:
Dig65 Feb 26, 2016 @ 12:05pm 
It stumped me at first that "Y" is the high/low axis and "Z" is the right/left axis. Almost every 3D software I've used treated "Z" as the high/low axis. Still gets me.
Dark Tekken Feb 26, 2016 @ 12:30pm 
It seems right I guess. In real life X is left and right, Y is up and down, and Z is towards you and away from you. So, I guess that's why they made the Grid the same way. To be honest, I never understood why some 3d software have Z going up and down. When you start a program like Daz3D and Bryce 7.1 Pro, the XYZ is the same like in Tabletop Simulator. But in Blender, Z goes up and down.
hostiletake0v3r Feb 26, 2016 @ 1:04pm 
here is a basic lua script that allows you to print the position coordinates to the chat window.

http://pastebin.com/0iwFchez


in order to use this you will need to complete 3 steps.
1. create a scripting zone with the zone tool, cover the entire board with it.
2. any object you want to find the position of, name the object (case sensitive) PositionFinder
3. get the guid of the scripting zone and replace the one at the top of the file with the new one you just copied.


When you take a seat, a button should spawn, when you click the button, it will print the coords of your object to the chat window.

You can freely move your object around the table and press the button to print the new coords again.

enjoy.
Last edited by hostiletake0v3r; Feb 26, 2016 @ 1:45pm
FragaholiC Feb 26, 2016 @ 1:23pm 
Originally posted by TheLimeyDragon:
I might be wrong but I don't believe there is currently an in-game way of seeing co-ordinates of objects. You can see them in the .json file (it's plain text). The scripting is still in very early beta so things will change/improve

Gather the GUID from a game object inside TTS. (RMB on item, scripting > GUID > click to copy)
-- example script
your_copied_guid_from_TTS = '4d54fd'
game_object = getGameObjectFromGUID(your_copied_guid_from_TTS)
object_position = getPositionForGameObject(game_object)
x_pos, y_pos, z_pos = object_position.x, object_position.y, object_position.z
-- example script end
Dark Tekken Feb 26, 2016 @ 2:13pm 
What hostiletake0v3r put up works very good :steamhappy:

This what happened when I did what FragaholiC posted
(I am a beginner just trying to figure out what it all means :steamsad: )
I started a new TTS game, spawned a SquareBlock, and put

Gather the GUID from a game object inside TTS. (RMB on item, scripting > GUID > click to copy)
-- example script
your_copied_guid_from_TTS = '4d54fd'
game_object = getGameObjectFromGUID(your_copied_guid_from_TTS)
object_position = getPositionForGameObject(game_object)
x_pos, y_pos, z_pos = object_position.x, object_position.y, object_position.z
-- example script end

Which looked like this with my Guid from the SquareBlock

24b938 = '4d54fd'
game_object = getGameObjectFromGUID(24b938)
object_position = getPositionForGameObject(game_object)
x_pos, y_pos, z_pos = object_position.x, object_position.y, object_position.z

and got

Error in Global Script: unexpected symbol near '24'
hostiletake0v3r Feb 26, 2016 @ 4:10pm 
missing quotes is your error here.
the guid is a string and strings must be wrapped in quotes -> '
game_object = getGameObjectFromGUID('24b938')

also note, variables cannot start with numbers in lua the first character must be a letter.

P.S.
it appears you replaced the variable with your new guid, rather then a reference to the variable that stores the guid string for you called your_copied_guid_from_TTS

just update the variable at the top of the script to your new guid

your_copied_guid_from_TTS = '4d54fd' <- frags guid
your_copied_guid_from_TTS = '24b938' <- your guid

then you would keep the line the way it was originally.
game_object = getGameObjectFromGUID(your_copied_guid_from_TTS)
Last edited by hostiletake0v3r; Feb 26, 2016 @ 4:19pm
Dan Feb 26, 2016 @ 4:16pm 
I didn't read through all of this, but your error means you have a variable called "24b938" and are trying to set it equal to "4d54fd". You can't have a variable name start with a numeral. Change 24b938 to be like "guid" without the quotes.

guid = '4d54fd'
Dark Tekken Feb 26, 2016 @ 4:42pm 
Oh, :steamfacepalm: I thought your_copied_guid_from_TTS meant for me to replace that part with my guid. Ok, so never start a variable with a number and make sure quotes are in. I'm just going to jump back in there and try this stuff out. Thanks for all the help you guys are giving :)
< >
Showing 1-12 of 12 comments
Per page: 1530 50

Date Posted: Feb 26, 2016 @ 8:05am
Posts: 12