Figurine Card Bot
Figurine Card Bot
function onLoad(save_state)
self.clearButtons()
Data = {
[1] = '',
[2] = false,
}
MutedPlayers = {}
if save_state ~= nil and save_state ~= "" then
Data = JSON.decode(save_state)
self.setTable('Data', Data)
self.setDescription(Data[1])
ClickedDone = true
self.createButton({label = 'Edit', click_function = 'Edit', rotation = {0,
270, 0},
position = {0.3, 0.1, 0}, width = 500, height = 140, font_size = 100,
function_owner = self})
else
self.setDescription('')
self.createButton({label = 'Start', click_function = 'Start', rotation =
{0, 270, 0},
position = {-2, 0, 0}, width = 1500, height = 550, font_size = 300,
function_owner = self})
end
end
function onSave()
data = self.getTable('Data')
if data[1] == '' then return end
save_state = JSON.encode(self.getTable('Data'))
return save_state
end
function ColorCheck(playerColor)
if Player[playerColor].admin == true then
return true
else
return false
end
end
function Edit(object,playerColor)
if ColorCheck(playerColor) == false then return end
ClickedDone = false
self.clearButtons()
self.createButton({label = 'Done', click_function = 'Done', rotation = {0, 270,
0},
position = {2, 0, 0}, width = 1500, height = 550, font_size = 300,
function_owner = self})
end
function Steam_ID(object, playerColor)
if ColorCheck(playerColor) == false then return end
for i, colors in ipairs(getSeatedPlayers()) do
print(getPlayer(colors).steam_name .. ' has ID: ' ..
getPlayer(colors).steam_id)
end
end
function Done(object,playerColor)
function Start(object,playerColor)
if ColorCheck(playerColor) == false then return end
broadcastToAll('Read game chat on how to use AUTO PROMOTE.', {0,1,0})
printToAll('1. Right-click on object and select description with mouse.',
{1,0,1})
printToAll('2. Enter names or ids of players you wish to auto promote or use
side buttons.', {1,0,1})
printToAll('3. Make sure names or ids are exact copies and each name is on its
own line.', {1,0,1})
printToAll('4. Once all names or ids are entered, click DONE to lock the names
or ids in.', {1,0,1})
self.clearButtons()
end
local index = 0
local label = ''
local buttons = object.getButtons()
for i, but in ipairs(buttons) do
if but.click_function == 'Mute' then
index = but.index
label = but.label
end
end
local Data = self.getTable('Data')
local button_parameters = {}
if label == 'Spectators are not muted' then
button_parameters.label = 'Spectators are muted'
printToAll('Only the host is allowed to unmute. This will not mute people
on the list.', {1,0,1})
printToAll('This will not mute currently seated players.', {1,0,1})
Data[2] = true
else
button_parameters.label = 'Spectators are not muted'
Data[2] = false
end
button_parameters.index = index
self.setTable('Data', Data)
object.editButton(button_parameters)
end
function AllPromoted(object,playerColor)
if ColorCheck(playerColor) == false then return end
AddPlayers(object, 1)
end
function AllSeated(object,playerColor)
if ColorCheck(playerColor) == false then return end
AddPlayers(object, 2)
end