ah_sce_unpacked/unpacked/Custom_Token Agenda Deck 85c4c6.ttslua
2022-12-13 14:02:30 -05:00

109 lines
3.0 KiB
Plaintext

-- Bundled by luabundle {"version":"1.6.0"}
local __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)
local loadingPlaceholder = {[{}] = true}
local register
local modules = {}
local require
local loaded = {}
register = function(name, body)
if not modules[name] then
modules[name] = body
end
end
require = function(name)
local loadedModule = loaded[name]
if loadedModule then
if loadedModule == loadingPlaceholder then
return nil
end
else
if not modules[name] then
if not superRequire then
local identifier = type(name) == 'string' and '\"' .. name .. '\"' or tostring(name)
error('Tried to require ' .. identifier .. ', but no such module has been registered')
else
return superRequire(name)
end
end
loaded[name] = loadingPlaceholder
loadedModule = modules[name](require, loaded, register, modules)
loaded[name] = loadedModule
end
return loadedModule
end
return require, loaded, register, modules
end)(nil)
__bundle_register("__root", function(require, _LOADED, __bundle_register, __bundle_modules)
require("core/AgendaDeck")
end)
__bundle_register("core/AgendaDeck", function(require, _LOADED, __bundle_register, __bundle_modules)
-- Doom Counter with Print
-- original by: -
-- changed by: Chr1Z
-- description: Clickable counter for doom on the agenda, changing the value prints the new value, reset button added
information = {
version = "1.4",
last_updated = "12.11.2022"
}
function onSave() return JSON.encode(val) end
function onLoad(saved_data)
if saved_data ~= "" then
val = JSON.decode(saved_data)
else
val = 0
end
self.createButton({
label = tostring(val),
click_function = "addOrSubtract",
function_owner = self,
position = { 0, 0.06, 0 },
height = 800,
width = 800,
font_size = 650,
scale = { 1.5, 1.5, 1.5 },
font_color = { 1, 1, 1, 95 },
color = { 0, 0, 0, 0 }
})
self.createButton({
label = "Reset",
click_function = "setToZero",
function_owner = self,
position = { 0, -0.04, 2.7 },
height = 600,
width = 1250,
font_size = 425
})
self.addContextMenuItem("More Information", function()
printToAll("------------------------------", "White")
printToAll("Doom Counter v" .. information["version"] .. " by Chr1Z", "Orange")
printToAll("last updated: " .. information["last_updated"], "White")
end)
end
function setToZero() updateVal(0) end
function addOrSubtract(_, _, alt_click)
local new_value = math.min(math.max(val + (alt_click and -1 or 1), 0), 99)
if val ~= new_value then updateVal(new_value) end
end
function updateVal(number)
val = number or 0
self.editButton({ index = 0, label = tostring(val) })
printToAll("Doom on agenda set to: " .. val)
end
end)
return __bundle_require("__root")