Tabletop Simulator

Tabletop Simulator

View Stats:
Myrkul Mar 17, 2023 @ 4:56pm
Remove a single button and not all at once ?
Hello there.
I need some help with a simple script, and i am only missing the last part.

I attached a scrip to a single object, it have multiple buttons on it,
clicking one of the button currently takes an object from a bag and place it on the table.
That parts seems to work but what i would like is the following:

Once you click on one of the buttons, it should disappear/remove itself (but not the other buttons):

objects = {'2cfc3e', '75e0eb', '22abfa'} function onload() self.createButton(buttonParam) self.createButton(buttonParam2) end buttonParam = {} buttonParam.label='Object 1' buttonParam.click_function='PlaceButton1' buttonParam.position = {1,0.8,1} buttonParam.width = 400 buttonParam.height = 400 buttonParam.font_size = 200 buttonParam.function_owner=self function PlaceButton1() bag = getObjectFromGUID('122bb8') bag.takeObject({guid='2cfc3e', position = {0.00,4.20,6.00},rotation = {0, 180, 180} }) self.clearButton(buttonParam) end buttonParam2 = {} buttonParam2.label='Object 2' buttonParam2.click_function='PlaceButton2' buttonParam2.position = {3,0.8,3} buttonParam2.width = 400 buttonParam2.height = 450 buttonParam2.font_size = 200 buttonParam2.function_owner=self function PlaceButton2() bag = getObjectFromGUID('122bb8') bag.takeObject({guid='75e0eb', position = {4.00,4.20,6.00},rotation = {0, 180, 180} }) self.clearButton(buttonParam2) end


The self.clearButton destroys all of the buttons on the object and not the single button you clicked.
Any ideas please ?
< >
Showing 1-3 of 3 comments
Finaryman Mar 18, 2023 @ 3:15am 
Originally posted by Myrkul:
Any ideas please ?
what if u transefered button to the bottom of the occean, or far above skies...
self.editButton({index=WHICHBUTTON,position={0,200,0}}
local tmppos if WHICHBUTTON == 0 then tmppos=buttonParam.position elseif WHICHBUTTON == 1 then tmppos=buttonParam2.position end if tmppos then self.editButton({index=WHICHBUTTON,position=tmppos} end
Last edited by Finaryman; Mar 18, 2023 @ 3:16am
Myrkul Mar 18, 2023 @ 6:13am 
Works like a charm. You'r a savior :)

Is there any way i can lock the object in place when it have completed its move ?
thanks
Finaryman Mar 18, 2023 @ 7:18am 
obj.setLock(true)
< >
Showing 1-3 of 3 comments
Per page: 1530 50