SCED/src/core/MasterClueCounter.ttslua

47 lines
1.1 KiB
Plaintext
Raw Normal View History

2022-12-01 08:39:22 -05:00
local clueCounters = {}
local clueCounterGUIDS = {
"37be78",
"1769ed",
"032300",
"d86b7c"
}
function onLoad()
self.createButton({
label = "0",
click_function = "removeAllPlayerClues",
2022-12-01 08:47:54 -05:00
tooltip = "Click here to remove all Clues from playermats",
2022-12-01 08:39:22 -05:00
function_owner = self,
position = { 0, 0.06, 0 },
height = 900,
width = 900,
scale = { 1.5, 1.5, 1.5 },
font_size = 600,
font_color = { 1, 1, 1, 100 },
color = { 0, 0, 0, 0 }
})
-- loading object references to the counting bowls via GUID
for i = 1, 4 do
clueCounters[i] = getObjectFromGUID(clueCounterGUIDS[i])
end
2022-12-01 08:39:22 -05:00
loopID = Wait.time(sumClues, 2, -1)
end
2022-12-01 08:39:22 -05:00
-- removes all player clues by calling the respective function from the counting bowls
function removeAllPlayerClues()
2022-12-01 08:39:22 -05:00
for i = 1, 4 do
clueCounters[i].call("removeAllClues")
end
end
2022-12-01 08:39:22 -05:00
-- gets the counted values from the counting bowls and sums them up
function sumClues()
local count = 0
for i = 1, 4 do
count = count + tonumber(clueCounters[i].getVar("exposedValue"))
end
2022-12-01 08:39:22 -05:00
self.editButton({ index = 0, label = tostring(count) })
end