Tabletop Simulator

Tabletop Simulator

Encoder
Tipsy Hobbit  [developer] 25 Jun, 2017 @ 9:39pm
Feature Requests
Any features that you would like to see, just suggest here. Will try to respond and keep up to date on requests with whether they are feasible or not and why.
< >
Showing 1-15 of 21 comments
Robotic Mind 5 Jul, 2017 @ 4:28pm 
Hi Tipsy - I love what you done here. I have a table of my own on the workshop that I am always looking to improve. The thought I have is to integrate your encoder into the table surface so that when a card hits the surface it is immediately encoded.

The way I see this working is when a card hits the surface it is added to the encoder. One visible "flip" button appears as it does now, and three invisible buttons (placed underneath card) are created for toggling loyalty, counters, and base stats. Invisible areas work like their respective buttons on your encoder.

I have started trying to code it myself but run into speed bumps often due to lack of experience with lua and coding. Is this version of your encoder possible? Do you think there will be any performance issues seeing how every card hitting the table will be encoded?

-Thanks-
Tipsy Hobbit  [developer] 6 Jul, 2017 @ 4:57pm 
Originally posted by Robotic Mind:
Hi Tipsy - I love what you done here. I have a table -----

I have started trying to code it myself but run into speed bumps often due to lack of experience with lua and coding. Is this version of your encoder possible? Do you think there will be any performance issues seeing how every card hitting the table will be encoded?

-Thanks-

Yes it is with some slight reworking. For the second half of will it have performance issues... honestly not sure. Definitily would not want to use collision for it. Maybe onspawn or dropped. Currently working on a version where the options are in the flip button so that may make it easier for you to convert to a table version.


Another thought. You can always just make a small scripted item like this:

function onObjectDropped(c,obj)
enc = getObjectFromGUID(self.getDescription())
enc.call("addCard",{obj})
enc.call("createButtons",{obj})
end

Then in its description but the GUID of the encoder.

This has actually peaked my interest, currently working on making a small scripted item that will do just that.
Last edited by Tipsy Hobbit; 6 Jul, 2017 @ 6:50pm
Amuzet  [developer] 8 Jan, 2018 @ 3:15pm 
Hello tippsy, what a fantastic piece of lua you've made here.

I was wondering, if there was any way to modify the variables of any given encoded object from outside the encoder itself. If not that would be my request, maybe a function call much like the how the Api works.
Tipsy Hobbit  [developer] 8 Jan, 2018 @ 8:51pm 
I am actually doing a complete rework of the code starting from scratch at the moment. Moving everything over to the api, except for the basic copy and full copy. That way everything will use the same system instead of me having to worry about the hardcoded counters and api counters. By variables, do you mean the physcial object(name, scale, position)? Or do you mean things like power and toughness?

Actually, since you have really delved deep into the api, give me a full list of things you would like to see or critique.
Last edited by Tipsy Hobbit; 8 Jan, 2018 @ 9:05pm
Amuzet  [developer] 16 Jan, 2018 @ 9:52pm 
like at the moment we are unable to set the base power and toughness of a card with the API
Say i were to implement Embalm as a status, i can give it that name.
But what would be really neat, is for Eternalize to automaticly set the
encodedObjects[GUID].toggle.base = true base.power = 4 base.toughness = 4

When first starting I attempted to switch which side the buttons showed up,
what i wanted inside statTrig**Morph() was something like,
encodedObjects[GUID].toggle.flipped == itself * -1 encodedObjects[GUID].toggle.base = true base.power = 2 base.toughness = 2

The encodedObjects being a local table nothing is able to modify it outside your encoder itself.
Thats okay, I dont know all coding practices but i think 'locality'? is fairly good, I dont know.
attemtping to get around this i tried
function flipCard(par,number) local enc = Global.getVar('MTGEncoder') local ent = getObjectFromGUID(par.tar.getGUID()) local rot = ent.getRotation() ent.setRotation({rot.x,rot.y,number}) --Find a way to call toggleFlipped() from here enc.call('toggleFlipped',par.tar) --<= This line does not and will never work. end
par['tar'] being how the object is passed from your MTGE to statTrigfunctions
However Tabletop Sim freaks out when Userdata in this case an object is passed. Even if toggleFlipped is expecting an object, TTS's call is expecting a table.

With no clue how far you are into your rewrite I see two solutions, maybe you have a more elegent one.
place this at the begining of each function that you allow to be called.
tar = getObjectOutOfTable(tar) --<= this function getObjectOutOfTable(unknown) if type(unknown) == 'table' then return unknown.tar elseif type(unknow) == 'userdata' then return unknown else for key in pairs(encodedObjects) do return getObjectFromGUID(key) end end end

or(and I think this would throw no errors(not sure))
function apiSetQualities(p) local card = p.tar.getGUID() for key, value in pairs(p.table) do if type(encodedObjects[card][key]) == 'table' and type(value) == 'table' then for k,v in pairs(value) do if type(encodedObjects[card][key][k])==type(v) then encodedObjects[card][key][k] = v end end elseif type(encodedObjects[card][key])==type(value) then encodedObjects[card][key] = value end end createButtons(p.tar) end
Last edited by Amuzet; 16 Jan, 2018 @ 9:55pm
Tipsy Hobbit  [developer] 18 Jan, 2018 @ 9:08pm 
So far with the rework, I am moving the base stats( p/t, loyalty, +1/+1) over to the api, which means you will be able to just do a apiIsProp(name) to see if its a property or not. From there you can just call the properties function as if the player had pushed the buttons himself, but I guess I can add an extra helper function to simplify the process.
Robotic Mind 12 Mar, 2018 @ 6:13pm 
Hi Tipsy - I am hoping you can help me make token managment a little easier in MTG. My thought is to create a module that will read the name of the encoded card, find the associated token image, and spawn the image as a TTS object. Problem is that I suck at using the encoder. I try to use the exsisting modules as a baseline to create my new idea, but I just keep getting errors. Maybe you can help me out or point me in a better direction.

I know that TTS does not connect to external servers so I went ahead and created a spreadsheet of tokens and the sources that spawn them. You can find that here:

https://docs.google.com/spreadsheets/d/1BWBbVpnslNw4wHx6et30olBANdp_PqHaNXOH1J1KAdo/edit?usp=sharing

Using the spreadsheet we can format the data into something more meaningful to LUA. What is the best format to store this information in TTS?

Any help is appreciated, and thanks for the encoder updates. They have improved the MTG play experience a lot.
Last edited by Robotic Mind; 12 Mar, 2018 @ 6:21pm
Amuzet  [developer] 12 Mar, 2018 @ 8:40pm 
Im Actually working on using the Scryfall Api and making a module for Tipsy's Encoder
Robotic Mind 12 Mar, 2018 @ 8:50pm 
Would you care to share some code? I am interested in spawning a custom token object using a button on Tipsy's encoder.
Amuzet  [developer] 12 Mar, 2018 @ 8:59pm 
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1324968772
Here is my current Token spawner that is not an Encoder Module
Its Hard Coded with the location to token images and alters.
At the moment im going to implement the scryfall Api and remove the direct links to Tokens and reaplace it with Api Requests.
If you want we could both make one, its my first time using WebRequests
Robotic Mind 12 Mar, 2018 @ 9:09pm 
As far as I know TTS is sandboxed from external servers. Do you have proof TSS can store HTTP requests?
Amuzet  [developer] 12 Mar, 2018 @ 9:24pm 
Scryfall returns a JSON string, which we can decode with TTS
Yes i have gotten the requests and can store them. Simple.
Just seeing what i DONT NEED to store, Like Prices and external links
And I'm implementing Chat commands for Requests like on Discord Servers
https://scryfall.com/docs/discord-bot
Robotic Mind 12 Mar, 2018 @ 9:49pm 
Thanks for sharing your token spawner. The hard part for me is working with the encoder.

I was using Scryfall before. I couldn't find a way to filter the returned data. Do you care to share how you store an HTTP request in TTS?
Tipsy Hobbit  [developer] 12 Mar, 2018 @ 11:56pm 
I am also willing to help with understanding the encoder api, so if you have any questions on that end. just message me.
MrPanda72 18 Jul, 2018 @ 10:22am 
noencode thingee.. it is still encoding my cards :(
< >
Showing 1-15 of 21 comments
Per page: 1530 50