Convert lua files to unix line endings
This commit is contained in:
parent
9a9e849a87
commit
a67ca9db19
1484
unpacked.ttslua
1484
unpacked.ttslua
File diff suppressed because it is too large
Load Diff
@ -1,113 +1,113 @@
|
||||
--Counting Bowl by MrStump
|
||||
|
||||
--Table of items which can be counted in this Bowl
|
||||
--Each entry has 2 things to enter
|
||||
--a name (what is in the name field of that object)
|
||||
--a value (how much it is worth)
|
||||
--A number in the items description will override the number entry in this table
|
||||
validCountItemList = {
|
||||
["Clue"] = 1,
|
||||
[""] = 1,
|
||||
--["Name3"] = 2,
|
||||
--["Name4"] = 31,
|
||||
--Add more entries as needed
|
||||
--Remove the -- from before a line for the script to use it
|
||||
}
|
||||
|
||||
--END OF CODE TO EDIT
|
||||
|
||||
function onLoad()
|
||||
timerID = self.getGUID()..math.random(9999999999999)
|
||||
--Sets position/color for the button, spawns it
|
||||
self.createButton({
|
||||
label="", click_function="removeAllClues", function_owner=self,
|
||||
position={0,0,0}, rotation={0,8,0}, height=0, width=0,
|
||||
font_color={0,0,0}, font_size=2000
|
||||
})
|
||||
--Start timer which repeats forever, running countItems() every second
|
||||
Timer.create({
|
||||
identifier=timerID,
|
||||
function_name="countItems", function_owner=self,
|
||||
repetitions=0, delay=1
|
||||
})
|
||||
exposedValue = 0
|
||||
trashCan = getObjectFromGUID("147e80")
|
||||
end
|
||||
|
||||
function findValidItemsInSphere()
|
||||
return filterByValidity(findItemsInSphere())
|
||||
end
|
||||
|
||||
--Activated once per second, counts items in bowls
|
||||
function countItems()
|
||||
local totalValue = -1
|
||||
local countableItems = findValidItemsInSphere()
|
||||
for ind, entry in ipairs(countableItems) do
|
||||
local descValue = tonumber(entry.hit_object.getDescription())
|
||||
local stackMult = math.abs(entry.hit_object.getQuantity())
|
||||
--Use value in description if available
|
||||
if descValue ~= nil then
|
||||
totalValue = totalValue + descValue * stackMult
|
||||
else
|
||||
--Otherwise use the value in validCountItemList
|
||||
totalValue = totalValue + validCountItemList[entry.hit_object.getName()] * stackMult
|
||||
end
|
||||
end
|
||||
exposedValue = totalValue
|
||||
--Updates the number display
|
||||
self.editButton({index=0, label=totalValue})
|
||||
end
|
||||
|
||||
function filterByValidity(items)
|
||||
retval = {}
|
||||
for _, entry in ipairs(items) do
|
||||
--Ignore the bowl
|
||||
if entry.hit_object ~= self then
|
||||
--Ignore if not in validCountItemList
|
||||
local tableEntry = validCountItemList[entry.hit_object.getName()]
|
||||
if tableEntry ~= nil then
|
||||
table.insert(retval, entry)
|
||||
end
|
||||
end
|
||||
end
|
||||
return retval
|
||||
end
|
||||
|
||||
|
||||
--Gets the items in the bowl for countItems to count
|
||||
function findItemsInSphere()
|
||||
--Find scaling factor
|
||||
local scale = self.getScale()
|
||||
--Set position for the sphere
|
||||
local pos = self.getPosition()
|
||||
pos.y=pos.y+(1.25*scale.y)
|
||||
--Ray trace to get all objects
|
||||
return Physics.cast({
|
||||
origin=pos, direction={0,1,0}, type=2, max_distance=0,
|
||||
size={6*scale.x,6*scale.y,6*scale.z}, --debug=true
|
||||
})
|
||||
end
|
||||
|
||||
function removeAllClues()
|
||||
startLuaCoroutine(self, "clueRemovalCoroutine")
|
||||
end
|
||||
|
||||
function clueRemovalCoroutine()
|
||||
for _, entry in ipairs(findValidItemsInSphere()) do
|
||||
-- Do not put the table in the garbage
|
||||
if entry.hit_object.getGUID() ~= "4ee1f2" then
|
||||
--delay for animation purposes
|
||||
for k=1,10 do
|
||||
coroutine.yield(0)
|
||||
end
|
||||
trashCan.putObject(entry.hit_object)
|
||||
end
|
||||
end
|
||||
--coroutines must return a value
|
||||
return 1
|
||||
end
|
||||
|
||||
|
||||
function onDestroy()
|
||||
Timer.destroy(timerID)
|
||||
--Counting Bowl by MrStump
|
||||
|
||||
--Table of items which can be counted in this Bowl
|
||||
--Each entry has 2 things to enter
|
||||
--a name (what is in the name field of that object)
|
||||
--a value (how much it is worth)
|
||||
--A number in the items description will override the number entry in this table
|
||||
validCountItemList = {
|
||||
["Clue"] = 1,
|
||||
[""] = 1,
|
||||
--["Name3"] = 2,
|
||||
--["Name4"] = 31,
|
||||
--Add more entries as needed
|
||||
--Remove the -- from before a line for the script to use it
|
||||
}
|
||||
|
||||
--END OF CODE TO EDIT
|
||||
|
||||
function onLoad()
|
||||
timerID = self.getGUID()..math.random(9999999999999)
|
||||
--Sets position/color for the button, spawns it
|
||||
self.createButton({
|
||||
label="", click_function="removeAllClues", function_owner=self,
|
||||
position={0,0,0}, rotation={0,8,0}, height=0, width=0,
|
||||
font_color={0,0,0}, font_size=2000
|
||||
})
|
||||
--Start timer which repeats forever, running countItems() every second
|
||||
Timer.create({
|
||||
identifier=timerID,
|
||||
function_name="countItems", function_owner=self,
|
||||
repetitions=0, delay=1
|
||||
})
|
||||
exposedValue = 0
|
||||
trashCan = getObjectFromGUID("147e80")
|
||||
end
|
||||
|
||||
function findValidItemsInSphere()
|
||||
return filterByValidity(findItemsInSphere())
|
||||
end
|
||||
|
||||
--Activated once per second, counts items in bowls
|
||||
function countItems()
|
||||
local totalValue = -1
|
||||
local countableItems = findValidItemsInSphere()
|
||||
for ind, entry in ipairs(countableItems) do
|
||||
local descValue = tonumber(entry.hit_object.getDescription())
|
||||
local stackMult = math.abs(entry.hit_object.getQuantity())
|
||||
--Use value in description if available
|
||||
if descValue ~= nil then
|
||||
totalValue = totalValue + descValue * stackMult
|
||||
else
|
||||
--Otherwise use the value in validCountItemList
|
||||
totalValue = totalValue + validCountItemList[entry.hit_object.getName()] * stackMult
|
||||
end
|
||||
end
|
||||
exposedValue = totalValue
|
||||
--Updates the number display
|
||||
self.editButton({index=0, label=totalValue})
|
||||
end
|
||||
|
||||
function filterByValidity(items)
|
||||
retval = {}
|
||||
for _, entry in ipairs(items) do
|
||||
--Ignore the bowl
|
||||
if entry.hit_object ~= self then
|
||||
--Ignore if not in validCountItemList
|
||||
local tableEntry = validCountItemList[entry.hit_object.getName()]
|
||||
if tableEntry ~= nil then
|
||||
table.insert(retval, entry)
|
||||
end
|
||||
end
|
||||
end
|
||||
return retval
|
||||
end
|
||||
|
||||
|
||||
--Gets the items in the bowl for countItems to count
|
||||
function findItemsInSphere()
|
||||
--Find scaling factor
|
||||
local scale = self.getScale()
|
||||
--Set position for the sphere
|
||||
local pos = self.getPosition()
|
||||
pos.y=pos.y+(1.25*scale.y)
|
||||
--Ray trace to get all objects
|
||||
return Physics.cast({
|
||||
origin=pos, direction={0,1,0}, type=2, max_distance=0,
|
||||
size={6*scale.x,6*scale.y,6*scale.z}, --debug=true
|
||||
})
|
||||
end
|
||||
|
||||
function removeAllClues()
|
||||
startLuaCoroutine(self, "clueRemovalCoroutine")
|
||||
end
|
||||
|
||||
function clueRemovalCoroutine()
|
||||
for _, entry in ipairs(findValidItemsInSphere()) do
|
||||
-- Do not put the table in the garbage
|
||||
if entry.hit_object.getGUID() ~= "4ee1f2" then
|
||||
--delay for animation purposes
|
||||
for k=1,10 do
|
||||
coroutine.yield(0)
|
||||
end
|
||||
trashCan.putObject(entry.hit_object)
|
||||
end
|
||||
end
|
||||
--coroutines must return a value
|
||||
return 1
|
||||
end
|
||||
|
||||
|
||||
function onDestroy()
|
||||
Timer.destroy(timerID)
|
||||
end
|
@ -1,113 +1,113 @@
|
||||
--Counting Bowl by MrStump
|
||||
|
||||
--Table of items which can be counted in this Bowl
|
||||
--Each entry has 2 things to enter
|
||||
--a name (what is in the name field of that object)
|
||||
--a value (how much it is worth)
|
||||
--A number in the items description will override the number entry in this table
|
||||
validCountItemList = {
|
||||
["Clue"] = 1,
|
||||
[""] = 1,
|
||||
--["Name3"] = 2,
|
||||
--["Name4"] = 31,
|
||||
--Add more entries as needed
|
||||
--Remove the -- from before a line for the script to use it
|
||||
}
|
||||
|
||||
--END OF CODE TO EDIT
|
||||
|
||||
function onLoad()
|
||||
timerID = self.getGUID()..math.random(9999999999999)
|
||||
--Sets position/color for the button, spawns it
|
||||
self.createButton({
|
||||
label="", click_function="removeAllClues", function_owner=self,
|
||||
position={0,0,0}, rotation={0,8,0}, height=0, width=0,
|
||||
font_color={0,0,0}, font_size=2000
|
||||
})
|
||||
--Start timer which repeats forever, running countItems() every second
|
||||
Timer.create({
|
||||
identifier=timerID,
|
||||
function_name="countItems", function_owner=self,
|
||||
repetitions=0, delay=1
|
||||
})
|
||||
exposedValue = 0
|
||||
trashCan = getObjectFromGUID("147e80")
|
||||
end
|
||||
|
||||
function findValidItemsInSphere()
|
||||
return filterByValidity(findItemsInSphere())
|
||||
end
|
||||
|
||||
--Activated once per second, counts items in bowls
|
||||
function countItems()
|
||||
local totalValue = -1
|
||||
local countableItems = findValidItemsInSphere()
|
||||
for ind, entry in ipairs(countableItems) do
|
||||
local descValue = tonumber(entry.hit_object.getDescription())
|
||||
local stackMult = math.abs(entry.hit_object.getQuantity())
|
||||
--Use value in description if available
|
||||
if descValue ~= nil then
|
||||
totalValue = totalValue + descValue * stackMult
|
||||
else
|
||||
--Otherwise use the value in validCountItemList
|
||||
totalValue = totalValue + validCountItemList[entry.hit_object.getName()] * stackMult
|
||||
end
|
||||
end
|
||||
exposedValue = totalValue
|
||||
--Updates the number display
|
||||
self.editButton({index=0, label=totalValue})
|
||||
end
|
||||
|
||||
function filterByValidity(items)
|
||||
retval = {}
|
||||
for _, entry in ipairs(items) do
|
||||
--Ignore the bowl
|
||||
if entry.hit_object ~= self then
|
||||
--Ignore if not in validCountItemList
|
||||
local tableEntry = validCountItemList[entry.hit_object.getName()]
|
||||
if tableEntry ~= nil then
|
||||
table.insert(retval, entry)
|
||||
end
|
||||
end
|
||||
end
|
||||
return retval
|
||||
end
|
||||
|
||||
|
||||
--Gets the items in the bowl for countItems to count
|
||||
function findItemsInSphere()
|
||||
--Find scaling factor
|
||||
local scale = self.getScale()
|
||||
--Set position for the sphere
|
||||
local pos = self.getPosition()
|
||||
pos.y=pos.y+(1.25*scale.y)
|
||||
--Ray trace to get all objects
|
||||
return Physics.cast({
|
||||
origin=pos, direction={0,1,0}, type=2, max_distance=0,
|
||||
size={6*scale.x,6*scale.y,6*scale.z}, --debug=true
|
||||
})
|
||||
end
|
||||
|
||||
function removeAllClues()
|
||||
startLuaCoroutine(self, "clueRemovalCoroutine")
|
||||
end
|
||||
|
||||
function clueRemovalCoroutine()
|
||||
for _, entry in ipairs(findValidItemsInSphere()) do
|
||||
-- Do not put the table in the garbage
|
||||
if entry.hit_object.getGUID() ~= "4ee1f2" then
|
||||
--delay for animation purposes
|
||||
for k=1,10 do
|
||||
coroutine.yield(0)
|
||||
end
|
||||
trashCan.putObject(entry.hit_object)
|
||||
end
|
||||
end
|
||||
--coroutines must return a value
|
||||
return 1
|
||||
end
|
||||
|
||||
|
||||
function onDestroy()
|
||||
Timer.destroy(timerID)
|
||||
--Counting Bowl by MrStump
|
||||
|
||||
--Table of items which can be counted in this Bowl
|
||||
--Each entry has 2 things to enter
|
||||
--a name (what is in the name field of that object)
|
||||
--a value (how much it is worth)
|
||||
--A number in the items description will override the number entry in this table
|
||||
validCountItemList = {
|
||||
["Clue"] = 1,
|
||||
[""] = 1,
|
||||
--["Name3"] = 2,
|
||||
--["Name4"] = 31,
|
||||
--Add more entries as needed
|
||||
--Remove the -- from before a line for the script to use it
|
||||
}
|
||||
|
||||
--END OF CODE TO EDIT
|
||||
|
||||
function onLoad()
|
||||
timerID = self.getGUID()..math.random(9999999999999)
|
||||
--Sets position/color for the button, spawns it
|
||||
self.createButton({
|
||||
label="", click_function="removeAllClues", function_owner=self,
|
||||
position={0,0,0}, rotation={0,8,0}, height=0, width=0,
|
||||
font_color={0,0,0}, font_size=2000
|
||||
})
|
||||
--Start timer which repeats forever, running countItems() every second
|
||||
Timer.create({
|
||||
identifier=timerID,
|
||||
function_name="countItems", function_owner=self,
|
||||
repetitions=0, delay=1
|
||||
})
|
||||
exposedValue = 0
|
||||
trashCan = getObjectFromGUID("147e80")
|
||||
end
|
||||
|
||||
function findValidItemsInSphere()
|
||||
return filterByValidity(findItemsInSphere())
|
||||
end
|
||||
|
||||
--Activated once per second, counts items in bowls
|
||||
function countItems()
|
||||
local totalValue = -1
|
||||
local countableItems = findValidItemsInSphere()
|
||||
for ind, entry in ipairs(countableItems) do
|
||||
local descValue = tonumber(entry.hit_object.getDescription())
|
||||
local stackMult = math.abs(entry.hit_object.getQuantity())
|
||||
--Use value in description if available
|
||||
if descValue ~= nil then
|
||||
totalValue = totalValue + descValue * stackMult
|
||||
else
|
||||
--Otherwise use the value in validCountItemList
|
||||
totalValue = totalValue + validCountItemList[entry.hit_object.getName()] * stackMult
|
||||
end
|
||||
end
|
||||
exposedValue = totalValue
|
||||
--Updates the number display
|
||||
self.editButton({index=0, label=totalValue})
|
||||
end
|
||||
|
||||
function filterByValidity(items)
|
||||
retval = {}
|
||||
for _, entry in ipairs(items) do
|
||||
--Ignore the bowl
|
||||
if entry.hit_object ~= self then
|
||||
--Ignore if not in validCountItemList
|
||||
local tableEntry = validCountItemList[entry.hit_object.getName()]
|
||||
if tableEntry ~= nil then
|
||||
table.insert(retval, entry)
|
||||
end
|
||||
end
|
||||
end
|
||||
return retval
|
||||
end
|
||||
|
||||
|
||||
--Gets the items in the bowl for countItems to count
|
||||
function findItemsInSphere()
|
||||
--Find scaling factor
|
||||
local scale = self.getScale()
|
||||
--Set position for the sphere
|
||||
local pos = self.getPosition()
|
||||
pos.y=pos.y+(1.25*scale.y)
|
||||
--Ray trace to get all objects
|
||||
return Physics.cast({
|
||||
origin=pos, direction={0,1,0}, type=2, max_distance=0,
|
||||
size={6*scale.x,6*scale.y,6*scale.z}, --debug=true
|
||||
})
|
||||
end
|
||||
|
||||
function removeAllClues()
|
||||
startLuaCoroutine(self, "clueRemovalCoroutine")
|
||||
end
|
||||
|
||||
function clueRemovalCoroutine()
|
||||
for _, entry in ipairs(findValidItemsInSphere()) do
|
||||
-- Do not put the table in the garbage
|
||||
if entry.hit_object.getGUID() ~= "4ee1f2" then
|
||||
--delay for animation purposes
|
||||
for k=1,10 do
|
||||
coroutine.yield(0)
|
||||
end
|
||||
trashCan.putObject(entry.hit_object)
|
||||
end
|
||||
end
|
||||
--coroutines must return a value
|
||||
return 1
|
||||
end
|
||||
|
||||
|
||||
function onDestroy()
|
||||
Timer.destroy(timerID)
|
||||
end
|
@ -1,113 +1,113 @@
|
||||
--Counting Bowl by MrStump
|
||||
|
||||
--Table of items which can be counted in this Bowl
|
||||
--Each entry has 2 things to enter
|
||||
--a name (what is in the name field of that object)
|
||||
--a value (how much it is worth)
|
||||
--A number in the items description will override the number entry in this table
|
||||
validCountItemList = {
|
||||
["Clue"] = 1,
|
||||
[""] = 1,
|
||||
--["Name3"] = 2,
|
||||
--["Name4"] = 31,
|
||||
--Add more entries as needed
|
||||
--Remove the -- from before a line for the script to use it
|
||||
}
|
||||
|
||||
--END OF CODE TO EDIT
|
||||
|
||||
function onLoad()
|
||||
timerID = self.getGUID()..math.random(9999999999999)
|
||||
--Sets position/color for the button, spawns it
|
||||
self.createButton({
|
||||
label="", click_function="removeAllClues", function_owner=self,
|
||||
position={0,0,0}, rotation={0,8,0}, height=0, width=0,
|
||||
font_color={0,0,0}, font_size=2000
|
||||
})
|
||||
--Start timer which repeats forever, running countItems() every second
|
||||
Timer.create({
|
||||
identifier=timerID,
|
||||
function_name="countItems", function_owner=self,
|
||||
repetitions=0, delay=1
|
||||
})
|
||||
exposedValue = 0
|
||||
trashCan = getObjectFromGUID("147e80")
|
||||
end
|
||||
|
||||
function findValidItemsInSphere()
|
||||
return filterByValidity(findItemsInSphere())
|
||||
end
|
||||
|
||||
--Activated once per second, counts items in bowls
|
||||
function countItems()
|
||||
local totalValue = -1
|
||||
local countableItems = findValidItemsInSphere()
|
||||
for ind, entry in ipairs(countableItems) do
|
||||
local descValue = tonumber(entry.hit_object.getDescription())
|
||||
local stackMult = math.abs(entry.hit_object.getQuantity())
|
||||
--Use value in description if available
|
||||
if descValue ~= nil then
|
||||
totalValue = totalValue + descValue * stackMult
|
||||
else
|
||||
--Otherwise use the value in validCountItemList
|
||||
totalValue = totalValue + validCountItemList[entry.hit_object.getName()] * stackMult
|
||||
end
|
||||
end
|
||||
exposedValue = totalValue
|
||||
--Updates the number display
|
||||
self.editButton({index=0, label=totalValue})
|
||||
end
|
||||
|
||||
function filterByValidity(items)
|
||||
retval = {}
|
||||
for _, entry in ipairs(items) do
|
||||
--Ignore the bowl
|
||||
if entry.hit_object ~= self then
|
||||
--Ignore if not in validCountItemList
|
||||
local tableEntry = validCountItemList[entry.hit_object.getName()]
|
||||
if tableEntry ~= nil then
|
||||
table.insert(retval, entry)
|
||||
end
|
||||
end
|
||||
end
|
||||
return retval
|
||||
end
|
||||
|
||||
|
||||
--Gets the items in the bowl for countItems to count
|
||||
function findItemsInSphere()
|
||||
--Find scaling factor
|
||||
local scale = self.getScale()
|
||||
--Set position for the sphere
|
||||
local pos = self.getPosition()
|
||||
pos.y=pos.y+(1.25*scale.y)
|
||||
--Ray trace to get all objects
|
||||
return Physics.cast({
|
||||
origin=pos, direction={0,1,0}, type=2, max_distance=0,
|
||||
size={6*scale.x,6*scale.y,6*scale.z}, --debug=true
|
||||
})
|
||||
end
|
||||
|
||||
function removeAllClues()
|
||||
startLuaCoroutine(self, "clueRemovalCoroutine")
|
||||
end
|
||||
|
||||
function clueRemovalCoroutine()
|
||||
for _, entry in ipairs(findValidItemsInSphere()) do
|
||||
-- Do not put the table in the garbage
|
||||
if entry.hit_object.getGUID() ~= "4ee1f2" then
|
||||
--delay for animation purposes
|
||||
for k=1,10 do
|
||||
coroutine.yield(0)
|
||||
end
|
||||
trashCan.putObject(entry.hit_object)
|
||||
end
|
||||
end
|
||||
--coroutines must return a value
|
||||
return 1
|
||||
end
|
||||
|
||||
|
||||
function onDestroy()
|
||||
Timer.destroy(timerID)
|
||||
--Counting Bowl by MrStump
|
||||
|
||||
--Table of items which can be counted in this Bowl
|
||||
--Each entry has 2 things to enter
|
||||
--a name (what is in the name field of that object)
|
||||
--a value (how much it is worth)
|
||||
--A number in the items description will override the number entry in this table
|
||||
validCountItemList = {
|
||||
["Clue"] = 1,
|
||||
[""] = 1,
|
||||
--["Name3"] = 2,
|
||||
--["Name4"] = 31,
|
||||
--Add more entries as needed
|
||||
--Remove the -- from before a line for the script to use it
|
||||
}
|
||||
|
||||
--END OF CODE TO EDIT
|
||||
|
||||
function onLoad()
|
||||
timerID = self.getGUID()..math.random(9999999999999)
|
||||
--Sets position/color for the button, spawns it
|
||||
self.createButton({
|
||||
label="", click_function="removeAllClues", function_owner=self,
|
||||
position={0,0,0}, rotation={0,8,0}, height=0, width=0,
|
||||
font_color={0,0,0}, font_size=2000
|
||||
})
|
||||
--Start timer which repeats forever, running countItems() every second
|
||||
Timer.create({
|
||||
identifier=timerID,
|
||||
function_name="countItems", function_owner=self,
|
||||
repetitions=0, delay=1
|
||||
})
|
||||
exposedValue = 0
|
||||
trashCan = getObjectFromGUID("147e80")
|
||||
end
|
||||
|
||||
function findValidItemsInSphere()
|
||||
return filterByValidity(findItemsInSphere())
|
||||
end
|
||||
|
||||
--Activated once per second, counts items in bowls
|
||||
function countItems()
|
||||
local totalValue = -1
|
||||
local countableItems = findValidItemsInSphere()
|
||||
for ind, entry in ipairs(countableItems) do
|
||||
local descValue = tonumber(entry.hit_object.getDescription())
|
||||
local stackMult = math.abs(entry.hit_object.getQuantity())
|
||||
--Use value in description if available
|
||||
if descValue ~= nil then
|
||||
totalValue = totalValue + descValue * stackMult
|
||||
else
|
||||
--Otherwise use the value in validCountItemList
|
||||
totalValue = totalValue + validCountItemList[entry.hit_object.getName()] * stackMult
|
||||
end
|
||||
end
|
||||
exposedValue = totalValue
|
||||
--Updates the number display
|
||||
self.editButton({index=0, label=totalValue})
|
||||
end
|
||||
|
||||
function filterByValidity(items)
|
||||
retval = {}
|
||||
for _, entry in ipairs(items) do
|
||||
--Ignore the bowl
|
||||
if entry.hit_object ~= self then
|
||||
--Ignore if not in validCountItemList
|
||||
local tableEntry = validCountItemList[entry.hit_object.getName()]
|
||||
if tableEntry ~= nil then
|
||||
table.insert(retval, entry)
|
||||
end
|
||||
end
|
||||
end
|
||||
return retval
|
||||
end
|
||||
|
||||
|
||||
--Gets the items in the bowl for countItems to count
|
||||
function findItemsInSphere()
|
||||
--Find scaling factor
|
||||
local scale = self.getScale()
|
||||
--Set position for the sphere
|
||||
local pos = self.getPosition()
|
||||
pos.y=pos.y+(1.25*scale.y)
|
||||
--Ray trace to get all objects
|
||||
return Physics.cast({
|
||||
origin=pos, direction={0,1,0}, type=2, max_distance=0,
|
||||
size={6*scale.x,6*scale.y,6*scale.z}, --debug=true
|
||||
})
|
||||
end
|
||||
|
||||
function removeAllClues()
|
||||
startLuaCoroutine(self, "clueRemovalCoroutine")
|
||||
end
|
||||
|
||||
function clueRemovalCoroutine()
|
||||
for _, entry in ipairs(findValidItemsInSphere()) do
|
||||
-- Do not put the table in the garbage
|
||||
if entry.hit_object.getGUID() ~= "4ee1f2" then
|
||||
--delay for animation purposes
|
||||
for k=1,10 do
|
||||
coroutine.yield(0)
|
||||
end
|
||||
trashCan.putObject(entry.hit_object)
|
||||
end
|
||||
end
|
||||
--coroutines must return a value
|
||||
return 1
|
||||
end
|
||||
|
||||
|
||||
function onDestroy()
|
||||
Timer.destroy(timerID)
|
||||
end
|
@ -1,113 +1,113 @@
|
||||
--Counting Bowl by MrStump
|
||||
|
||||
--Table of items which can be counted in this Bowl
|
||||
--Each entry has 2 things to enter
|
||||
--a name (what is in the name field of that object)
|
||||
--a value (how much it is worth)
|
||||
--A number in the items description will override the number entry in this table
|
||||
validCountItemList = {
|
||||
["Clue"] = 1,
|
||||
[""] = 1,
|
||||
--["Name3"] = 2,
|
||||
--["Name4"] = 31,
|
||||
--Add more entries as needed
|
||||
--Remove the -- from before a line for the script to use it
|
||||
}
|
||||
|
||||
--END OF CODE TO EDIT
|
||||
|
||||
function onLoad()
|
||||
timerID = self.getGUID()..math.random(9999999999999)
|
||||
--Sets position/color for the button, spawns it
|
||||
self.createButton({
|
||||
label="", click_function="removeAllClues", function_owner=self,
|
||||
position={0,0,0}, rotation={0,8,0}, height=0, width=0,
|
||||
font_color={0,0,0}, font_size=2000
|
||||
})
|
||||
--Start timer which repeats forever, running countItems() every second
|
||||
Timer.create({
|
||||
identifier=timerID,
|
||||
function_name="countItems", function_owner=self,
|
||||
repetitions=0, delay=1
|
||||
})
|
||||
exposedValue = 0
|
||||
trashCan = getObjectFromGUID("147e80")
|
||||
end
|
||||
|
||||
function findValidItemsInSphere()
|
||||
return filterByValidity(findItemsInSphere())
|
||||
end
|
||||
|
||||
--Activated once per second, counts items in bowls
|
||||
function countItems()
|
||||
local totalValue = -1
|
||||
local countableItems = findValidItemsInSphere()
|
||||
for ind, entry in ipairs(countableItems) do
|
||||
local descValue = tonumber(entry.hit_object.getDescription())
|
||||
local stackMult = math.abs(entry.hit_object.getQuantity())
|
||||
--Use value in description if available
|
||||
if descValue ~= nil then
|
||||
totalValue = totalValue + descValue * stackMult
|
||||
else
|
||||
--Otherwise use the value in validCountItemList
|
||||
totalValue = totalValue + validCountItemList[entry.hit_object.getName()] * stackMult
|
||||
end
|
||||
end
|
||||
exposedValue = totalValue
|
||||
--Updates the number display
|
||||
self.editButton({index=0, label=totalValue})
|
||||
end
|
||||
|
||||
function filterByValidity(items)
|
||||
retval = {}
|
||||
for _, entry in ipairs(items) do
|
||||
--Ignore the bowl
|
||||
if entry.hit_object ~= self then
|
||||
--Ignore if not in validCountItemList
|
||||
local tableEntry = validCountItemList[entry.hit_object.getName()]
|
||||
if tableEntry ~= nil then
|
||||
table.insert(retval, entry)
|
||||
end
|
||||
end
|
||||
end
|
||||
return retval
|
||||
end
|
||||
|
||||
|
||||
--Gets the items in the bowl for countItems to count
|
||||
function findItemsInSphere()
|
||||
--Find scaling factor
|
||||
local scale = self.getScale()
|
||||
--Set position for the sphere
|
||||
local pos = self.getPosition()
|
||||
pos.y=pos.y+(1.25*scale.y)
|
||||
--Ray trace to get all objects
|
||||
return Physics.cast({
|
||||
origin=pos, direction={0,1,0}, type=2, max_distance=0,
|
||||
size={6*scale.x,6*scale.y,6*scale.z}, --debug=true
|
||||
})
|
||||
end
|
||||
|
||||
function removeAllClues()
|
||||
startLuaCoroutine(self, "clueRemovalCoroutine")
|
||||
end
|
||||
|
||||
function clueRemovalCoroutine()
|
||||
for _, entry in ipairs(findValidItemsInSphere()) do
|
||||
-- Do not put the table in the garbage
|
||||
if entry.hit_object.getGUID() ~= "4ee1f2" then
|
||||
--delay for animation purposes
|
||||
for k=1,10 do
|
||||
coroutine.yield(0)
|
||||
end
|
||||
trashCan.putObject(entry.hit_object)
|
||||
end
|
||||
end
|
||||
--coroutines must return a value
|
||||
return 1
|
||||
end
|
||||
|
||||
|
||||
function onDestroy()
|
||||
Timer.destroy(timerID)
|
||||
--Counting Bowl by MrStump
|
||||
|
||||
--Table of items which can be counted in this Bowl
|
||||
--Each entry has 2 things to enter
|
||||
--a name (what is in the name field of that object)
|
||||
--a value (how much it is worth)
|
||||
--A number in the items description will override the number entry in this table
|
||||
validCountItemList = {
|
||||
["Clue"] = 1,
|
||||
[""] = 1,
|
||||
--["Name3"] = 2,
|
||||
--["Name4"] = 31,
|
||||
--Add more entries as needed
|
||||
--Remove the -- from before a line for the script to use it
|
||||
}
|
||||
|
||||
--END OF CODE TO EDIT
|
||||
|
||||
function onLoad()
|
||||
timerID = self.getGUID()..math.random(9999999999999)
|
||||
--Sets position/color for the button, spawns it
|
||||
self.createButton({
|
||||
label="", click_function="removeAllClues", function_owner=self,
|
||||
position={0,0,0}, rotation={0,8,0}, height=0, width=0,
|
||||
font_color={0,0,0}, font_size=2000
|
||||
})
|
||||
--Start timer which repeats forever, running countItems() every second
|
||||
Timer.create({
|
||||
identifier=timerID,
|
||||
function_name="countItems", function_owner=self,
|
||||
repetitions=0, delay=1
|
||||
})
|
||||
exposedValue = 0
|
||||
trashCan = getObjectFromGUID("147e80")
|
||||
end
|
||||
|
||||
function findValidItemsInSphere()
|
||||
return filterByValidity(findItemsInSphere())
|
||||
end
|
||||
|
||||
--Activated once per second, counts items in bowls
|
||||
function countItems()
|
||||
local totalValue = -1
|
||||
local countableItems = findValidItemsInSphere()
|
||||
for ind, entry in ipairs(countableItems) do
|
||||
local descValue = tonumber(entry.hit_object.getDescription())
|
||||
local stackMult = math.abs(entry.hit_object.getQuantity())
|
||||
--Use value in description if available
|
||||
if descValue ~= nil then
|
||||
totalValue = totalValue + descValue * stackMult
|
||||
else
|
||||
--Otherwise use the value in validCountItemList
|
||||
totalValue = totalValue + validCountItemList[entry.hit_object.getName()] * stackMult
|
||||
end
|
||||
end
|
||||
exposedValue = totalValue
|
||||
--Updates the number display
|
||||
self.editButton({index=0, label=totalValue})
|
||||
end
|
||||
|
||||
function filterByValidity(items)
|
||||
retval = {}
|
||||
for _, entry in ipairs(items) do
|
||||
--Ignore the bowl
|
||||
if entry.hit_object ~= self then
|
||||
--Ignore if not in validCountItemList
|
||||
local tableEntry = validCountItemList[entry.hit_object.getName()]
|
||||
if tableEntry ~= nil then
|
||||
table.insert(retval, entry)
|
||||
end
|
||||
end
|
||||
end
|
||||
return retval
|
||||
end
|
||||
|
||||
|
||||
--Gets the items in the bowl for countItems to count
|
||||
function findItemsInSphere()
|
||||
--Find scaling factor
|
||||
local scale = self.getScale()
|
||||
--Set position for the sphere
|
||||
local pos = self.getPosition()
|
||||
pos.y=pos.y+(1.25*scale.y)
|
||||
--Ray trace to get all objects
|
||||
return Physics.cast({
|
||||
origin=pos, direction={0,1,0}, type=2, max_distance=0,
|
||||
size={6*scale.x,6*scale.y,6*scale.z}, --debug=true
|
||||
})
|
||||
end
|
||||
|
||||
function removeAllClues()
|
||||
startLuaCoroutine(self, "clueRemovalCoroutine")
|
||||
end
|
||||
|
||||
function clueRemovalCoroutine()
|
||||
for _, entry in ipairs(findValidItemsInSphere()) do
|
||||
-- Do not put the table in the garbage
|
||||
if entry.hit_object.getGUID() ~= "4ee1f2" then
|
||||
--delay for animation purposes
|
||||
for k=1,10 do
|
||||
coroutine.yield(0)
|
||||
end
|
||||
trashCan.putObject(entry.hit_object)
|
||||
end
|
||||
end
|
||||
--coroutines must return a value
|
||||
return 1
|
||||
end
|
||||
|
||||
|
||||
function onDestroy()
|
||||
Timer.destroy(timerID)
|
||||
end
|
@ -1,37 +1,37 @@
|
||||
-- set true to enable debug logging
|
||||
DEBUG = false
|
||||
|
||||
function log(message)
|
||||
if DEBUG then
|
||||
print(message)
|
||||
end
|
||||
end
|
||||
|
||||
--[[
|
||||
Known locations and clues. We check this to determine if we should
|
||||
atttempt to spawn clues, first we look for <LOCATION_NAME>_<GUID> and if
|
||||
we find nothing we look for <LOCATION_NAME>
|
||||
format is [location_guid -> clueCount]
|
||||
]]
|
||||
LOCATIONS_DATA_JSON = [[
|
||||
{
|
||||
"San Francisco": {"type": "fixed", "value": 1, "clueSide": "back"},
|
||||
" Arkham": {"type": "perPlayer", "value": 1, "clueSide": "back"},
|
||||
"Buenos Aires": {"type": "fixed", "value": 2, "clueSide": "back"},
|
||||
" London": {"type": "perPlayer", "value": 2, "clueSide": "front"},
|
||||
"Rome": {"type": "perPlayer", "value": 3, "clueSide": "front"},
|
||||
"Istanbul": {"type": "perPlayer", "value": 4, "clueSide": "front"},
|
||||
"Tokyo_123abc": {"type": "perPlayer", "value": 0, "clueSide": "back"},
|
||||
-- set true to enable debug logging
|
||||
DEBUG = false
|
||||
|
||||
function log(message)
|
||||
if DEBUG then
|
||||
print(message)
|
||||
end
|
||||
end
|
||||
|
||||
--[[
|
||||
Known locations and clues. We check this to determine if we should
|
||||
atttempt to spawn clues, first we look for <LOCATION_NAME>_<GUID> and if
|
||||
we find nothing we look for <LOCATION_NAME>
|
||||
format is [location_guid -> clueCount]
|
||||
]]
|
||||
LOCATIONS_DATA_JSON = [[
|
||||
{
|
||||
"San Francisco": {"type": "fixed", "value": 1, "clueSide": "back"},
|
||||
" Arkham": {"type": "perPlayer", "value": 1, "clueSide": "back"},
|
||||
"Buenos Aires": {"type": "fixed", "value": 2, "clueSide": "back"},
|
||||
" London": {"type": "perPlayer", "value": 2, "clueSide": "front"},
|
||||
"Rome": {"type": "perPlayer", "value": 3, "clueSide": "front"},
|
||||
"Istanbul": {"type": "perPlayer", "value": 4, "clueSide": "front"},
|
||||
"Tokyo_123abc": {"type": "perPlayer", "value": 0, "clueSide": "back"},
|
||||
"Tokyo_456efg": {"type": "perPlayer", "value": 4, "clueSide": "back"},
|
||||
"Tokyo": {"type": "fixed", "value": 2, "clueSide": "back"},
|
||||
"Shanghai_123": {"type": "fixed", "value": 12, "clueSide": "front"},
|
||||
"Sydney": {"type": "fixed", "value": 0, "clueSide": "front"}
|
||||
}
|
||||
]]
|
||||
|
||||
LOCATIONS_DATA = JSON.decode(LOCATIONS_DATA_JSON)
|
||||
|
||||
function onload(save_state)
|
||||
local playArea = getObjectFromGUID('721ba2')
|
||||
playArea.call("updateLocations", {self.getGUID()})
|
||||
end
|
||||
"Shanghai_123": {"type": "fixed", "value": 12, "clueSide": "front"},
|
||||
"Sydney": {"type": "fixed", "value": 0, "clueSide": "front"}
|
||||
}
|
||||
]]
|
||||
|
||||
LOCATIONS_DATA = JSON.decode(LOCATIONS_DATA_JSON)
|
||||
|
||||
function onload(save_state)
|
||||
local playArea = getObjectFromGUID('721ba2')
|
||||
playArea.call("updateLocations", {self.getGUID()})
|
||||
end
|
||||
|
@ -1,36 +1,36 @@
|
||||
function onLoad()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--self.interactable = false
|
||||
self.createButton({
|
||||
click_function= "onButtonClick",
|
||||
function_owner= self,
|
||||
position= {0, 1.84, 0},
|
||||
width = 1500,
|
||||
height = 1000,
|
||||
color = {0,0,0,0},
|
||||
tooltip= "click here to load cards first",
|
||||
})end
|
||||
|
||||
function onButtonClick(obj, playerColor)
|
||||
if Player[playerColor].admin and self.getQuantity() > 0 then
|
||||
|
||||
|
||||
|
||||
--AllCard Deck
|
||||
self.takeObject ({
|
||||
position= {-63.36, 5, -65.69},
|
||||
rotation = {180,90,0},
|
||||
smooth= true,})
|
||||
|
||||
--AllCard Deck
|
||||
self.takeObject ({
|
||||
position= {-63.34, 1.43, -77.75},
|
||||
rotation = {180,90,0},
|
||||
smooth= true,})
|
||||
|
||||
end
|
||||
function onLoad()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--self.interactable = false
|
||||
self.createButton({
|
||||
click_function= "onButtonClick",
|
||||
function_owner= self,
|
||||
position= {0, 1.84, 0},
|
||||
width = 1500,
|
||||
height = 1000,
|
||||
color = {0,0,0,0},
|
||||
tooltip= "click here to load cards first",
|
||||
})end
|
||||
|
||||
function onButtonClick(obj, playerColor)
|
||||
if Player[playerColor].admin and self.getQuantity() > 0 then
|
||||
|
||||
|
||||
|
||||
--AllCard Deck
|
||||
self.takeObject ({
|
||||
position= {-63.36, 5, -65.69},
|
||||
rotation = {180,90,0},
|
||||
smooth= true,})
|
||||
|
||||
--AllCard Deck
|
||||
self.takeObject ({
|
||||
position= {-63.34, 1.43, -77.75},
|
||||
rotation = {180,90,0},
|
||||
smooth= true,})
|
||||
|
||||
end
|
||||
end
|
@ -1,5 +1,5 @@
|
||||
function onCollisionEnter(collision_info)
|
||||
self.shuffle()
|
||||
self.shuffle()
|
||||
self.shuffle()
|
||||
function onCollisionEnter(collision_info)
|
||||
self.shuffle()
|
||||
self.shuffle()
|
||||
self.shuffle()
|
||||
end
|
@ -1,273 +1,273 @@
|
||||
function updateSave()
|
||||
local data_to_save = {["ml"]=memoryList}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function onload(saved_data)
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
--Set up information off of loaded_data
|
||||
memoryList = loaded_data.ml
|
||||
else
|
||||
--Set up information for if there is no saved saved data
|
||||
memoryList = {}
|
||||
end
|
||||
|
||||
if next(memoryList) == nil then
|
||||
createSetupButton()
|
||||
else
|
||||
createMemoryActionButtons()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--Beginning Setup
|
||||
|
||||
|
||||
--Make setup button
|
||||
function createSetupButton()
|
||||
self.createButton({
|
||||
label="Setup", click_function="buttonClick_setup", function_owner=self,
|
||||
position={0,5,-2}, rotation={0,0,0}, height=250, width=600,
|
||||
font_size=150, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
end
|
||||
|
||||
--Triggered by setup button,
|
||||
function buttonClick_setup()
|
||||
memoryListBackup = duplicateTable(memoryList)
|
||||
memoryList = {}
|
||||
self.clearButtons()
|
||||
createButtonsOnAllObjects()
|
||||
createSetupActionButtons()
|
||||
end
|
||||
|
||||
--Creates selection buttons on objects
|
||||
function createButtonsOnAllObjects()
|
||||
local howManyButtons = 0
|
||||
for _, obj in ipairs(getAllObjects()) do
|
||||
if obj ~= self then
|
||||
local dummyIndex = howManyButtons
|
||||
--On a normal bag, the button positions aren't the same size as the bag.
|
||||
globalScaleFactor = 1.25 * 1/self.getScale().x
|
||||
--Super sweet math to set button positions
|
||||
local selfPos = self.getPosition()
|
||||
local objPos = obj.getPosition()
|
||||
local deltaPos = findOffsetDistance(selfPos, objPos, obj)
|
||||
local objPos = rotateLocalCoordinates(deltaPos, self)
|
||||
objPos.x = -objPos.x * globalScaleFactor
|
||||
objPos.y = objPos.y * globalScaleFactor
|
||||
objPos.z = objPos.z * 4
|
||||
--Offset rotation of bag
|
||||
local rot = self.getRotation()
|
||||
rot.y = -rot.y + 180
|
||||
--Create function
|
||||
local funcName = "selectButton_" .. howManyButtons
|
||||
local func = function() buttonClick_selection(dummyIndex, obj) end
|
||||
self.setVar(funcName, func)
|
||||
self.createButton({
|
||||
click_function=funcName, function_owner=self,
|
||||
position=objPos, rotation=rot, height=1000, width=1000,
|
||||
color={0.75,0.25,0.25,0.6},
|
||||
})
|
||||
howManyButtons = howManyButtons + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Creates submit and cancel buttons
|
||||
function createSetupActionButtons()
|
||||
self.createButton({
|
||||
label="Cancel", click_function="buttonClick_cancel", function_owner=self,
|
||||
position={1.5,5,2}, rotation={0,0,0}, height=350, width=1100,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Submit", click_function="buttonClick_submit", function_owner=self,
|
||||
position={-1.2,5,2}, rotation={0,0,0}, height=350, width=1100,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Reset", click_function="buttonClick_reset", function_owner=self,
|
||||
position={-3.5,5,2}, rotation={0,0,0}, height=350, width=800,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
--During Setup
|
||||
|
||||
|
||||
--Checks or unchecks buttons
|
||||
function buttonClick_selection(index, obj)
|
||||
local color = {0,1,0,0.6}
|
||||
if memoryList[obj.getGUID()] == nil then
|
||||
self.editButton({index=index, color=color})
|
||||
--Adding pos/rot to memory table
|
||||
local pos, rot = obj.getPosition(), obj.getRotation()
|
||||
--I need to add it like this or it won't save due to indexing issue
|
||||
memoryList[obj.getGUID()] = {
|
||||
pos={x=round(pos.x,4), y=round(pos.y,4), z=round(pos.z,4)},
|
||||
rot={x=round(rot.x,4), y=round(rot.y,4), z=round(rot.z,4)},
|
||||
lock=obj.getLock()
|
||||
}
|
||||
obj.highlightOn({0,1,0})
|
||||
else
|
||||
color = {0.75,0.25,0.25,0.6}
|
||||
self.editButton({index=index, color=color})
|
||||
memoryList[obj.getGUID()] = nil
|
||||
obj.highlightOff()
|
||||
end
|
||||
end
|
||||
|
||||
--Cancels selection process
|
||||
function buttonClick_cancel()
|
||||
memoryList = memoryListBackup
|
||||
self.clearButtons()
|
||||
if next(memoryList) == nil then
|
||||
createSetupButton()
|
||||
else
|
||||
createMemoryActionButtons()
|
||||
end
|
||||
removeAllHighlights()
|
||||
broadcastToAll("Selection Canceled", {1,1,1})
|
||||
end
|
||||
|
||||
--Saves selections
|
||||
function buttonClick_submit()
|
||||
if next(memoryList) == nil then
|
||||
broadcastToAll("You cannot submit without any selections.", {0.75, 0.25, 0.25})
|
||||
else
|
||||
self.clearButtons()
|
||||
createMemoryActionButtons()
|
||||
local count = 0
|
||||
for guid in pairs(memoryList) do
|
||||
count = count + 1
|
||||
local obj = getObjectFromGUID(guid)
|
||||
if obj ~= nil then obj.highlightOff() end
|
||||
end
|
||||
broadcastToAll(count.." Objects Saved", {1,1,1})
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
--Resets bag to starting status
|
||||
function buttonClick_reset()
|
||||
memoryList = {}
|
||||
self.clearButtons()
|
||||
createSetupButton()
|
||||
removeAllHighlights()
|
||||
broadcastToAll("Tool Reset", {1,1,1})
|
||||
updateSave()
|
||||
end
|
||||
|
||||
|
||||
--After Setup
|
||||
|
||||
|
||||
--Creates recall and place buttons
|
||||
function createMemoryActionButtons()
|
||||
self.createButton({
|
||||
label="Clicker", click_function="buttonClick_place", function_owner=self,
|
||||
position={4.2,1,0}, rotation={0,0,0}, height=500, width=1100,
|
||||
font_size=350, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Counter", click_function="buttonClick_recall", function_owner=self,
|
||||
position={-4.2,1,-0.1}, rotation={0,0,0}, height=500, width=1300,
|
||||
font_size=350, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
-- self.createButton({
|
||||
-- label="Setup", click_function="buttonClick_setup", function_owner=self,
|
||||
-- position={-6,1,0}, rotation={0,90,0}, height=500, width=1200,
|
||||
-- font_size=350, color={0,0,0}, font_color={1,1,1}
|
||||
-- })
|
||||
end
|
||||
|
||||
--Sends objects from bag/table to their saved position/rotation
|
||||
function buttonClick_place()
|
||||
local bagObjList = self.getObjects()
|
||||
for guid, entry in pairs(memoryList) do
|
||||
local obj = getObjectFromGUID(guid)
|
||||
--If obj is out on the table, move it to the saved pos/rot
|
||||
if obj ~= nil then
|
||||
obj.setPositionSmooth(entry.pos)
|
||||
obj.setRotationSmooth(entry.rot)
|
||||
obj.setLock(entry.lock)
|
||||
else
|
||||
--If obj is inside of the bag
|
||||
for _, bagObj in ipairs(bagObjList) do
|
||||
if bagObj.guid == guid then
|
||||
local item = self.takeObject({
|
||||
guid=guid, position=entry.pos, rotation=entry.rot,
|
||||
})
|
||||
item.setLock(entry.lock)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
broadcastToAll("Objects Placed", {1,1,1})
|
||||
end
|
||||
|
||||
--Recalls objects to bag from table
|
||||
function buttonClick_recall()
|
||||
for guid, entry in pairs(memoryList) do
|
||||
local obj = getObjectFromGUID(guid)
|
||||
if obj ~= nil then self.putObject(obj) end
|
||||
end
|
||||
broadcastToAll("Objects Recalled", {1,1,1})
|
||||
end
|
||||
|
||||
|
||||
--Utility functions
|
||||
|
||||
|
||||
--Find delta (difference) between 2 x/y/z coordinates
|
||||
function findOffsetDistance(p1, p2, obj)
|
||||
local deltaPos = {}
|
||||
local bounds = obj.getBounds()
|
||||
deltaPos.x = (p2.x-p1.x)
|
||||
deltaPos.y = (p2.y-p1.y) + (bounds.size.y - bounds.offset.y)
|
||||
deltaPos.z = (p2.z-p1.z)
|
||||
return deltaPos
|
||||
end
|
||||
|
||||
--Used to rotate a set of coordinates by an angle
|
||||
function rotateLocalCoordinates(desiredPos, obj)
|
||||
local objPos, objRot = obj.getPosition(), obj.getRotation()
|
||||
local angle = math.rad(objRot.y)
|
||||
local x = desiredPos.x * math.cos(angle) - desiredPos.z * math.sin(angle)
|
||||
local z = desiredPos.x * math.sin(angle) + desiredPos.z * math.cos(angle)
|
||||
--return {x=objPos.x+x, y=objPos.y+desiredPos.y, z=objPos.z+z}
|
||||
return {x=x, y=desiredPos.y, z=z}
|
||||
end
|
||||
|
||||
--Coroutine delay, in seconds
|
||||
function wait(time)
|
||||
local start = os.time()
|
||||
repeat coroutine.yield(0) until os.time() > start + time
|
||||
end
|
||||
|
||||
--Duplicates a table (needed to prevent it making reference to the same objects)
|
||||
function duplicateTable(oldTable)
|
||||
local newTable = {}
|
||||
for k, v in pairs(oldTable) do
|
||||
newTable[k] = v
|
||||
end
|
||||
return newTable
|
||||
end
|
||||
|
||||
--Moves scripted highlight from all objects
|
||||
function removeAllHighlights()
|
||||
for _, obj in ipairs(getAllObjects()) do
|
||||
obj.highlightOff()
|
||||
end
|
||||
end
|
||||
|
||||
--Round number (num) to the Nth decimal (dec)
|
||||
function round(num, dec)
|
||||
local mult = 10^(dec or 0)
|
||||
return math.floor(num * mult + 0.5) / mult
|
||||
function updateSave()
|
||||
local data_to_save = {["ml"]=memoryList}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function onload(saved_data)
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
--Set up information off of loaded_data
|
||||
memoryList = loaded_data.ml
|
||||
else
|
||||
--Set up information for if there is no saved saved data
|
||||
memoryList = {}
|
||||
end
|
||||
|
||||
if next(memoryList) == nil then
|
||||
createSetupButton()
|
||||
else
|
||||
createMemoryActionButtons()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--Beginning Setup
|
||||
|
||||
|
||||
--Make setup button
|
||||
function createSetupButton()
|
||||
self.createButton({
|
||||
label="Setup", click_function="buttonClick_setup", function_owner=self,
|
||||
position={0,5,-2}, rotation={0,0,0}, height=250, width=600,
|
||||
font_size=150, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
end
|
||||
|
||||
--Triggered by setup button,
|
||||
function buttonClick_setup()
|
||||
memoryListBackup = duplicateTable(memoryList)
|
||||
memoryList = {}
|
||||
self.clearButtons()
|
||||
createButtonsOnAllObjects()
|
||||
createSetupActionButtons()
|
||||
end
|
||||
|
||||
--Creates selection buttons on objects
|
||||
function createButtonsOnAllObjects()
|
||||
local howManyButtons = 0
|
||||
for _, obj in ipairs(getAllObjects()) do
|
||||
if obj ~= self then
|
||||
local dummyIndex = howManyButtons
|
||||
--On a normal bag, the button positions aren't the same size as the bag.
|
||||
globalScaleFactor = 1.25 * 1/self.getScale().x
|
||||
--Super sweet math to set button positions
|
||||
local selfPos = self.getPosition()
|
||||
local objPos = obj.getPosition()
|
||||
local deltaPos = findOffsetDistance(selfPos, objPos, obj)
|
||||
local objPos = rotateLocalCoordinates(deltaPos, self)
|
||||
objPos.x = -objPos.x * globalScaleFactor
|
||||
objPos.y = objPos.y * globalScaleFactor
|
||||
objPos.z = objPos.z * 4
|
||||
--Offset rotation of bag
|
||||
local rot = self.getRotation()
|
||||
rot.y = -rot.y + 180
|
||||
--Create function
|
||||
local funcName = "selectButton_" .. howManyButtons
|
||||
local func = function() buttonClick_selection(dummyIndex, obj) end
|
||||
self.setVar(funcName, func)
|
||||
self.createButton({
|
||||
click_function=funcName, function_owner=self,
|
||||
position=objPos, rotation=rot, height=1000, width=1000,
|
||||
color={0.75,0.25,0.25,0.6},
|
||||
})
|
||||
howManyButtons = howManyButtons + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Creates submit and cancel buttons
|
||||
function createSetupActionButtons()
|
||||
self.createButton({
|
||||
label="Cancel", click_function="buttonClick_cancel", function_owner=self,
|
||||
position={1.5,5,2}, rotation={0,0,0}, height=350, width=1100,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Submit", click_function="buttonClick_submit", function_owner=self,
|
||||
position={-1.2,5,2}, rotation={0,0,0}, height=350, width=1100,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Reset", click_function="buttonClick_reset", function_owner=self,
|
||||
position={-3.5,5,2}, rotation={0,0,0}, height=350, width=800,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
--During Setup
|
||||
|
||||
|
||||
--Checks or unchecks buttons
|
||||
function buttonClick_selection(index, obj)
|
||||
local color = {0,1,0,0.6}
|
||||
if memoryList[obj.getGUID()] == nil then
|
||||
self.editButton({index=index, color=color})
|
||||
--Adding pos/rot to memory table
|
||||
local pos, rot = obj.getPosition(), obj.getRotation()
|
||||
--I need to add it like this or it won't save due to indexing issue
|
||||
memoryList[obj.getGUID()] = {
|
||||
pos={x=round(pos.x,4), y=round(pos.y,4), z=round(pos.z,4)},
|
||||
rot={x=round(rot.x,4), y=round(rot.y,4), z=round(rot.z,4)},
|
||||
lock=obj.getLock()
|
||||
}
|
||||
obj.highlightOn({0,1,0})
|
||||
else
|
||||
color = {0.75,0.25,0.25,0.6}
|
||||
self.editButton({index=index, color=color})
|
||||
memoryList[obj.getGUID()] = nil
|
||||
obj.highlightOff()
|
||||
end
|
||||
end
|
||||
|
||||
--Cancels selection process
|
||||
function buttonClick_cancel()
|
||||
memoryList = memoryListBackup
|
||||
self.clearButtons()
|
||||
if next(memoryList) == nil then
|
||||
createSetupButton()
|
||||
else
|
||||
createMemoryActionButtons()
|
||||
end
|
||||
removeAllHighlights()
|
||||
broadcastToAll("Selection Canceled", {1,1,1})
|
||||
end
|
||||
|
||||
--Saves selections
|
||||
function buttonClick_submit()
|
||||
if next(memoryList) == nil then
|
||||
broadcastToAll("You cannot submit without any selections.", {0.75, 0.25, 0.25})
|
||||
else
|
||||
self.clearButtons()
|
||||
createMemoryActionButtons()
|
||||
local count = 0
|
||||
for guid in pairs(memoryList) do
|
||||
count = count + 1
|
||||
local obj = getObjectFromGUID(guid)
|
||||
if obj ~= nil then obj.highlightOff() end
|
||||
end
|
||||
broadcastToAll(count.." Objects Saved", {1,1,1})
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
--Resets bag to starting status
|
||||
function buttonClick_reset()
|
||||
memoryList = {}
|
||||
self.clearButtons()
|
||||
createSetupButton()
|
||||
removeAllHighlights()
|
||||
broadcastToAll("Tool Reset", {1,1,1})
|
||||
updateSave()
|
||||
end
|
||||
|
||||
|
||||
--After Setup
|
||||
|
||||
|
||||
--Creates recall and place buttons
|
||||
function createMemoryActionButtons()
|
||||
self.createButton({
|
||||
label="Clicker", click_function="buttonClick_place", function_owner=self,
|
||||
position={4.2,1,0}, rotation={0,0,0}, height=500, width=1100,
|
||||
font_size=350, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Counter", click_function="buttonClick_recall", function_owner=self,
|
||||
position={-4.2,1,-0.1}, rotation={0,0,0}, height=500, width=1300,
|
||||
font_size=350, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
-- self.createButton({
|
||||
-- label="Setup", click_function="buttonClick_setup", function_owner=self,
|
||||
-- position={-6,1,0}, rotation={0,90,0}, height=500, width=1200,
|
||||
-- font_size=350, color={0,0,0}, font_color={1,1,1}
|
||||
-- })
|
||||
end
|
||||
|
||||
--Sends objects from bag/table to their saved position/rotation
|
||||
function buttonClick_place()
|
||||
local bagObjList = self.getObjects()
|
||||
for guid, entry in pairs(memoryList) do
|
||||
local obj = getObjectFromGUID(guid)
|
||||
--If obj is out on the table, move it to the saved pos/rot
|
||||
if obj ~= nil then
|
||||
obj.setPositionSmooth(entry.pos)
|
||||
obj.setRotationSmooth(entry.rot)
|
||||
obj.setLock(entry.lock)
|
||||
else
|
||||
--If obj is inside of the bag
|
||||
for _, bagObj in ipairs(bagObjList) do
|
||||
if bagObj.guid == guid then
|
||||
local item = self.takeObject({
|
||||
guid=guid, position=entry.pos, rotation=entry.rot,
|
||||
})
|
||||
item.setLock(entry.lock)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
broadcastToAll("Objects Placed", {1,1,1})
|
||||
end
|
||||
|
||||
--Recalls objects to bag from table
|
||||
function buttonClick_recall()
|
||||
for guid, entry in pairs(memoryList) do
|
||||
local obj = getObjectFromGUID(guid)
|
||||
if obj ~= nil then self.putObject(obj) end
|
||||
end
|
||||
broadcastToAll("Objects Recalled", {1,1,1})
|
||||
end
|
||||
|
||||
|
||||
--Utility functions
|
||||
|
||||
|
||||
--Find delta (difference) between 2 x/y/z coordinates
|
||||
function findOffsetDistance(p1, p2, obj)
|
||||
local deltaPos = {}
|
||||
local bounds = obj.getBounds()
|
||||
deltaPos.x = (p2.x-p1.x)
|
||||
deltaPos.y = (p2.y-p1.y) + (bounds.size.y - bounds.offset.y)
|
||||
deltaPos.z = (p2.z-p1.z)
|
||||
return deltaPos
|
||||
end
|
||||
|
||||
--Used to rotate a set of coordinates by an angle
|
||||
function rotateLocalCoordinates(desiredPos, obj)
|
||||
local objPos, objRot = obj.getPosition(), obj.getRotation()
|
||||
local angle = math.rad(objRot.y)
|
||||
local x = desiredPos.x * math.cos(angle) - desiredPos.z * math.sin(angle)
|
||||
local z = desiredPos.x * math.sin(angle) + desiredPos.z * math.cos(angle)
|
||||
--return {x=objPos.x+x, y=objPos.y+desiredPos.y, z=objPos.z+z}
|
||||
return {x=x, y=desiredPos.y, z=z}
|
||||
end
|
||||
|
||||
--Coroutine delay, in seconds
|
||||
function wait(time)
|
||||
local start = os.time()
|
||||
repeat coroutine.yield(0) until os.time() > start + time
|
||||
end
|
||||
|
||||
--Duplicates a table (needed to prevent it making reference to the same objects)
|
||||
function duplicateTable(oldTable)
|
||||
local newTable = {}
|
||||
for k, v in pairs(oldTable) do
|
||||
newTable[k] = v
|
||||
end
|
||||
return newTable
|
||||
end
|
||||
|
||||
--Moves scripted highlight from all objects
|
||||
function removeAllHighlights()
|
||||
for _, obj in ipairs(getAllObjects()) do
|
||||
obj.highlightOff()
|
||||
end
|
||||
end
|
||||
|
||||
--Round number (num) to the Nth decimal (dec)
|
||||
function round(num, dec)
|
||||
local mult = 10^(dec or 0)
|
||||
return math.floor(num * mult + 0.5) / mult
|
||||
end
|
@ -1,132 +1,132 @@
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
function onload(saved_data)
|
||||
light_mode = false
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0.5, 0.5, 0.5, 95}
|
||||
|
||||
if light_mode then
|
||||
f_color = {1,1,1,95}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,0},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1.5, y=1.5, z=1.5},
|
||||
font_size=600,
|
||||
font_color=f_color,
|
||||
color={0,0,0,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
function onload(saved_data)
|
||||
light_mode = false
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0.5, 0.5, 0.5, 95}
|
||||
|
||||
if light_mode then
|
||||
f_color = {1,1,1,95}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,0},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1.5, y=1.5, z=1.5},
|
||||
font_size=600,
|
||||
font_color=f_color,
|
||||
color={0,0,0,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
end
|
@ -1,132 +1,132 @@
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
function onload(saved_data)
|
||||
light_mode = true
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0,0,0,100}
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
if light_mode then
|
||||
f_color = {1,1,1,100}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,0.1},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1.5, y=1.5, z=1.5},
|
||||
font_size=600,
|
||||
font_color=f_color,
|
||||
color={1,1,1,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
function onload(saved_data)
|
||||
light_mode = true
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0,0,0,100}
|
||||
|
||||
if light_mode then
|
||||
f_color = {1,1,1,100}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,0.1},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1.5, y=1.5, z=1.5},
|
||||
font_size=600,
|
||||
font_color=f_color,
|
||||
color={1,1,1,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
end
|
@ -1,132 +1,132 @@
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
function onload(saved_data)
|
||||
light_mode = true
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0,0,0,100}
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
if light_mode then
|
||||
f_color = {1,1,1,100}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,0.1},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1.5, y=1.5, z=1.5},
|
||||
font_size=600,
|
||||
font_color=f_color,
|
||||
color={1,1,1,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
function onload(saved_data)
|
||||
light_mode = true
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0,0,0,100}
|
||||
|
||||
if light_mode then
|
||||
f_color = {1,1,1,100}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,0.1},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1.5, y=1.5, z=1.5},
|
||||
font_size=600,
|
||||
font_color=f_color,
|
||||
color={1,1,1,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
end
|
@ -1,132 +1,132 @@
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
function onload(saved_data)
|
||||
light_mode = true
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0,0,0,100}
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
if light_mode then
|
||||
f_color = {1,1,1,100}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,0.1},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1.5, y=1.5, z=1.5},
|
||||
font_size=600,
|
||||
font_color=f_color,
|
||||
color={1,1,1,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
function onload(saved_data)
|
||||
light_mode = true
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0,0,0,100}
|
||||
|
||||
if light_mode then
|
||||
f_color = {1,1,1,100}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,0.1},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1.5, y=1.5, z=1.5},
|
||||
font_size=600,
|
||||
font_color=f_color,
|
||||
color={1,1,1,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
end
|
@ -1,132 +1,132 @@
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
function onload(saved_data)
|
||||
light_mode = true
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0,0,0,100}
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
if light_mode then
|
||||
f_color = {1,1,1,100}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,0.1},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1.5, y=1.5, z=1.5},
|
||||
font_size=600,
|
||||
font_color=f_color,
|
||||
color={1,1,1,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
function onload(saved_data)
|
||||
light_mode = true
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0,0,0,100}
|
||||
|
||||
if light_mode then
|
||||
f_color = {1,1,1,100}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,0.1},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1.5, y=1.5, z=1.5},
|
||||
font_size=600,
|
||||
font_color=f_color,
|
||||
color={1,1,1,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
end
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,273 +1,273 @@
|
||||
function updateSave()
|
||||
local data_to_save = {["ml"]=memoryList}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function onload(saved_data)
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
--Set up information off of loaded_data
|
||||
memoryList = loaded_data.ml
|
||||
else
|
||||
--Set up information for if there is no saved saved data
|
||||
memoryList = {}
|
||||
end
|
||||
|
||||
if next(memoryList) == nil then
|
||||
createSetupButton()
|
||||
else
|
||||
createMemoryActionButtons()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--Beginning Setup
|
||||
|
||||
|
||||
--Make setup button
|
||||
function createSetupButton()
|
||||
self.createButton({
|
||||
label="Setup", click_function="buttonClick_setup", function_owner=self,
|
||||
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=800,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
end
|
||||
|
||||
--Triggered by setup button,
|
||||
function buttonClick_setup()
|
||||
memoryListBackup = duplicateTable(memoryList)
|
||||
memoryList = {}
|
||||
self.clearButtons()
|
||||
createButtonsOnAllObjects()
|
||||
createSetupActionButtons()
|
||||
end
|
||||
|
||||
--Creates selection buttons on objects
|
||||
function createButtonsOnAllObjects()
|
||||
local howManyButtons = 0
|
||||
for _, obj in ipairs(getAllObjects()) do
|
||||
if obj ~= self then
|
||||
local dummyIndex = howManyButtons
|
||||
--On a normal bag, the button positions aren't the same size as the bag.
|
||||
globalScaleFactor = 1.25 * 1/self.getScale().x
|
||||
--Super sweet math to set button positions
|
||||
local selfPos = self.getPosition()
|
||||
local objPos = obj.getPosition()
|
||||
local deltaPos = findOffsetDistance(selfPos, objPos, obj)
|
||||
local objPos = rotateLocalCoordinates(deltaPos, self)
|
||||
objPos.x = -objPos.x * globalScaleFactor
|
||||
objPos.y = objPos.y * globalScaleFactor
|
||||
objPos.z = objPos.z * globalScaleFactor
|
||||
--Offset rotation of bag
|
||||
local rot = self.getRotation()
|
||||
rot.y = -rot.y + 180
|
||||
--Create function
|
||||
local funcName = "selectButton_" .. howManyButtons
|
||||
local func = function() buttonClick_selection(dummyIndex, obj) end
|
||||
self.setVar(funcName, func)
|
||||
self.createButton({
|
||||
click_function=funcName, function_owner=self,
|
||||
position=objPos, rotation=rot, height=1000, width=1000,
|
||||
color={0.75,0.25,0.25,0.6},
|
||||
})
|
||||
howManyButtons = howManyButtons + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Creates submit and cancel buttons
|
||||
function createSetupActionButtons()
|
||||
self.createButton({
|
||||
label="Cancel", click_function="buttonClick_cancel", function_owner=self,
|
||||
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=1100,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Submit", click_function="buttonClick_submit", function_owner=self,
|
||||
position={0,0.3,-2.8}, rotation={0,180,0}, height=350, width=1100,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Reset", click_function="buttonClick_reset", function_owner=self,
|
||||
position={-2,0.3,0}, rotation={0,270,0}, height=350, width=800,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
--During Setup
|
||||
|
||||
|
||||
--Checks or unchecks buttons
|
||||
function buttonClick_selection(index, obj)
|
||||
local color = {0,1,0,0.6}
|
||||
if memoryList[obj.getGUID()] == nil then
|
||||
self.editButton({index=index, color=color})
|
||||
--Adding pos/rot to memory table
|
||||
local pos, rot = obj.getPosition(), obj.getRotation()
|
||||
--I need to add it like this or it won't save due to indexing issue
|
||||
memoryList[obj.getGUID()] = {
|
||||
pos={x=round(pos.x,4), y=round(pos.y,4), z=round(pos.z,4)},
|
||||
rot={x=round(rot.x,4), y=round(rot.y,4), z=round(rot.z,4)},
|
||||
lock=obj.getLock()
|
||||
}
|
||||
obj.highlightOn({0,1,0})
|
||||
else
|
||||
color = {0.75,0.25,0.25,0.6}
|
||||
self.editButton({index=index, color=color})
|
||||
memoryList[obj.getGUID()] = nil
|
||||
obj.highlightOff()
|
||||
end
|
||||
end
|
||||
|
||||
--Cancels selection process
|
||||
function buttonClick_cancel()
|
||||
memoryList = memoryListBackup
|
||||
self.clearButtons()
|
||||
if next(memoryList) == nil then
|
||||
createSetupButton()
|
||||
else
|
||||
createMemoryActionButtons()
|
||||
end
|
||||
removeAllHighlights()
|
||||
broadcastToAll("Selection Canceled", {1,1,1})
|
||||
end
|
||||
|
||||
--Saves selections
|
||||
function buttonClick_submit()
|
||||
if next(memoryList) == nil then
|
||||
broadcastToAll("You cannot submit without any selections.", {0.75, 0.25, 0.25})
|
||||
else
|
||||
self.clearButtons()
|
||||
createMemoryActionButtons()
|
||||
local count = 0
|
||||
for guid in pairs(memoryList) do
|
||||
count = count + 1
|
||||
local obj = getObjectFromGUID(guid)
|
||||
if obj ~= nil then obj.highlightOff() end
|
||||
end
|
||||
broadcastToAll(count.." Objects Saved", {1,1,1})
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
--Resets bag to starting status
|
||||
function buttonClick_reset()
|
||||
memoryList = {}
|
||||
self.clearButtons()
|
||||
createSetupButton()
|
||||
removeAllHighlights()
|
||||
broadcastToAll("Tool Reset", {1,1,1})
|
||||
updateSave()
|
||||
end
|
||||
|
||||
|
||||
--After Setup
|
||||
|
||||
|
||||
--Creates recall and place buttons
|
||||
function createMemoryActionButtons()
|
||||
self.createButton({
|
||||
label="Place", click_function="buttonClick_place", function_owner=self,
|
||||
position={0.6,0.1,2.1}, rotation={0,0,0}, height=220, width=500,
|
||||
font_size=130, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Recall", click_function="buttonClick_recall", function_owner=self,
|
||||
position={-0.6,0.1,2.1}, rotation={0,0,0}, height=220, width=500,
|
||||
font_size=130, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
-- self.createButton({
|
||||
-- label="Setup", click_function="buttonClick_setup", function_owner=self,
|
||||
-- position={2,0.3,0}, rotation={0,90,0}, height=350, width=800,
|
||||
-- font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
-- })
|
||||
end
|
||||
|
||||
--Sends objects from bag/table to their saved position/rotation
|
||||
function buttonClick_place()
|
||||
local bagObjList = self.getObjects()
|
||||
for guid, entry in pairs(memoryList) do
|
||||
local obj = getObjectFromGUID(guid)
|
||||
--If obj is out on the table, move it to the saved pos/rot
|
||||
if obj ~= nil then
|
||||
obj.setPositionSmooth(entry.pos)
|
||||
obj.setRotationSmooth(entry.rot)
|
||||
obj.setLock(entry.lock)
|
||||
else
|
||||
--If obj is inside of the bag
|
||||
for _, bagObj in ipairs(bagObjList) do
|
||||
if bagObj.guid == guid then
|
||||
local item = self.takeObject({
|
||||
guid=guid, position=entry.pos, rotation=entry.rot,
|
||||
})
|
||||
item.setLock(entry.lock)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
broadcastToAll("Objects Placed", {1,1,1})
|
||||
end
|
||||
|
||||
--Recalls objects to bag from table
|
||||
function buttonClick_recall()
|
||||
for guid, entry in pairs(memoryList) do
|
||||
local obj = getObjectFromGUID(guid)
|
||||
if obj ~= nil then self.putObject(obj) end
|
||||
end
|
||||
broadcastToAll("Objects Recalled", {1,1,1})
|
||||
end
|
||||
|
||||
|
||||
--Utility functions
|
||||
|
||||
|
||||
--Find delta (difference) between 2 x/y/z coordinates
|
||||
function findOffsetDistance(p1, p2, obj)
|
||||
local deltaPos = {}
|
||||
local bounds = obj.getBounds()
|
||||
deltaPos.x = (p2.x-p1.x)
|
||||
deltaPos.y = (p2.y-p1.y) + (bounds.size.y - bounds.offset.y)
|
||||
deltaPos.z = (p2.z-p1.z)
|
||||
return deltaPos
|
||||
end
|
||||
|
||||
--Used to rotate a set of coordinates by an angle
|
||||
function rotateLocalCoordinates(desiredPos, obj)
|
||||
local objPos, objRot = obj.getPosition(), obj.getRotation()
|
||||
local angle = math.rad(objRot.y)
|
||||
local x = desiredPos.x * math.cos(angle) - desiredPos.z * math.sin(angle)
|
||||
local z = desiredPos.x * math.sin(angle) + desiredPos.z * math.cos(angle)
|
||||
--return {x=objPos.x+x, y=objPos.y+desiredPos.y, z=objPos.z+z}
|
||||
return {x=x, y=desiredPos.y, z=z}
|
||||
end
|
||||
|
||||
--Coroutine delay, in seconds
|
||||
function wait(time)
|
||||
local start = os.time()
|
||||
repeat coroutine.yield(0) until os.time() > start + time
|
||||
end
|
||||
|
||||
--Duplicates a table (needed to prevent it making reference to the same objects)
|
||||
function duplicateTable(oldTable)
|
||||
local newTable = {}
|
||||
for k, v in pairs(oldTable) do
|
||||
newTable[k] = v
|
||||
end
|
||||
return newTable
|
||||
end
|
||||
|
||||
--Moves scripted highlight from all objects
|
||||
function removeAllHighlights()
|
||||
for _, obj in ipairs(getAllObjects()) do
|
||||
obj.highlightOff()
|
||||
end
|
||||
end
|
||||
|
||||
--Round number (num) to the Nth decimal (dec)
|
||||
function round(num, dec)
|
||||
local mult = 10^(dec or 0)
|
||||
return math.floor(num * mult + 0.5) / mult
|
||||
end
|
||||
function updateSave()
|
||||
local data_to_save = {["ml"]=memoryList}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function onload(saved_data)
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
--Set up information off of loaded_data
|
||||
memoryList = loaded_data.ml
|
||||
else
|
||||
--Set up information for if there is no saved saved data
|
||||
memoryList = {}
|
||||
end
|
||||
|
||||
if next(memoryList) == nil then
|
||||
createSetupButton()
|
||||
else
|
||||
createMemoryActionButtons()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--Beginning Setup
|
||||
|
||||
|
||||
--Make setup button
|
||||
function createSetupButton()
|
||||
self.createButton({
|
||||
label="Setup", click_function="buttonClick_setup", function_owner=self,
|
||||
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=800,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
end
|
||||
|
||||
--Triggered by setup button,
|
||||
function buttonClick_setup()
|
||||
memoryListBackup = duplicateTable(memoryList)
|
||||
memoryList = {}
|
||||
self.clearButtons()
|
||||
createButtonsOnAllObjects()
|
||||
createSetupActionButtons()
|
||||
end
|
||||
|
||||
--Creates selection buttons on objects
|
||||
function createButtonsOnAllObjects()
|
||||
local howManyButtons = 0
|
||||
for _, obj in ipairs(getAllObjects()) do
|
||||
if obj ~= self then
|
||||
local dummyIndex = howManyButtons
|
||||
--On a normal bag, the button positions aren't the same size as the bag.
|
||||
globalScaleFactor = 1.25 * 1/self.getScale().x
|
||||
--Super sweet math to set button positions
|
||||
local selfPos = self.getPosition()
|
||||
local objPos = obj.getPosition()
|
||||
local deltaPos = findOffsetDistance(selfPos, objPos, obj)
|
||||
local objPos = rotateLocalCoordinates(deltaPos, self)
|
||||
objPos.x = -objPos.x * globalScaleFactor
|
||||
objPos.y = objPos.y * globalScaleFactor
|
||||
objPos.z = objPos.z * globalScaleFactor
|
||||
--Offset rotation of bag
|
||||
local rot = self.getRotation()
|
||||
rot.y = -rot.y + 180
|
||||
--Create function
|
||||
local funcName = "selectButton_" .. howManyButtons
|
||||
local func = function() buttonClick_selection(dummyIndex, obj) end
|
||||
self.setVar(funcName, func)
|
||||
self.createButton({
|
||||
click_function=funcName, function_owner=self,
|
||||
position=objPos, rotation=rot, height=1000, width=1000,
|
||||
color={0.75,0.25,0.25,0.6},
|
||||
})
|
||||
howManyButtons = howManyButtons + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Creates submit and cancel buttons
|
||||
function createSetupActionButtons()
|
||||
self.createButton({
|
||||
label="Cancel", click_function="buttonClick_cancel", function_owner=self,
|
||||
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=1100,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Submit", click_function="buttonClick_submit", function_owner=self,
|
||||
position={0,0.3,-2.8}, rotation={0,180,0}, height=350, width=1100,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Reset", click_function="buttonClick_reset", function_owner=self,
|
||||
position={-2,0.3,0}, rotation={0,270,0}, height=350, width=800,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
--During Setup
|
||||
|
||||
|
||||
--Checks or unchecks buttons
|
||||
function buttonClick_selection(index, obj)
|
||||
local color = {0,1,0,0.6}
|
||||
if memoryList[obj.getGUID()] == nil then
|
||||
self.editButton({index=index, color=color})
|
||||
--Adding pos/rot to memory table
|
||||
local pos, rot = obj.getPosition(), obj.getRotation()
|
||||
--I need to add it like this or it won't save due to indexing issue
|
||||
memoryList[obj.getGUID()] = {
|
||||
pos={x=round(pos.x,4), y=round(pos.y,4), z=round(pos.z,4)},
|
||||
rot={x=round(rot.x,4), y=round(rot.y,4), z=round(rot.z,4)},
|
||||
lock=obj.getLock()
|
||||
}
|
||||
obj.highlightOn({0,1,0})
|
||||
else
|
||||
color = {0.75,0.25,0.25,0.6}
|
||||
self.editButton({index=index, color=color})
|
||||
memoryList[obj.getGUID()] = nil
|
||||
obj.highlightOff()
|
||||
end
|
||||
end
|
||||
|
||||
--Cancels selection process
|
||||
function buttonClick_cancel()
|
||||
memoryList = memoryListBackup
|
||||
self.clearButtons()
|
||||
if next(memoryList) == nil then
|
||||
createSetupButton()
|
||||
else
|
||||
createMemoryActionButtons()
|
||||
end
|
||||
removeAllHighlights()
|
||||
broadcastToAll("Selection Canceled", {1,1,1})
|
||||
end
|
||||
|
||||
--Saves selections
|
||||
function buttonClick_submit()
|
||||
if next(memoryList) == nil then
|
||||
broadcastToAll("You cannot submit without any selections.", {0.75, 0.25, 0.25})
|
||||
else
|
||||
self.clearButtons()
|
||||
createMemoryActionButtons()
|
||||
local count = 0
|
||||
for guid in pairs(memoryList) do
|
||||
count = count + 1
|
||||
local obj = getObjectFromGUID(guid)
|
||||
if obj ~= nil then obj.highlightOff() end
|
||||
end
|
||||
broadcastToAll(count.." Objects Saved", {1,1,1})
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
--Resets bag to starting status
|
||||
function buttonClick_reset()
|
||||
memoryList = {}
|
||||
self.clearButtons()
|
||||
createSetupButton()
|
||||
removeAllHighlights()
|
||||
broadcastToAll("Tool Reset", {1,1,1})
|
||||
updateSave()
|
||||
end
|
||||
|
||||
|
||||
--After Setup
|
||||
|
||||
|
||||
--Creates recall and place buttons
|
||||
function createMemoryActionButtons()
|
||||
self.createButton({
|
||||
label="Place", click_function="buttonClick_place", function_owner=self,
|
||||
position={0.6,0.1,2.1}, rotation={0,0,0}, height=220, width=500,
|
||||
font_size=130, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Recall", click_function="buttonClick_recall", function_owner=self,
|
||||
position={-0.6,0.1,2.1}, rotation={0,0,0}, height=220, width=500,
|
||||
font_size=130, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
-- self.createButton({
|
||||
-- label="Setup", click_function="buttonClick_setup", function_owner=self,
|
||||
-- position={2,0.3,0}, rotation={0,90,0}, height=350, width=800,
|
||||
-- font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
-- })
|
||||
end
|
||||
|
||||
--Sends objects from bag/table to their saved position/rotation
|
||||
function buttonClick_place()
|
||||
local bagObjList = self.getObjects()
|
||||
for guid, entry in pairs(memoryList) do
|
||||
local obj = getObjectFromGUID(guid)
|
||||
--If obj is out on the table, move it to the saved pos/rot
|
||||
if obj ~= nil then
|
||||
obj.setPositionSmooth(entry.pos)
|
||||
obj.setRotationSmooth(entry.rot)
|
||||
obj.setLock(entry.lock)
|
||||
else
|
||||
--If obj is inside of the bag
|
||||
for _, bagObj in ipairs(bagObjList) do
|
||||
if bagObj.guid == guid then
|
||||
local item = self.takeObject({
|
||||
guid=guid, position=entry.pos, rotation=entry.rot,
|
||||
})
|
||||
item.setLock(entry.lock)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
broadcastToAll("Objects Placed", {1,1,1})
|
||||
end
|
||||
|
||||
--Recalls objects to bag from table
|
||||
function buttonClick_recall()
|
||||
for guid, entry in pairs(memoryList) do
|
||||
local obj = getObjectFromGUID(guid)
|
||||
if obj ~= nil then self.putObject(obj) end
|
||||
end
|
||||
broadcastToAll("Objects Recalled", {1,1,1})
|
||||
end
|
||||
|
||||
|
||||
--Utility functions
|
||||
|
||||
|
||||
--Find delta (difference) between 2 x/y/z coordinates
|
||||
function findOffsetDistance(p1, p2, obj)
|
||||
local deltaPos = {}
|
||||
local bounds = obj.getBounds()
|
||||
deltaPos.x = (p2.x-p1.x)
|
||||
deltaPos.y = (p2.y-p1.y) + (bounds.size.y - bounds.offset.y)
|
||||
deltaPos.z = (p2.z-p1.z)
|
||||
return deltaPos
|
||||
end
|
||||
|
||||
--Used to rotate a set of coordinates by an angle
|
||||
function rotateLocalCoordinates(desiredPos, obj)
|
||||
local objPos, objRot = obj.getPosition(), obj.getRotation()
|
||||
local angle = math.rad(objRot.y)
|
||||
local x = desiredPos.x * math.cos(angle) - desiredPos.z * math.sin(angle)
|
||||
local z = desiredPos.x * math.sin(angle) + desiredPos.z * math.cos(angle)
|
||||
--return {x=objPos.x+x, y=objPos.y+desiredPos.y, z=objPos.z+z}
|
||||
return {x=x, y=desiredPos.y, z=z}
|
||||
end
|
||||
|
||||
--Coroutine delay, in seconds
|
||||
function wait(time)
|
||||
local start = os.time()
|
||||
repeat coroutine.yield(0) until os.time() > start + time
|
||||
end
|
||||
|
||||
--Duplicates a table (needed to prevent it making reference to the same objects)
|
||||
function duplicateTable(oldTable)
|
||||
local newTable = {}
|
||||
for k, v in pairs(oldTable) do
|
||||
newTable[k] = v
|
||||
end
|
||||
return newTable
|
||||
end
|
||||
|
||||
--Moves scripted highlight from all objects
|
||||
function removeAllHighlights()
|
||||
for _, obj in ipairs(getAllObjects()) do
|
||||
obj.highlightOff()
|
||||
end
|
||||
end
|
||||
|
||||
--Round number (num) to the Nth decimal (dec)
|
||||
function round(num, dec)
|
||||
local mult = 10^(dec or 0)
|
||||
return math.floor(num * mult + 0.5) / mult
|
||||
end
|
||||
|
@ -1,21 +1,21 @@
|
||||
name = 'Core Set'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
name = 'Core Set'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
@ -1,273 +1,273 @@
|
||||
function updateSave()
|
||||
local data_to_save = {["ml"]=memoryList}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function onload(saved_data)
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
--Set up information off of loaded_data
|
||||
memoryList = loaded_data.ml
|
||||
else
|
||||
--Set up information for if there is no saved saved data
|
||||
memoryList = {}
|
||||
end
|
||||
|
||||
if next(memoryList) == nil then
|
||||
createSetupButton()
|
||||
else
|
||||
createMemoryActionButtons()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--Beginning Setup
|
||||
|
||||
|
||||
--Make setup button
|
||||
function createSetupButton()
|
||||
self.createButton({
|
||||
label="Setup", click_function="buttonClick_setup", function_owner=self,
|
||||
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=800,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
end
|
||||
|
||||
--Triggered by setup button,
|
||||
function buttonClick_setup()
|
||||
memoryListBackup = duplicateTable(memoryList)
|
||||
memoryList = {}
|
||||
self.clearButtons()
|
||||
createButtonsOnAllObjects()
|
||||
createSetupActionButtons()
|
||||
end
|
||||
|
||||
--Creates selection buttons on objects
|
||||
function createButtonsOnAllObjects()
|
||||
local howManyButtons = 0
|
||||
for _, obj in ipairs(getAllObjects()) do
|
||||
if obj ~= self then
|
||||
local dummyIndex = howManyButtons
|
||||
--On a normal bag, the button positions aren't the same size as the bag.
|
||||
globalScaleFactor = 1.25 * 1/self.getScale().x
|
||||
--Super sweet math to set button positions
|
||||
local selfPos = self.getPosition()
|
||||
local objPos = obj.getPosition()
|
||||
local deltaPos = findOffsetDistance(selfPos, objPos, obj)
|
||||
local objPos = rotateLocalCoordinates(deltaPos, self)
|
||||
objPos.x = -objPos.x * globalScaleFactor
|
||||
objPos.y = objPos.y * globalScaleFactor
|
||||
objPos.z = objPos.z * globalScaleFactor
|
||||
--Offset rotation of bag
|
||||
local rot = self.getRotation()
|
||||
rot.y = -rot.y + 180
|
||||
--Create function
|
||||
local funcName = "selectButton_" .. howManyButtons
|
||||
local func = function() buttonClick_selection(dummyIndex, obj) end
|
||||
self.setVar(funcName, func)
|
||||
self.createButton({
|
||||
click_function=funcName, function_owner=self,
|
||||
position=objPos, rotation=rot, height=1000, width=1000,
|
||||
color={0.75,0.25,0.25,0.6},
|
||||
})
|
||||
howManyButtons = howManyButtons + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Creates submit and cancel buttons
|
||||
function createSetupActionButtons()
|
||||
self.createButton({
|
||||
label="Cancel", click_function="buttonClick_cancel", function_owner=self,
|
||||
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=1100,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Submit", click_function="buttonClick_submit", function_owner=self,
|
||||
position={0,0.3,-2.8}, rotation={0,180,0}, height=350, width=1100,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Reset", click_function="buttonClick_reset", function_owner=self,
|
||||
position={-2,0.3,0}, rotation={0,270,0}, height=350, width=800,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
--During Setup
|
||||
|
||||
|
||||
--Checks or unchecks buttons
|
||||
function buttonClick_selection(index, obj)
|
||||
local color = {0,1,0,0.6}
|
||||
if memoryList[obj.getGUID()] == nil then
|
||||
self.editButton({index=index, color=color})
|
||||
--Adding pos/rot to memory table
|
||||
local pos, rot = obj.getPosition(), obj.getRotation()
|
||||
--I need to add it like this or it won't save due to indexing issue
|
||||
memoryList[obj.getGUID()] = {
|
||||
pos={x=round(pos.x,4), y=round(pos.y,4), z=round(pos.z,4)},
|
||||
rot={x=round(rot.x,4), y=round(rot.y,4), z=round(rot.z,4)},
|
||||
lock=obj.getLock()
|
||||
}
|
||||
obj.highlightOn({0,1,0})
|
||||
else
|
||||
color = {0.75,0.25,0.25,0.6}
|
||||
self.editButton({index=index, color=color})
|
||||
memoryList[obj.getGUID()] = nil
|
||||
obj.highlightOff()
|
||||
end
|
||||
end
|
||||
|
||||
--Cancels selection process
|
||||
function buttonClick_cancel()
|
||||
memoryList = memoryListBackup
|
||||
self.clearButtons()
|
||||
if next(memoryList) == nil then
|
||||
createSetupButton()
|
||||
else
|
||||
createMemoryActionButtons()
|
||||
end
|
||||
removeAllHighlights()
|
||||
broadcastToAll("Selection Canceled", {1,1,1})
|
||||
end
|
||||
|
||||
--Saves selections
|
||||
function buttonClick_submit()
|
||||
if next(memoryList) == nil then
|
||||
broadcastToAll("You cannot submit without any selections.", {0.75, 0.25, 0.25})
|
||||
else
|
||||
self.clearButtons()
|
||||
createMemoryActionButtons()
|
||||
local count = 0
|
||||
for guid in pairs(memoryList) do
|
||||
count = count + 1
|
||||
local obj = getObjectFromGUID(guid)
|
||||
if obj ~= nil then obj.highlightOff() end
|
||||
end
|
||||
broadcastToAll(count.." Objects Saved", {1,1,1})
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
--Resets bag to starting status
|
||||
function buttonClick_reset()
|
||||
memoryList = {}
|
||||
self.clearButtons()
|
||||
createSetupButton()
|
||||
removeAllHighlights()
|
||||
broadcastToAll("Tool Reset", {1,1,1})
|
||||
updateSave()
|
||||
end
|
||||
|
||||
|
||||
--After Setup
|
||||
|
||||
|
||||
--Creates recall and place buttons
|
||||
function createMemoryActionButtons()
|
||||
self.createButton({
|
||||
label="Place", click_function="buttonClick_place", function_owner=self,
|
||||
position={0.6,0.1,2.1}, rotation={0,0,0}, height=220, width=500,
|
||||
font_size=130, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Recall", click_function="buttonClick_recall", function_owner=self,
|
||||
position={-0.6,0.1,2.1}, rotation={0,0,0}, height=220, width=500,
|
||||
font_size=130, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
-- self.createButton({
|
||||
-- label="Setup", click_function="buttonClick_setup", function_owner=self,
|
||||
-- position={2,0.3,0}, rotation={0,90,0}, height=350, width=800,
|
||||
-- font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
-- })
|
||||
end
|
||||
|
||||
--Sends objects from bag/table to their saved position/rotation
|
||||
function buttonClick_place()
|
||||
local bagObjList = self.getObjects()
|
||||
for guid, entry in pairs(memoryList) do
|
||||
local obj = getObjectFromGUID(guid)
|
||||
--If obj is out on the table, move it to the saved pos/rot
|
||||
if obj ~= nil then
|
||||
obj.setPositionSmooth(entry.pos)
|
||||
obj.setRotationSmooth(entry.rot)
|
||||
obj.setLock(entry.lock)
|
||||
else
|
||||
--If obj is inside of the bag
|
||||
for _, bagObj in ipairs(bagObjList) do
|
||||
if bagObj.guid == guid then
|
||||
local item = self.takeObject({
|
||||
guid=guid, position=entry.pos, rotation=entry.rot,
|
||||
})
|
||||
item.setLock(entry.lock)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
broadcastToAll("Objects Placed", {1,1,1})
|
||||
end
|
||||
|
||||
--Recalls objects to bag from table
|
||||
function buttonClick_recall()
|
||||
for guid, entry in pairs(memoryList) do
|
||||
local obj = getObjectFromGUID(guid)
|
||||
if obj ~= nil then self.putObject(obj) end
|
||||
end
|
||||
broadcastToAll("Objects Recalled", {1,1,1})
|
||||
end
|
||||
|
||||
|
||||
--Utility functions
|
||||
|
||||
|
||||
--Find delta (difference) between 2 x/y/z coordinates
|
||||
function findOffsetDistance(p1, p2, obj)
|
||||
local deltaPos = {}
|
||||
local bounds = obj.getBounds()
|
||||
deltaPos.x = (p2.x-p1.x)
|
||||
deltaPos.y = (p2.y-p1.y) + (bounds.size.y - bounds.offset.y)
|
||||
deltaPos.z = (p2.z-p1.z)
|
||||
return deltaPos
|
||||
end
|
||||
|
||||
--Used to rotate a set of coordinates by an angle
|
||||
function rotateLocalCoordinates(desiredPos, obj)
|
||||
local objPos, objRot = obj.getPosition(), obj.getRotation()
|
||||
local angle = math.rad(objRot.y)
|
||||
local x = desiredPos.x * math.cos(angle) - desiredPos.z * math.sin(angle)
|
||||
local z = desiredPos.x * math.sin(angle) + desiredPos.z * math.cos(angle)
|
||||
--return {x=objPos.x+x, y=objPos.y+desiredPos.y, z=objPos.z+z}
|
||||
return {x=x, y=desiredPos.y, z=z}
|
||||
end
|
||||
|
||||
--Coroutine delay, in seconds
|
||||
function wait(time)
|
||||
local start = os.time()
|
||||
repeat coroutine.yield(0) until os.time() > start + time
|
||||
end
|
||||
|
||||
--Duplicates a table (needed to prevent it making reference to the same objects)
|
||||
function duplicateTable(oldTable)
|
||||
local newTable = {}
|
||||
for k, v in pairs(oldTable) do
|
||||
newTable[k] = v
|
||||
end
|
||||
return newTable
|
||||
end
|
||||
|
||||
--Moves scripted highlight from all objects
|
||||
function removeAllHighlights()
|
||||
for _, obj in ipairs(getAllObjects()) do
|
||||
obj.highlightOff()
|
||||
end
|
||||
end
|
||||
|
||||
--Round number (num) to the Nth decimal (dec)
|
||||
function round(num, dec)
|
||||
local mult = 10^(dec or 0)
|
||||
return math.floor(num * mult + 0.5) / mult
|
||||
end
|
||||
function updateSave()
|
||||
local data_to_save = {["ml"]=memoryList}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function onload(saved_data)
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
--Set up information off of loaded_data
|
||||
memoryList = loaded_data.ml
|
||||
else
|
||||
--Set up information for if there is no saved saved data
|
||||
memoryList = {}
|
||||
end
|
||||
|
||||
if next(memoryList) == nil then
|
||||
createSetupButton()
|
||||
else
|
||||
createMemoryActionButtons()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--Beginning Setup
|
||||
|
||||
|
||||
--Make setup button
|
||||
function createSetupButton()
|
||||
self.createButton({
|
||||
label="Setup", click_function="buttonClick_setup", function_owner=self,
|
||||
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=800,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
end
|
||||
|
||||
--Triggered by setup button,
|
||||
function buttonClick_setup()
|
||||
memoryListBackup = duplicateTable(memoryList)
|
||||
memoryList = {}
|
||||
self.clearButtons()
|
||||
createButtonsOnAllObjects()
|
||||
createSetupActionButtons()
|
||||
end
|
||||
|
||||
--Creates selection buttons on objects
|
||||
function createButtonsOnAllObjects()
|
||||
local howManyButtons = 0
|
||||
for _, obj in ipairs(getAllObjects()) do
|
||||
if obj ~= self then
|
||||
local dummyIndex = howManyButtons
|
||||
--On a normal bag, the button positions aren't the same size as the bag.
|
||||
globalScaleFactor = 1.25 * 1/self.getScale().x
|
||||
--Super sweet math to set button positions
|
||||
local selfPos = self.getPosition()
|
||||
local objPos = obj.getPosition()
|
||||
local deltaPos = findOffsetDistance(selfPos, objPos, obj)
|
||||
local objPos = rotateLocalCoordinates(deltaPos, self)
|
||||
objPos.x = -objPos.x * globalScaleFactor
|
||||
objPos.y = objPos.y * globalScaleFactor
|
||||
objPos.z = objPos.z * globalScaleFactor
|
||||
--Offset rotation of bag
|
||||
local rot = self.getRotation()
|
||||
rot.y = -rot.y + 180
|
||||
--Create function
|
||||
local funcName = "selectButton_" .. howManyButtons
|
||||
local func = function() buttonClick_selection(dummyIndex, obj) end
|
||||
self.setVar(funcName, func)
|
||||
self.createButton({
|
||||
click_function=funcName, function_owner=self,
|
||||
position=objPos, rotation=rot, height=1000, width=1000,
|
||||
color={0.75,0.25,0.25,0.6},
|
||||
})
|
||||
howManyButtons = howManyButtons + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Creates submit and cancel buttons
|
||||
function createSetupActionButtons()
|
||||
self.createButton({
|
||||
label="Cancel", click_function="buttonClick_cancel", function_owner=self,
|
||||
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=1100,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Submit", click_function="buttonClick_submit", function_owner=self,
|
||||
position={0,0.3,-2.8}, rotation={0,180,0}, height=350, width=1100,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Reset", click_function="buttonClick_reset", function_owner=self,
|
||||
position={-2,0.3,0}, rotation={0,270,0}, height=350, width=800,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
--During Setup
|
||||
|
||||
|
||||
--Checks or unchecks buttons
|
||||
function buttonClick_selection(index, obj)
|
||||
local color = {0,1,0,0.6}
|
||||
if memoryList[obj.getGUID()] == nil then
|
||||
self.editButton({index=index, color=color})
|
||||
--Adding pos/rot to memory table
|
||||
local pos, rot = obj.getPosition(), obj.getRotation()
|
||||
--I need to add it like this or it won't save due to indexing issue
|
||||
memoryList[obj.getGUID()] = {
|
||||
pos={x=round(pos.x,4), y=round(pos.y,4), z=round(pos.z,4)},
|
||||
rot={x=round(rot.x,4), y=round(rot.y,4), z=round(rot.z,4)},
|
||||
lock=obj.getLock()
|
||||
}
|
||||
obj.highlightOn({0,1,0})
|
||||
else
|
||||
color = {0.75,0.25,0.25,0.6}
|
||||
self.editButton({index=index, color=color})
|
||||
memoryList[obj.getGUID()] = nil
|
||||
obj.highlightOff()
|
||||
end
|
||||
end
|
||||
|
||||
--Cancels selection process
|
||||
function buttonClick_cancel()
|
||||
memoryList = memoryListBackup
|
||||
self.clearButtons()
|
||||
if next(memoryList) == nil then
|
||||
createSetupButton()
|
||||
else
|
||||
createMemoryActionButtons()
|
||||
end
|
||||
removeAllHighlights()
|
||||
broadcastToAll("Selection Canceled", {1,1,1})
|
||||
end
|
||||
|
||||
--Saves selections
|
||||
function buttonClick_submit()
|
||||
if next(memoryList) == nil then
|
||||
broadcastToAll("You cannot submit without any selections.", {0.75, 0.25, 0.25})
|
||||
else
|
||||
self.clearButtons()
|
||||
createMemoryActionButtons()
|
||||
local count = 0
|
||||
for guid in pairs(memoryList) do
|
||||
count = count + 1
|
||||
local obj = getObjectFromGUID(guid)
|
||||
if obj ~= nil then obj.highlightOff() end
|
||||
end
|
||||
broadcastToAll(count.." Objects Saved", {1,1,1})
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
--Resets bag to starting status
|
||||
function buttonClick_reset()
|
||||
memoryList = {}
|
||||
self.clearButtons()
|
||||
createSetupButton()
|
||||
removeAllHighlights()
|
||||
broadcastToAll("Tool Reset", {1,1,1})
|
||||
updateSave()
|
||||
end
|
||||
|
||||
|
||||
--After Setup
|
||||
|
||||
|
||||
--Creates recall and place buttons
|
||||
function createMemoryActionButtons()
|
||||
self.createButton({
|
||||
label="Place", click_function="buttonClick_place", function_owner=self,
|
||||
position={0.6,0.1,2.1}, rotation={0,0,0}, height=220, width=500,
|
||||
font_size=130, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Recall", click_function="buttonClick_recall", function_owner=self,
|
||||
position={-0.6,0.1,2.1}, rotation={0,0,0}, height=220, width=500,
|
||||
font_size=130, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
-- self.createButton({
|
||||
-- label="Setup", click_function="buttonClick_setup", function_owner=self,
|
||||
-- position={2,0.3,0}, rotation={0,90,0}, height=350, width=800,
|
||||
-- font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
-- })
|
||||
end
|
||||
|
||||
--Sends objects from bag/table to their saved position/rotation
|
||||
function buttonClick_place()
|
||||
local bagObjList = self.getObjects()
|
||||
for guid, entry in pairs(memoryList) do
|
||||
local obj = getObjectFromGUID(guid)
|
||||
--If obj is out on the table, move it to the saved pos/rot
|
||||
if obj ~= nil then
|
||||
obj.setPositionSmooth(entry.pos)
|
||||
obj.setRotationSmooth(entry.rot)
|
||||
obj.setLock(entry.lock)
|
||||
else
|
||||
--If obj is inside of the bag
|
||||
for _, bagObj in ipairs(bagObjList) do
|
||||
if bagObj.guid == guid then
|
||||
local item = self.takeObject({
|
||||
guid=guid, position=entry.pos, rotation=entry.rot,
|
||||
})
|
||||
item.setLock(entry.lock)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
broadcastToAll("Objects Placed", {1,1,1})
|
||||
end
|
||||
|
||||
--Recalls objects to bag from table
|
||||
function buttonClick_recall()
|
||||
for guid, entry in pairs(memoryList) do
|
||||
local obj = getObjectFromGUID(guid)
|
||||
if obj ~= nil then self.putObject(obj) end
|
||||
end
|
||||
broadcastToAll("Objects Recalled", {1,1,1})
|
||||
end
|
||||
|
||||
|
||||
--Utility functions
|
||||
|
||||
|
||||
--Find delta (difference) between 2 x/y/z coordinates
|
||||
function findOffsetDistance(p1, p2, obj)
|
||||
local deltaPos = {}
|
||||
local bounds = obj.getBounds()
|
||||
deltaPos.x = (p2.x-p1.x)
|
||||
deltaPos.y = (p2.y-p1.y) + (bounds.size.y - bounds.offset.y)
|
||||
deltaPos.z = (p2.z-p1.z)
|
||||
return deltaPos
|
||||
end
|
||||
|
||||
--Used to rotate a set of coordinates by an angle
|
||||
function rotateLocalCoordinates(desiredPos, obj)
|
||||
local objPos, objRot = obj.getPosition(), obj.getRotation()
|
||||
local angle = math.rad(objRot.y)
|
||||
local x = desiredPos.x * math.cos(angle) - desiredPos.z * math.sin(angle)
|
||||
local z = desiredPos.x * math.sin(angle) + desiredPos.z * math.cos(angle)
|
||||
--return {x=objPos.x+x, y=objPos.y+desiredPos.y, z=objPos.z+z}
|
||||
return {x=x, y=desiredPos.y, z=z}
|
||||
end
|
||||
|
||||
--Coroutine delay, in seconds
|
||||
function wait(time)
|
||||
local start = os.time()
|
||||
repeat coroutine.yield(0) until os.time() > start + time
|
||||
end
|
||||
|
||||
--Duplicates a table (needed to prevent it making reference to the same objects)
|
||||
function duplicateTable(oldTable)
|
||||
local newTable = {}
|
||||
for k, v in pairs(oldTable) do
|
||||
newTable[k] = v
|
||||
end
|
||||
return newTable
|
||||
end
|
||||
|
||||
--Moves scripted highlight from all objects
|
||||
function removeAllHighlights()
|
||||
for _, obj in ipairs(getAllObjects()) do
|
||||
obj.highlightOff()
|
||||
end
|
||||
end
|
||||
|
||||
--Round number (num) to the Nth decimal (dec)
|
||||
function round(num, dec)
|
||||
local mult = 10^(dec or 0)
|
||||
return math.floor(num * mult + 0.5) / mult
|
||||
end
|
||||
|
@ -1,21 +1,21 @@
|
||||
name = 'Core Set'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
name = 'Core Set'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
@ -1,273 +1,273 @@
|
||||
function updateSave()
|
||||
local data_to_save = {["ml"]=memoryList}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function onload(saved_data)
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
--Set up information off of loaded_data
|
||||
memoryList = loaded_data.ml
|
||||
else
|
||||
--Set up information for if there is no saved saved data
|
||||
memoryList = {}
|
||||
end
|
||||
|
||||
if next(memoryList) == nil then
|
||||
createSetupButton()
|
||||
else
|
||||
createMemoryActionButtons()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--Beginning Setup
|
||||
|
||||
|
||||
--Make setup button
|
||||
function createSetupButton()
|
||||
self.createButton({
|
||||
label="Setup", click_function="buttonClick_setup", function_owner=self,
|
||||
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=800,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
end
|
||||
|
||||
--Triggered by setup button,
|
||||
function buttonClick_setup()
|
||||
memoryListBackup = duplicateTable(memoryList)
|
||||
memoryList = {}
|
||||
self.clearButtons()
|
||||
createButtonsOnAllObjects()
|
||||
createSetupActionButtons()
|
||||
end
|
||||
|
||||
--Creates selection buttons on objects
|
||||
function createButtonsOnAllObjects()
|
||||
local howManyButtons = 0
|
||||
for _, obj in ipairs(getAllObjects()) do
|
||||
if obj ~= self then
|
||||
local dummyIndex = howManyButtons
|
||||
--On a normal bag, the button positions aren't the same size as the bag.
|
||||
globalScaleFactor = 1.25 * 1/self.getScale().x
|
||||
--Super sweet math to set button positions
|
||||
local selfPos = self.getPosition()
|
||||
local objPos = obj.getPosition()
|
||||
local deltaPos = findOffsetDistance(selfPos, objPos, obj)
|
||||
local objPos = rotateLocalCoordinates(deltaPos, self)
|
||||
objPos.x = -objPos.x * globalScaleFactor
|
||||
objPos.y = objPos.y * globalScaleFactor
|
||||
objPos.z = objPos.z * globalScaleFactor
|
||||
--Offset rotation of bag
|
||||
local rot = self.getRotation()
|
||||
rot.y = -rot.y + 180
|
||||
--Create function
|
||||
local funcName = "selectButton_" .. howManyButtons
|
||||
local func = function() buttonClick_selection(dummyIndex, obj) end
|
||||
self.setVar(funcName, func)
|
||||
self.createButton({
|
||||
click_function=funcName, function_owner=self,
|
||||
position=objPos, rotation=rot, height=1000, width=1000,
|
||||
color={0.75,0.25,0.25,0.6},
|
||||
})
|
||||
howManyButtons = howManyButtons + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Creates submit and cancel buttons
|
||||
function createSetupActionButtons()
|
||||
self.createButton({
|
||||
label="Cancel", click_function="buttonClick_cancel", function_owner=self,
|
||||
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=1100,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Submit", click_function="buttonClick_submit", function_owner=self,
|
||||
position={0,0.3,-2.8}, rotation={0,180,0}, height=350, width=1100,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Reset", click_function="buttonClick_reset", function_owner=self,
|
||||
position={-2,0.3,0}, rotation={0,270,0}, height=350, width=800,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
--During Setup
|
||||
|
||||
|
||||
--Checks or unchecks buttons
|
||||
function buttonClick_selection(index, obj)
|
||||
local color = {0,1,0,0.6}
|
||||
if memoryList[obj.getGUID()] == nil then
|
||||
self.editButton({index=index, color=color})
|
||||
--Adding pos/rot to memory table
|
||||
local pos, rot = obj.getPosition(), obj.getRotation()
|
||||
--I need to add it like this or it won't save due to indexing issue
|
||||
memoryList[obj.getGUID()] = {
|
||||
pos={x=round(pos.x,4), y=round(pos.y,4), z=round(pos.z,4)},
|
||||
rot={x=round(rot.x,4), y=round(rot.y,4), z=round(rot.z,4)},
|
||||
lock=obj.getLock()
|
||||
}
|
||||
obj.highlightOn({0,1,0})
|
||||
else
|
||||
color = {0.75,0.25,0.25,0.6}
|
||||
self.editButton({index=index, color=color})
|
||||
memoryList[obj.getGUID()] = nil
|
||||
obj.highlightOff()
|
||||
end
|
||||
end
|
||||
|
||||
--Cancels selection process
|
||||
function buttonClick_cancel()
|
||||
memoryList = memoryListBackup
|
||||
self.clearButtons()
|
||||
if next(memoryList) == nil then
|
||||
createSetupButton()
|
||||
else
|
||||
createMemoryActionButtons()
|
||||
end
|
||||
removeAllHighlights()
|
||||
broadcastToAll("Selection Canceled", {1,1,1})
|
||||
end
|
||||
|
||||
--Saves selections
|
||||
function buttonClick_submit()
|
||||
if next(memoryList) == nil then
|
||||
broadcastToAll("You cannot submit without any selections.", {0.75, 0.25, 0.25})
|
||||
else
|
||||
self.clearButtons()
|
||||
createMemoryActionButtons()
|
||||
local count = 0
|
||||
for guid in pairs(memoryList) do
|
||||
count = count + 1
|
||||
local obj = getObjectFromGUID(guid)
|
||||
if obj ~= nil then obj.highlightOff() end
|
||||
end
|
||||
broadcastToAll(count.." Objects Saved", {1,1,1})
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
--Resets bag to starting status
|
||||
function buttonClick_reset()
|
||||
memoryList = {}
|
||||
self.clearButtons()
|
||||
createSetupButton()
|
||||
removeAllHighlights()
|
||||
broadcastToAll("Tool Reset", {1,1,1})
|
||||
updateSave()
|
||||
end
|
||||
|
||||
|
||||
--After Setup
|
||||
|
||||
|
||||
--Creates recall and place buttons
|
||||
function createMemoryActionButtons()
|
||||
self.createButton({
|
||||
label="Place", click_function="buttonClick_place", function_owner=self,
|
||||
position={0.6,0.1,2.1}, rotation={0,0,0}, height=220, width=500,
|
||||
font_size=130, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Recall", click_function="buttonClick_recall", function_owner=self,
|
||||
position={-0.6,0.1,2.1}, rotation={0,0,0}, height=220, width=500,
|
||||
font_size=130, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
-- self.createButton({
|
||||
-- label="Setup", click_function="buttonClick_setup", function_owner=self,
|
||||
-- position={2,0.3,0}, rotation={0,90,0}, height=350, width=800,
|
||||
-- font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
-- })
|
||||
end
|
||||
|
||||
--Sends objects from bag/table to their saved position/rotation
|
||||
function buttonClick_place()
|
||||
local bagObjList = self.getObjects()
|
||||
for guid, entry in pairs(memoryList) do
|
||||
local obj = getObjectFromGUID(guid)
|
||||
--If obj is out on the table, move it to the saved pos/rot
|
||||
if obj ~= nil then
|
||||
obj.setPositionSmooth(entry.pos)
|
||||
obj.setRotationSmooth(entry.rot)
|
||||
obj.setLock(entry.lock)
|
||||
else
|
||||
--If obj is inside of the bag
|
||||
for _, bagObj in ipairs(bagObjList) do
|
||||
if bagObj.guid == guid then
|
||||
local item = self.takeObject({
|
||||
guid=guid, position=entry.pos, rotation=entry.rot,
|
||||
})
|
||||
item.setLock(entry.lock)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
broadcastToAll("Objects Placed", {1,1,1})
|
||||
end
|
||||
|
||||
--Recalls objects to bag from table
|
||||
function buttonClick_recall()
|
||||
for guid, entry in pairs(memoryList) do
|
||||
local obj = getObjectFromGUID(guid)
|
||||
if obj ~= nil then self.putObject(obj) end
|
||||
end
|
||||
broadcastToAll("Objects Recalled", {1,1,1})
|
||||
end
|
||||
|
||||
|
||||
--Utility functions
|
||||
|
||||
|
||||
--Find delta (difference) between 2 x/y/z coordinates
|
||||
function findOffsetDistance(p1, p2, obj)
|
||||
local deltaPos = {}
|
||||
local bounds = obj.getBounds()
|
||||
deltaPos.x = (p2.x-p1.x)
|
||||
deltaPos.y = (p2.y-p1.y) + (bounds.size.y - bounds.offset.y)
|
||||
deltaPos.z = (p2.z-p1.z)
|
||||
return deltaPos
|
||||
end
|
||||
|
||||
--Used to rotate a set of coordinates by an angle
|
||||
function rotateLocalCoordinates(desiredPos, obj)
|
||||
local objPos, objRot = obj.getPosition(), obj.getRotation()
|
||||
local angle = math.rad(objRot.y)
|
||||
local x = desiredPos.x * math.cos(angle) - desiredPos.z * math.sin(angle)
|
||||
local z = desiredPos.x * math.sin(angle) + desiredPos.z * math.cos(angle)
|
||||
--return {x=objPos.x+x, y=objPos.y+desiredPos.y, z=objPos.z+z}
|
||||
return {x=x, y=desiredPos.y, z=z}
|
||||
end
|
||||
|
||||
--Coroutine delay, in seconds
|
||||
function wait(time)
|
||||
local start = os.time()
|
||||
repeat coroutine.yield(0) until os.time() > start + time
|
||||
end
|
||||
|
||||
--Duplicates a table (needed to prevent it making reference to the same objects)
|
||||
function duplicateTable(oldTable)
|
||||
local newTable = {}
|
||||
for k, v in pairs(oldTable) do
|
||||
newTable[k] = v
|
||||
end
|
||||
return newTable
|
||||
end
|
||||
|
||||
--Moves scripted highlight from all objects
|
||||
function removeAllHighlights()
|
||||
for _, obj in ipairs(getAllObjects()) do
|
||||
obj.highlightOff()
|
||||
end
|
||||
end
|
||||
|
||||
--Round number (num) to the Nth decimal (dec)
|
||||
function round(num, dec)
|
||||
local mult = 10^(dec or 0)
|
||||
return math.floor(num * mult + 0.5) / mult
|
||||
end
|
||||
function updateSave()
|
||||
local data_to_save = {["ml"]=memoryList}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function onload(saved_data)
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
--Set up information off of loaded_data
|
||||
memoryList = loaded_data.ml
|
||||
else
|
||||
--Set up information for if there is no saved saved data
|
||||
memoryList = {}
|
||||
end
|
||||
|
||||
if next(memoryList) == nil then
|
||||
createSetupButton()
|
||||
else
|
||||
createMemoryActionButtons()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--Beginning Setup
|
||||
|
||||
|
||||
--Make setup button
|
||||
function createSetupButton()
|
||||
self.createButton({
|
||||
label="Setup", click_function="buttonClick_setup", function_owner=self,
|
||||
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=800,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
end
|
||||
|
||||
--Triggered by setup button,
|
||||
function buttonClick_setup()
|
||||
memoryListBackup = duplicateTable(memoryList)
|
||||
memoryList = {}
|
||||
self.clearButtons()
|
||||
createButtonsOnAllObjects()
|
||||
createSetupActionButtons()
|
||||
end
|
||||
|
||||
--Creates selection buttons on objects
|
||||
function createButtonsOnAllObjects()
|
||||
local howManyButtons = 0
|
||||
for _, obj in ipairs(getAllObjects()) do
|
||||
if obj ~= self then
|
||||
local dummyIndex = howManyButtons
|
||||
--On a normal bag, the button positions aren't the same size as the bag.
|
||||
globalScaleFactor = 1.25 * 1/self.getScale().x
|
||||
--Super sweet math to set button positions
|
||||
local selfPos = self.getPosition()
|
||||
local objPos = obj.getPosition()
|
||||
local deltaPos = findOffsetDistance(selfPos, objPos, obj)
|
||||
local objPos = rotateLocalCoordinates(deltaPos, self)
|
||||
objPos.x = -objPos.x * globalScaleFactor
|
||||
objPos.y = objPos.y * globalScaleFactor
|
||||
objPos.z = objPos.z * globalScaleFactor
|
||||
--Offset rotation of bag
|
||||
local rot = self.getRotation()
|
||||
rot.y = -rot.y + 180
|
||||
--Create function
|
||||
local funcName = "selectButton_" .. howManyButtons
|
||||
local func = function() buttonClick_selection(dummyIndex, obj) end
|
||||
self.setVar(funcName, func)
|
||||
self.createButton({
|
||||
click_function=funcName, function_owner=self,
|
||||
position=objPos, rotation=rot, height=1000, width=1000,
|
||||
color={0.75,0.25,0.25,0.6},
|
||||
})
|
||||
howManyButtons = howManyButtons + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Creates submit and cancel buttons
|
||||
function createSetupActionButtons()
|
||||
self.createButton({
|
||||
label="Cancel", click_function="buttonClick_cancel", function_owner=self,
|
||||
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=1100,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Submit", click_function="buttonClick_submit", function_owner=self,
|
||||
position={0,0.3,-2.8}, rotation={0,180,0}, height=350, width=1100,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Reset", click_function="buttonClick_reset", function_owner=self,
|
||||
position={-2,0.3,0}, rotation={0,270,0}, height=350, width=800,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
--During Setup
|
||||
|
||||
|
||||
--Checks or unchecks buttons
|
||||
function buttonClick_selection(index, obj)
|
||||
local color = {0,1,0,0.6}
|
||||
if memoryList[obj.getGUID()] == nil then
|
||||
self.editButton({index=index, color=color})
|
||||
--Adding pos/rot to memory table
|
||||
local pos, rot = obj.getPosition(), obj.getRotation()
|
||||
--I need to add it like this or it won't save due to indexing issue
|
||||
memoryList[obj.getGUID()] = {
|
||||
pos={x=round(pos.x,4), y=round(pos.y,4), z=round(pos.z,4)},
|
||||
rot={x=round(rot.x,4), y=round(rot.y,4), z=round(rot.z,4)},
|
||||
lock=obj.getLock()
|
||||
}
|
||||
obj.highlightOn({0,1,0})
|
||||
else
|
||||
color = {0.75,0.25,0.25,0.6}
|
||||
self.editButton({index=index, color=color})
|
||||
memoryList[obj.getGUID()] = nil
|
||||
obj.highlightOff()
|
||||
end
|
||||
end
|
||||
|
||||
--Cancels selection process
|
||||
function buttonClick_cancel()
|
||||
memoryList = memoryListBackup
|
||||
self.clearButtons()
|
||||
if next(memoryList) == nil then
|
||||
createSetupButton()
|
||||
else
|
||||
createMemoryActionButtons()
|
||||
end
|
||||
removeAllHighlights()
|
||||
broadcastToAll("Selection Canceled", {1,1,1})
|
||||
end
|
||||
|
||||
--Saves selections
|
||||
function buttonClick_submit()
|
||||
if next(memoryList) == nil then
|
||||
broadcastToAll("You cannot submit without any selections.", {0.75, 0.25, 0.25})
|
||||
else
|
||||
self.clearButtons()
|
||||
createMemoryActionButtons()
|
||||
local count = 0
|
||||
for guid in pairs(memoryList) do
|
||||
count = count + 1
|
||||
local obj = getObjectFromGUID(guid)
|
||||
if obj ~= nil then obj.highlightOff() end
|
||||
end
|
||||
broadcastToAll(count.." Objects Saved", {1,1,1})
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
--Resets bag to starting status
|
||||
function buttonClick_reset()
|
||||
memoryList = {}
|
||||
self.clearButtons()
|
||||
createSetupButton()
|
||||
removeAllHighlights()
|
||||
broadcastToAll("Tool Reset", {1,1,1})
|
||||
updateSave()
|
||||
end
|
||||
|
||||
|
||||
--After Setup
|
||||
|
||||
|
||||
--Creates recall and place buttons
|
||||
function createMemoryActionButtons()
|
||||
self.createButton({
|
||||
label="Place", click_function="buttonClick_place", function_owner=self,
|
||||
position={0.6,0.1,2.1}, rotation={0,0,0}, height=220, width=500,
|
||||
font_size=130, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Recall", click_function="buttonClick_recall", function_owner=self,
|
||||
position={-0.6,0.1,2.1}, rotation={0,0,0}, height=220, width=500,
|
||||
font_size=130, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
-- self.createButton({
|
||||
-- label="Setup", click_function="buttonClick_setup", function_owner=self,
|
||||
-- position={2,0.3,0}, rotation={0,90,0}, height=350, width=800,
|
||||
-- font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
-- })
|
||||
end
|
||||
|
||||
--Sends objects from bag/table to their saved position/rotation
|
||||
function buttonClick_place()
|
||||
local bagObjList = self.getObjects()
|
||||
for guid, entry in pairs(memoryList) do
|
||||
local obj = getObjectFromGUID(guid)
|
||||
--If obj is out on the table, move it to the saved pos/rot
|
||||
if obj ~= nil then
|
||||
obj.setPositionSmooth(entry.pos)
|
||||
obj.setRotationSmooth(entry.rot)
|
||||
obj.setLock(entry.lock)
|
||||
else
|
||||
--If obj is inside of the bag
|
||||
for _, bagObj in ipairs(bagObjList) do
|
||||
if bagObj.guid == guid then
|
||||
local item = self.takeObject({
|
||||
guid=guid, position=entry.pos, rotation=entry.rot,
|
||||
})
|
||||
item.setLock(entry.lock)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
broadcastToAll("Objects Placed", {1,1,1})
|
||||
end
|
||||
|
||||
--Recalls objects to bag from table
|
||||
function buttonClick_recall()
|
||||
for guid, entry in pairs(memoryList) do
|
||||
local obj = getObjectFromGUID(guid)
|
||||
if obj ~= nil then self.putObject(obj) end
|
||||
end
|
||||
broadcastToAll("Objects Recalled", {1,1,1})
|
||||
end
|
||||
|
||||
|
||||
--Utility functions
|
||||
|
||||
|
||||
--Find delta (difference) between 2 x/y/z coordinates
|
||||
function findOffsetDistance(p1, p2, obj)
|
||||
local deltaPos = {}
|
||||
local bounds = obj.getBounds()
|
||||
deltaPos.x = (p2.x-p1.x)
|
||||
deltaPos.y = (p2.y-p1.y) + (bounds.size.y - bounds.offset.y)
|
||||
deltaPos.z = (p2.z-p1.z)
|
||||
return deltaPos
|
||||
end
|
||||
|
||||
--Used to rotate a set of coordinates by an angle
|
||||
function rotateLocalCoordinates(desiredPos, obj)
|
||||
local objPos, objRot = obj.getPosition(), obj.getRotation()
|
||||
local angle = math.rad(objRot.y)
|
||||
local x = desiredPos.x * math.cos(angle) - desiredPos.z * math.sin(angle)
|
||||
local z = desiredPos.x * math.sin(angle) + desiredPos.z * math.cos(angle)
|
||||
--return {x=objPos.x+x, y=objPos.y+desiredPos.y, z=objPos.z+z}
|
||||
return {x=x, y=desiredPos.y, z=z}
|
||||
end
|
||||
|
||||
--Coroutine delay, in seconds
|
||||
function wait(time)
|
||||
local start = os.time()
|
||||
repeat coroutine.yield(0) until os.time() > start + time
|
||||
end
|
||||
|
||||
--Duplicates a table (needed to prevent it making reference to the same objects)
|
||||
function duplicateTable(oldTable)
|
||||
local newTable = {}
|
||||
for k, v in pairs(oldTable) do
|
||||
newTable[k] = v
|
||||
end
|
||||
return newTable
|
||||
end
|
||||
|
||||
--Moves scripted highlight from all objects
|
||||
function removeAllHighlights()
|
||||
for _, obj in ipairs(getAllObjects()) do
|
||||
obj.highlightOff()
|
||||
end
|
||||
end
|
||||
|
||||
--Round number (num) to the Nth decimal (dec)
|
||||
function round(num, dec)
|
||||
local mult = 10^(dec or 0)
|
||||
return math.floor(num * mult + 0.5) / mult
|
||||
end
|
||||
|
@ -1,21 +1,21 @@
|
||||
name = 'The Devourer Below'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
name = 'The Devourer Below'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
File diff suppressed because it is too large
Load Diff
@ -1,132 +1,132 @@
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
function onload(saved_data)
|
||||
light_mode = false
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0.5, 0.5, 0.5, 95}
|
||||
|
||||
if light_mode then
|
||||
f_color = {0,0,0,98}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,1.45},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1, y=1, z=1},
|
||||
font_size=350,
|
||||
font_color=f_color,
|
||||
color={0,0,0,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
function onload(saved_data)
|
||||
light_mode = false
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0.5, 0.5, 0.5, 95}
|
||||
|
||||
if light_mode then
|
||||
f_color = {0,0,0,98}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,1.45},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1, y=1, z=1},
|
||||
font_size=350,
|
||||
font_color=f_color,
|
||||
color={0,0,0,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
end
|
@ -1,132 +1,132 @@
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
function onload(saved_data)
|
||||
light_mode = false
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0.5, 0.5, 0.5, 95}
|
||||
|
||||
if light_mode then
|
||||
f_color = {0,0,0,98}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,1.45},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1, y=1, z=1},
|
||||
font_size=350,
|
||||
font_color=f_color,
|
||||
color={0,0,0,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
function onload(saved_data)
|
||||
light_mode = false
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0.5, 0.5, 0.5, 95}
|
||||
|
||||
if light_mode then
|
||||
f_color = {0,0,0,98}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,1.45},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1, y=1, z=1},
|
||||
font_size=350,
|
||||
font_color=f_color,
|
||||
color={0,0,0,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
end
|
@ -1,132 +1,132 @@
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
function onload(saved_data)
|
||||
light_mode = false
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0.5, 0.5, 0.5, 95}
|
||||
|
||||
if light_mode then
|
||||
f_color = {0,0,0,98}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,1.45},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1, y=1, z=1},
|
||||
font_size=350,
|
||||
font_color=f_color,
|
||||
color={0,0,0,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
function onload(saved_data)
|
||||
light_mode = false
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0.5, 0.5, 0.5, 95}
|
||||
|
||||
if light_mode then
|
||||
f_color = {0,0,0,98}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,1.45},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1, y=1, z=1},
|
||||
font_size=350,
|
||||
font_color=f_color,
|
||||
color={0,0,0,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
end
|
@ -1,132 +1,132 @@
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
function onload(saved_data)
|
||||
light_mode = false
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0.5, 0.5, 0.5, 95}
|
||||
|
||||
if light_mode then
|
||||
f_color = {0,0,0,98}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,1.45},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1, y=1, z=1},
|
||||
font_size=350,
|
||||
font_color=f_color,
|
||||
color={0,0,0,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
function onload(saved_data)
|
||||
light_mode = false
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0.5, 0.5, 0.5, 95}
|
||||
|
||||
if light_mode then
|
||||
f_color = {0,0,0,98}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,1.45},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1, y=1, z=1},
|
||||
font_size=350,
|
||||
font_color=f_color,
|
||||
color={0,0,0,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
end
|
@ -1,132 +1,132 @@
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
function onload(saved_data)
|
||||
light_mode = false
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0.5, 0.5, 0.5, 95}
|
||||
|
||||
if light_mode then
|
||||
f_color = {0,0,0,98}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,1.45},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1, y=1, z=1},
|
||||
font_size=350,
|
||||
font_color=f_color,
|
||||
color={0,0,0,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
function onload(saved_data)
|
||||
light_mode = false
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0.5, 0.5, 0.5, 95}
|
||||
|
||||
if light_mode then
|
||||
f_color = {0,0,0,98}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,1.45},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1, y=1, z=1},
|
||||
font_size=350,
|
||||
font_color=f_color,
|
||||
color={0,0,0,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
end
|
@ -1,132 +1,132 @@
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
function onload(saved_data)
|
||||
light_mode = false
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0.5, 0.5, 0.5, 95}
|
||||
|
||||
if light_mode then
|
||||
f_color = {0,0,0,98}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,1.45},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1, y=1, z=1},
|
||||
font_size=350,
|
||||
font_color=f_color,
|
||||
color={0,0,0,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
function onload(saved_data)
|
||||
light_mode = false
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0.5, 0.5, 0.5, 95}
|
||||
|
||||
if light_mode then
|
||||
f_color = {0,0,0,98}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,1.45},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1, y=1, z=1},
|
||||
font_size=350,
|
||||
font_color=f_color,
|
||||
color={0,0,0,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
end
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,38 +1,38 @@
|
||||
-- set true to enable debug logging
|
||||
DEBUG = false
|
||||
|
||||
function log(message)
|
||||
if DEBUG then
|
||||
print(message)
|
||||
end
|
||||
end
|
||||
|
||||
--[[
|
||||
Known locations and clues. We check this to determine if we should
|
||||
atttempt to spawn clues, first we look for <LOCATION_NAME>_<GUID> and if
|
||||
we find nothing we look for <LOCATION_NAME>
|
||||
format is [location_guid -> clueCount]
|
||||
]]
|
||||
LOCATIONS_DATA_JSON = [[
|
||||
{
|
||||
"Park Entrance": {"type": "perPlayer", "value": 2, "clueSide": "front"},
|
||||
"Main Street, U.S.A.": {"type": "perPlayer", "value": 1, "clueSide": "front"},
|
||||
"Park Entrance": {"type": "perPlayer", "value": 2, "clueSide": "front"},
|
||||
"The Hub": {"type": "perPlayer", "value": 2, "clueSide": "front"},
|
||||
"Adventureland": {"type": "fixed", "value": 3, "clueSide": "front"},
|
||||
"Frontierland": {"type": "fixed", "value": 3, "clueSide": "front"},
|
||||
"New Orleans Square": {"type": "fixed", "value": 3, "clueSide": "front"},
|
||||
"Critter Country": {"type": "fixed", "value": 3, "clueSide": "front"},
|
||||
"Galaxy's Edge": {"type": "fixed", "value": 3, "clueSide": "front"},
|
||||
"Fantasyland": {"type": "fixed", "value": 3, "clueSide": "front"},
|
||||
"Toontown": {"type": "fixed", "value": 3, "clueSide": "front"},
|
||||
"Tomorrowland": {"type": "fixed", "value": 3, "clueSide": "front"}
|
||||
}
|
||||
]]
|
||||
|
||||
LOCATIONS_DATA = JSON.decode(LOCATIONS_DATA_JSON)
|
||||
|
||||
function onload(save_state)
|
||||
local playArea = getObjectFromGUID('721ba2')
|
||||
playArea.call("updateLocations", {self.getGUID()})
|
||||
end
|
||||
-- set true to enable debug logging
|
||||
DEBUG = false
|
||||
|
||||
function log(message)
|
||||
if DEBUG then
|
||||
print(message)
|
||||
end
|
||||
end
|
||||
|
||||
--[[
|
||||
Known locations and clues. We check this to determine if we should
|
||||
atttempt to spawn clues, first we look for <LOCATION_NAME>_<GUID> and if
|
||||
we find nothing we look for <LOCATION_NAME>
|
||||
format is [location_guid -> clueCount]
|
||||
]]
|
||||
LOCATIONS_DATA_JSON = [[
|
||||
{
|
||||
"Park Entrance": {"type": "perPlayer", "value": 2, "clueSide": "front"},
|
||||
"Main Street, U.S.A.": {"type": "perPlayer", "value": 1, "clueSide": "front"},
|
||||
"Park Entrance": {"type": "perPlayer", "value": 2, "clueSide": "front"},
|
||||
"The Hub": {"type": "perPlayer", "value": 2, "clueSide": "front"},
|
||||
"Adventureland": {"type": "fixed", "value": 3, "clueSide": "front"},
|
||||
"Frontierland": {"type": "fixed", "value": 3, "clueSide": "front"},
|
||||
"New Orleans Square": {"type": "fixed", "value": 3, "clueSide": "front"},
|
||||
"Critter Country": {"type": "fixed", "value": 3, "clueSide": "front"},
|
||||
"Galaxy's Edge": {"type": "fixed", "value": 3, "clueSide": "front"},
|
||||
"Fantasyland": {"type": "fixed", "value": 3, "clueSide": "front"},
|
||||
"Toontown": {"type": "fixed", "value": 3, "clueSide": "front"},
|
||||
"Tomorrowland": {"type": "fixed", "value": 3, "clueSide": "front"}
|
||||
}
|
||||
]]
|
||||
|
||||
LOCATIONS_DATA = JSON.decode(LOCATIONS_DATA_JSON)
|
||||
|
||||
function onload(save_state)
|
||||
local playArea = getObjectFromGUID('721ba2')
|
||||
playArea.call("updateLocations", {self.getGUID()})
|
||||
end
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,21 +1,21 @@
|
||||
name = 'The Dunwich Legacy'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
name = 'The Dunwich Legacy'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,21 +1,21 @@
|
||||
name = 'The Dunwich Legacy'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
name = 'The Dunwich Legacy'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,25 +1,25 @@
|
||||
name = 'The Miskatonic Museum'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
end
|
||||
name = 'The Miskatonic Museum'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
end
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,25 +1,25 @@
|
||||
name = 'The Essex County Express'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
end
|
||||
name = 'The Essex County Express'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
end
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,25 +1,25 @@
|
||||
name = 'Blood on the Altar'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
end
|
||||
name = 'Blood on the Altar'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
end
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,25 +1,25 @@
|
||||
name = 'Undimensioned and Unseen'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
end
|
||||
name = 'Undimensioned and Unseen'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
end
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,25 +1,25 @@
|
||||
name = 'Where Doom Awaits'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
end
|
||||
name = 'Where Doom Awaits'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
end
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,25 +1,25 @@
|
||||
name = 'Lost in Time and Space'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
end
|
||||
name = 'Lost in Time and Space'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
end
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,21 +1,21 @@
|
||||
name = 'The Forgotten Age'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
name = 'The Forgotten Age'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
File diff suppressed because it is too large
Load Diff
@ -1,25 +1,25 @@
|
||||
name = 'The Doom of Eztli'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
name = 'The Doom of Eztli'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
end
|
File diff suppressed because it is too large
Load Diff
@ -1,25 +1,25 @@
|
||||
name = 'Threads of Fate'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
name = 'Threads of Fate'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
end
|
File diff suppressed because it is too large
Load Diff
@ -1,25 +1,25 @@
|
||||
name = 'The Boundary Beyond'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
name = 'The Boundary Beyond'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
end
|
File diff suppressed because it is too large
Load Diff
@ -1,25 +1,25 @@
|
||||
name = 'Heart of the Elders'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
name = 'Heart of the Elders'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
end
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,25 +1,25 @@
|
||||
name = 'The City of Archives'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
name = 'The City of Archives'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
end
|
File diff suppressed because it is too large
Load Diff
@ -1,25 +1,25 @@
|
||||
name = 'The Depths of Yoth'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
name = 'The Depths of Yoth'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
end
|
@ -1,132 +1,132 @@
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
function onload(saved_data)
|
||||
light_mode = false
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0.5, 0.5, 0.5, 95}
|
||||
|
||||
if light_mode then
|
||||
f_color = {0,0,0,98}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,1.45},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1, y=1, z=1},
|
||||
font_size=350,
|
||||
font_color=f_color,
|
||||
color={0,0,0,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
function onload(saved_data)
|
||||
light_mode = false
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0.5, 0.5, 0.5, 95}
|
||||
|
||||
if light_mode then
|
||||
f_color = {0,0,0,98}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,1.45},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1, y=1, z=1},
|
||||
font_size=350,
|
||||
font_color=f_color,
|
||||
color={0,0,0,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
end
|
@ -1,132 +1,132 @@
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
function onload(saved_data)
|
||||
light_mode = false
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0.5, 0.5, 0.5, 95}
|
||||
|
||||
if light_mode then
|
||||
f_color = {0,0,0,98}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,1.45},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1, y=1, z=1},
|
||||
font_size=350,
|
||||
font_color=f_color,
|
||||
color={0,0,0,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
MIN_VALUE = -99
|
||||
MAX_VALUE = 999
|
||||
|
||||
function onload(saved_data)
|
||||
light_mode = false
|
||||
val = 0
|
||||
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
light_mode = loaded_data[1]
|
||||
val = loaded_data[2]
|
||||
end
|
||||
|
||||
createAll()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
local data_to_save = {light_mode, val}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function createAll()
|
||||
s_color = {0.5, 0.5, 0.5, 95}
|
||||
|
||||
if light_mode then
|
||||
f_color = {0,0,0,98}
|
||||
else
|
||||
f_color = {0,0,0,100}
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.createButton({
|
||||
label=tostring(val),
|
||||
click_function="add_subtract",
|
||||
function_owner=self,
|
||||
position={0,0.05,1.45},
|
||||
height=600,
|
||||
width=1000,
|
||||
alignment = 3,
|
||||
scale={x=1, y=1, z=1},
|
||||
font_size=350,
|
||||
font_color=f_color,
|
||||
color={0,0,0,0}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if light_mode then
|
||||
lightButtonText = "[ Set dark ]"
|
||||
else
|
||||
lightButtonText = "[ Set light ]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function removeAll()
|
||||
self.removeInput(0)
|
||||
self.removeInput(1)
|
||||
self.removeButton(0)
|
||||
self.removeButton(1)
|
||||
self.removeButton(2)
|
||||
end
|
||||
|
||||
function reloadAll()
|
||||
removeAll()
|
||||
createAll()
|
||||
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function swap_fcolor(_obj, _color, alt_click)
|
||||
light_mode = not light_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function swap_align(_obj, _color, alt_click)
|
||||
center_mode = not center_mode
|
||||
reloadAll()
|
||||
end
|
||||
|
||||
function editName(_obj, _string, value)
|
||||
self.setName(value)
|
||||
setTooltips()
|
||||
end
|
||||
|
||||
function add_subtract(_obj, _color, alt_click)
|
||||
mod = alt_click and -1 or 1
|
||||
new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE)
|
||||
if val ~= new_value then
|
||||
val = new_value
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function updateVal()
|
||||
|
||||
self.editButton({
|
||||
index = 0,
|
||||
label = tostring(val),
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
function reset_val()
|
||||
val = 0
|
||||
updateVal()
|
||||
updateSave()
|
||||
end
|
||||
|
||||
function setTooltips()
|
||||
self.editInput({
|
||||
index = 0,
|
||||
value = self.getName(),
|
||||
tooltip = ttText
|
||||
})
|
||||
self.editButton({
|
||||
index = 0,
|
||||
value = tostring(val),
|
||||
tooltip = ttText
|
||||
})
|
||||
end
|
||||
|
||||
function null()
|
||||
end
|
||||
|
||||
function keepSample(_obj, _string, value)
|
||||
reloadAll()
|
||||
end
|
File diff suppressed because it is too large
Load Diff
@ -1,21 +1,21 @@
|
||||
name = 'Shattered Aeons'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
name = 'Shattered Aeons'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,273 +1,273 @@
|
||||
function updateSave()
|
||||
local data_to_save = {["ml"]=memoryList}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function onload(saved_data)
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
--Set up information off of loaded_data
|
||||
memoryList = loaded_data.ml
|
||||
else
|
||||
--Set up information for if there is no saved saved data
|
||||
memoryList = {}
|
||||
end
|
||||
|
||||
if next(memoryList) == nil then
|
||||
createSetupButton()
|
||||
else
|
||||
createMemoryActionButtons()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--Beginning Setup
|
||||
|
||||
|
||||
--Make setup button
|
||||
function createSetupButton()
|
||||
self.createButton({
|
||||
label="Setup", click_function="buttonClick_setup", function_owner=self,
|
||||
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=800,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
end
|
||||
|
||||
--Triggered by setup button,
|
||||
function buttonClick_setup()
|
||||
memoryListBackup = duplicateTable(memoryList)
|
||||
memoryList = {}
|
||||
self.clearButtons()
|
||||
createButtonsOnAllObjects()
|
||||
createSetupActionButtons()
|
||||
end
|
||||
|
||||
--Creates selection buttons on objects
|
||||
function createButtonsOnAllObjects()
|
||||
local howManyButtons = 0
|
||||
for _, obj in ipairs(getAllObjects()) do
|
||||
if obj ~= self then
|
||||
local dummyIndex = howManyButtons
|
||||
--On a normal bag, the button positions aren't the same size as the bag.
|
||||
globalScaleFactor = 1.25 * 1/self.getScale().x
|
||||
--Super sweet math to set button positions
|
||||
local selfPos = self.getPosition()
|
||||
local objPos = obj.getPosition()
|
||||
local deltaPos = findOffsetDistance(selfPos, objPos, obj)
|
||||
local objPos = rotateLocalCoordinates(deltaPos, self)
|
||||
objPos.x = -objPos.x * globalScaleFactor
|
||||
objPos.y = objPos.y * globalScaleFactor
|
||||
objPos.z = objPos.z * globalScaleFactor
|
||||
--Offset rotation of bag
|
||||
local rot = self.getRotation()
|
||||
rot.y = -rot.y + 180
|
||||
--Create function
|
||||
local funcName = "selectButton_" .. howManyButtons
|
||||
local func = function() buttonClick_selection(dummyIndex, obj) end
|
||||
self.setVar(funcName, func)
|
||||
self.createButton({
|
||||
click_function=funcName, function_owner=self,
|
||||
position=objPos, rotation=rot, height=1000, width=1000,
|
||||
color={0.75,0.25,0.25,0.6},
|
||||
})
|
||||
howManyButtons = howManyButtons + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Creates submit and cancel buttons
|
||||
function createSetupActionButtons()
|
||||
self.createButton({
|
||||
label="Cancel", click_function="buttonClick_cancel", function_owner=self,
|
||||
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=1100,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Submit", click_function="buttonClick_submit", function_owner=self,
|
||||
position={0,0.3,-2.8}, rotation={0,180,0}, height=350, width=1100,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Reset", click_function="buttonClick_reset", function_owner=self,
|
||||
position={-2,0.3,0}, rotation={0,270,0}, height=350, width=800,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
--During Setup
|
||||
|
||||
|
||||
--Checks or unchecks buttons
|
||||
function buttonClick_selection(index, obj)
|
||||
local color = {0,1,0,0.6}
|
||||
if memoryList[obj.getGUID()] == nil then
|
||||
self.editButton({index=index, color=color})
|
||||
--Adding pos/rot to memory table
|
||||
local pos, rot = obj.getPosition(), obj.getRotation()
|
||||
--I need to add it like this or it won't save due to indexing issue
|
||||
memoryList[obj.getGUID()] = {
|
||||
pos={x=round(pos.x,4), y=round(pos.y,4), z=round(pos.z,4)},
|
||||
rot={x=round(rot.x,4), y=round(rot.y,4), z=round(rot.z,4)},
|
||||
lock=obj.getLock()
|
||||
}
|
||||
obj.highlightOn({0,1,0})
|
||||
else
|
||||
color = {0.75,0.25,0.25,0.6}
|
||||
self.editButton({index=index, color=color})
|
||||
memoryList[obj.getGUID()] = nil
|
||||
obj.highlightOff()
|
||||
end
|
||||
end
|
||||
|
||||
--Cancels selection process
|
||||
function buttonClick_cancel()
|
||||
memoryList = memoryListBackup
|
||||
self.clearButtons()
|
||||
if next(memoryList) == nil then
|
||||
createSetupButton()
|
||||
else
|
||||
createMemoryActionButtons()
|
||||
end
|
||||
removeAllHighlights()
|
||||
broadcastToAll("Selection Canceled", {1,1,1})
|
||||
end
|
||||
|
||||
--Saves selections
|
||||
function buttonClick_submit()
|
||||
if next(memoryList) == nil then
|
||||
broadcastToAll("You cannot submit without any selections.", {0.75, 0.25, 0.25})
|
||||
else
|
||||
self.clearButtons()
|
||||
createMemoryActionButtons()
|
||||
local count = 0
|
||||
for guid in pairs(memoryList) do
|
||||
count = count + 1
|
||||
local obj = getObjectFromGUID(guid)
|
||||
if obj ~= nil then obj.highlightOff() end
|
||||
end
|
||||
broadcastToAll(count.." Objects Saved", {1,1,1})
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
--Resets bag to starting status
|
||||
function buttonClick_reset()
|
||||
memoryList = {}
|
||||
self.clearButtons()
|
||||
createSetupButton()
|
||||
removeAllHighlights()
|
||||
broadcastToAll("Tool Reset", {1,1,1})
|
||||
updateSave()
|
||||
end
|
||||
|
||||
|
||||
--After Setup
|
||||
|
||||
|
||||
--Creates recall and place buttons
|
||||
function createMemoryActionButtons()
|
||||
self.createButton({
|
||||
label="Place", click_function="buttonClick_place", function_owner=self,
|
||||
position={0.6,0.1,2.1}, rotation={0,0,0}, height=220, width=500,
|
||||
font_size=130, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Recall", click_function="buttonClick_recall", function_owner=self,
|
||||
position={-0.6,0.1,2.1}, rotation={0,0,0}, height=220, width=500,
|
||||
font_size=130, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
-- self.createButton({
|
||||
-- label="Setup", click_function="buttonClick_setup", function_owner=self,
|
||||
-- position={2,0.3,0}, rotation={0,90,0}, height=350, width=800,
|
||||
-- font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
-- })
|
||||
end
|
||||
|
||||
--Sends objects from bag/table to their saved position/rotation
|
||||
function buttonClick_place()
|
||||
local bagObjList = self.getObjects()
|
||||
for guid, entry in pairs(memoryList) do
|
||||
local obj = getObjectFromGUID(guid)
|
||||
--If obj is out on the table, move it to the saved pos/rot
|
||||
if obj ~= nil then
|
||||
obj.setPositionSmooth(entry.pos)
|
||||
obj.setRotationSmooth(entry.rot)
|
||||
obj.setLock(entry.lock)
|
||||
else
|
||||
--If obj is inside of the bag
|
||||
for _, bagObj in ipairs(bagObjList) do
|
||||
if bagObj.guid == guid then
|
||||
local item = self.takeObject({
|
||||
guid=guid, position=entry.pos, rotation=entry.rot,
|
||||
})
|
||||
item.setLock(entry.lock)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
broadcastToAll("Objects Placed", {1,1,1})
|
||||
end
|
||||
|
||||
--Recalls objects to bag from table
|
||||
function buttonClick_recall()
|
||||
for guid, entry in pairs(memoryList) do
|
||||
local obj = getObjectFromGUID(guid)
|
||||
if obj ~= nil then self.putObject(obj) end
|
||||
end
|
||||
broadcastToAll("Objects Recalled", {1,1,1})
|
||||
end
|
||||
|
||||
|
||||
--Utility functions
|
||||
|
||||
|
||||
--Find delta (difference) between 2 x/y/z coordinates
|
||||
function findOffsetDistance(p1, p2, obj)
|
||||
local deltaPos = {}
|
||||
local bounds = obj.getBounds()
|
||||
deltaPos.x = (p2.x-p1.x)
|
||||
deltaPos.y = (p2.y-p1.y) + (bounds.size.y - bounds.offset.y)
|
||||
deltaPos.z = (p2.z-p1.z)
|
||||
return deltaPos
|
||||
end
|
||||
|
||||
--Used to rotate a set of coordinates by an angle
|
||||
function rotateLocalCoordinates(desiredPos, obj)
|
||||
local objPos, objRot = obj.getPosition(), obj.getRotation()
|
||||
local angle = math.rad(objRot.y)
|
||||
local x = desiredPos.x * math.cos(angle) - desiredPos.z * math.sin(angle)
|
||||
local z = desiredPos.x * math.sin(angle) + desiredPos.z * math.cos(angle)
|
||||
--return {x=objPos.x+x, y=objPos.y+desiredPos.y, z=objPos.z+z}
|
||||
return {x=x, y=desiredPos.y, z=z}
|
||||
end
|
||||
|
||||
--Coroutine delay, in seconds
|
||||
function wait(time)
|
||||
local start = os.time()
|
||||
repeat coroutine.yield(0) until os.time() > start + time
|
||||
end
|
||||
|
||||
--Duplicates a table (needed to prevent it making reference to the same objects)
|
||||
function duplicateTable(oldTable)
|
||||
local newTable = {}
|
||||
for k, v in pairs(oldTable) do
|
||||
newTable[k] = v
|
||||
end
|
||||
return newTable
|
||||
end
|
||||
|
||||
--Moves scripted highlight from all objects
|
||||
function removeAllHighlights()
|
||||
for _, obj in ipairs(getAllObjects()) do
|
||||
obj.highlightOff()
|
||||
end
|
||||
end
|
||||
|
||||
--Round number (num) to the Nth decimal (dec)
|
||||
function round(num, dec)
|
||||
local mult = 10^(dec or 0)
|
||||
return math.floor(num * mult + 0.5) / mult
|
||||
end
|
||||
function updateSave()
|
||||
local data_to_save = {["ml"]=memoryList}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function onload(saved_data)
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
--Set up information off of loaded_data
|
||||
memoryList = loaded_data.ml
|
||||
else
|
||||
--Set up information for if there is no saved saved data
|
||||
memoryList = {}
|
||||
end
|
||||
|
||||
if next(memoryList) == nil then
|
||||
createSetupButton()
|
||||
else
|
||||
createMemoryActionButtons()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--Beginning Setup
|
||||
|
||||
|
||||
--Make setup button
|
||||
function createSetupButton()
|
||||
self.createButton({
|
||||
label="Setup", click_function="buttonClick_setup", function_owner=self,
|
||||
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=800,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
end
|
||||
|
||||
--Triggered by setup button,
|
||||
function buttonClick_setup()
|
||||
memoryListBackup = duplicateTable(memoryList)
|
||||
memoryList = {}
|
||||
self.clearButtons()
|
||||
createButtonsOnAllObjects()
|
||||
createSetupActionButtons()
|
||||
end
|
||||
|
||||
--Creates selection buttons on objects
|
||||
function createButtonsOnAllObjects()
|
||||
local howManyButtons = 0
|
||||
for _, obj in ipairs(getAllObjects()) do
|
||||
if obj ~= self then
|
||||
local dummyIndex = howManyButtons
|
||||
--On a normal bag, the button positions aren't the same size as the bag.
|
||||
globalScaleFactor = 1.25 * 1/self.getScale().x
|
||||
--Super sweet math to set button positions
|
||||
local selfPos = self.getPosition()
|
||||
local objPos = obj.getPosition()
|
||||
local deltaPos = findOffsetDistance(selfPos, objPos, obj)
|
||||
local objPos = rotateLocalCoordinates(deltaPos, self)
|
||||
objPos.x = -objPos.x * globalScaleFactor
|
||||
objPos.y = objPos.y * globalScaleFactor
|
||||
objPos.z = objPos.z * globalScaleFactor
|
||||
--Offset rotation of bag
|
||||
local rot = self.getRotation()
|
||||
rot.y = -rot.y + 180
|
||||
--Create function
|
||||
local funcName = "selectButton_" .. howManyButtons
|
||||
local func = function() buttonClick_selection(dummyIndex, obj) end
|
||||
self.setVar(funcName, func)
|
||||
self.createButton({
|
||||
click_function=funcName, function_owner=self,
|
||||
position=objPos, rotation=rot, height=1000, width=1000,
|
||||
color={0.75,0.25,0.25,0.6},
|
||||
})
|
||||
howManyButtons = howManyButtons + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Creates submit and cancel buttons
|
||||
function createSetupActionButtons()
|
||||
self.createButton({
|
||||
label="Cancel", click_function="buttonClick_cancel", function_owner=self,
|
||||
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=1100,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Submit", click_function="buttonClick_submit", function_owner=self,
|
||||
position={0,0.3,-2.8}, rotation={0,180,0}, height=350, width=1100,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Reset", click_function="buttonClick_reset", function_owner=self,
|
||||
position={-2,0.3,0}, rotation={0,270,0}, height=350, width=800,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
--During Setup
|
||||
|
||||
|
||||
--Checks or unchecks buttons
|
||||
function buttonClick_selection(index, obj)
|
||||
local color = {0,1,0,0.6}
|
||||
if memoryList[obj.getGUID()] == nil then
|
||||
self.editButton({index=index, color=color})
|
||||
--Adding pos/rot to memory table
|
||||
local pos, rot = obj.getPosition(), obj.getRotation()
|
||||
--I need to add it like this or it won't save due to indexing issue
|
||||
memoryList[obj.getGUID()] = {
|
||||
pos={x=round(pos.x,4), y=round(pos.y,4), z=round(pos.z,4)},
|
||||
rot={x=round(rot.x,4), y=round(rot.y,4), z=round(rot.z,4)},
|
||||
lock=obj.getLock()
|
||||
}
|
||||
obj.highlightOn({0,1,0})
|
||||
else
|
||||
color = {0.75,0.25,0.25,0.6}
|
||||
self.editButton({index=index, color=color})
|
||||
memoryList[obj.getGUID()] = nil
|
||||
obj.highlightOff()
|
||||
end
|
||||
end
|
||||
|
||||
--Cancels selection process
|
||||
function buttonClick_cancel()
|
||||
memoryList = memoryListBackup
|
||||
self.clearButtons()
|
||||
if next(memoryList) == nil then
|
||||
createSetupButton()
|
||||
else
|
||||
createMemoryActionButtons()
|
||||
end
|
||||
removeAllHighlights()
|
||||
broadcastToAll("Selection Canceled", {1,1,1})
|
||||
end
|
||||
|
||||
--Saves selections
|
||||
function buttonClick_submit()
|
||||
if next(memoryList) == nil then
|
||||
broadcastToAll("You cannot submit without any selections.", {0.75, 0.25, 0.25})
|
||||
else
|
||||
self.clearButtons()
|
||||
createMemoryActionButtons()
|
||||
local count = 0
|
||||
for guid in pairs(memoryList) do
|
||||
count = count + 1
|
||||
local obj = getObjectFromGUID(guid)
|
||||
if obj ~= nil then obj.highlightOff() end
|
||||
end
|
||||
broadcastToAll(count.." Objects Saved", {1,1,1})
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
--Resets bag to starting status
|
||||
function buttonClick_reset()
|
||||
memoryList = {}
|
||||
self.clearButtons()
|
||||
createSetupButton()
|
||||
removeAllHighlights()
|
||||
broadcastToAll("Tool Reset", {1,1,1})
|
||||
updateSave()
|
||||
end
|
||||
|
||||
|
||||
--After Setup
|
||||
|
||||
|
||||
--Creates recall and place buttons
|
||||
function createMemoryActionButtons()
|
||||
self.createButton({
|
||||
label="Place", click_function="buttonClick_place", function_owner=self,
|
||||
position={0.6,0.1,2.1}, rotation={0,0,0}, height=220, width=500,
|
||||
font_size=130, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Recall", click_function="buttonClick_recall", function_owner=self,
|
||||
position={-0.6,0.1,2.1}, rotation={0,0,0}, height=220, width=500,
|
||||
font_size=130, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
-- self.createButton({
|
||||
-- label="Setup", click_function="buttonClick_setup", function_owner=self,
|
||||
-- position={2,0.3,0}, rotation={0,90,0}, height=350, width=800,
|
||||
-- font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
-- })
|
||||
end
|
||||
|
||||
--Sends objects from bag/table to their saved position/rotation
|
||||
function buttonClick_place()
|
||||
local bagObjList = self.getObjects()
|
||||
for guid, entry in pairs(memoryList) do
|
||||
local obj = getObjectFromGUID(guid)
|
||||
--If obj is out on the table, move it to the saved pos/rot
|
||||
if obj ~= nil then
|
||||
obj.setPositionSmooth(entry.pos)
|
||||
obj.setRotationSmooth(entry.rot)
|
||||
obj.setLock(entry.lock)
|
||||
else
|
||||
--If obj is inside of the bag
|
||||
for _, bagObj in ipairs(bagObjList) do
|
||||
if bagObj.guid == guid then
|
||||
local item = self.takeObject({
|
||||
guid=guid, position=entry.pos, rotation=entry.rot,
|
||||
})
|
||||
item.setLock(entry.lock)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
broadcastToAll("Objects Placed", {1,1,1})
|
||||
end
|
||||
|
||||
--Recalls objects to bag from table
|
||||
function buttonClick_recall()
|
||||
for guid, entry in pairs(memoryList) do
|
||||
local obj = getObjectFromGUID(guid)
|
||||
if obj ~= nil then self.putObject(obj) end
|
||||
end
|
||||
broadcastToAll("Objects Recalled", {1,1,1})
|
||||
end
|
||||
|
||||
|
||||
--Utility functions
|
||||
|
||||
|
||||
--Find delta (difference) between 2 x/y/z coordinates
|
||||
function findOffsetDistance(p1, p2, obj)
|
||||
local deltaPos = {}
|
||||
local bounds = obj.getBounds()
|
||||
deltaPos.x = (p2.x-p1.x)
|
||||
deltaPos.y = (p2.y-p1.y) + (bounds.size.y - bounds.offset.y)
|
||||
deltaPos.z = (p2.z-p1.z)
|
||||
return deltaPos
|
||||
end
|
||||
|
||||
--Used to rotate a set of coordinates by an angle
|
||||
function rotateLocalCoordinates(desiredPos, obj)
|
||||
local objPos, objRot = obj.getPosition(), obj.getRotation()
|
||||
local angle = math.rad(objRot.y)
|
||||
local x = desiredPos.x * math.cos(angle) - desiredPos.z * math.sin(angle)
|
||||
local z = desiredPos.x * math.sin(angle) + desiredPos.z * math.cos(angle)
|
||||
--return {x=objPos.x+x, y=objPos.y+desiredPos.y, z=objPos.z+z}
|
||||
return {x=x, y=desiredPos.y, z=z}
|
||||
end
|
||||
|
||||
--Coroutine delay, in seconds
|
||||
function wait(time)
|
||||
local start = os.time()
|
||||
repeat coroutine.yield(0) until os.time() > start + time
|
||||
end
|
||||
|
||||
--Duplicates a table (needed to prevent it making reference to the same objects)
|
||||
function duplicateTable(oldTable)
|
||||
local newTable = {}
|
||||
for k, v in pairs(oldTable) do
|
||||
newTable[k] = v
|
||||
end
|
||||
return newTable
|
||||
end
|
||||
|
||||
--Moves scripted highlight from all objects
|
||||
function removeAllHighlights()
|
||||
for _, obj in ipairs(getAllObjects()) do
|
||||
obj.highlightOff()
|
||||
end
|
||||
end
|
||||
|
||||
--Round number (num) to the Nth decimal (dec)
|
||||
function round(num, dec)
|
||||
local mult = 10^(dec or 0)
|
||||
return math.floor(num * mult + 0.5) / mult
|
||||
end
|
||||
|
@ -1,21 +1,21 @@
|
||||
name = 'The Path to Carcosa'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
name = 'The Path to Carcosa'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
@ -1,273 +1,273 @@
|
||||
function updateSave()
|
||||
local data_to_save = {["ml"]=memoryList}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function onload(saved_data)
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
--Set up information off of loaded_data
|
||||
memoryList = loaded_data.ml
|
||||
else
|
||||
--Set up information for if there is no saved saved data
|
||||
memoryList = {}
|
||||
end
|
||||
|
||||
if next(memoryList) == nil then
|
||||
createSetupButton()
|
||||
else
|
||||
createMemoryActionButtons()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--Beginning Setup
|
||||
|
||||
|
||||
--Make setup button
|
||||
function createSetupButton()
|
||||
self.createButton({
|
||||
label="Setup", click_function="buttonClick_setup", function_owner=self,
|
||||
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=800,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
end
|
||||
|
||||
--Triggered by setup button,
|
||||
function buttonClick_setup()
|
||||
memoryListBackup = duplicateTable(memoryList)
|
||||
memoryList = {}
|
||||
self.clearButtons()
|
||||
createButtonsOnAllObjects()
|
||||
createSetupActionButtons()
|
||||
end
|
||||
|
||||
--Creates selection buttons on objects
|
||||
function createButtonsOnAllObjects()
|
||||
local howManyButtons = 0
|
||||
for _, obj in ipairs(getAllObjects()) do
|
||||
if obj ~= self then
|
||||
local dummyIndex = howManyButtons
|
||||
--On a normal bag, the button positions aren't the same size as the bag.
|
||||
globalScaleFactor = 1.25 * 1/self.getScale().x
|
||||
--Super sweet math to set button positions
|
||||
local selfPos = self.getPosition()
|
||||
local objPos = obj.getPosition()
|
||||
local deltaPos = findOffsetDistance(selfPos, objPos, obj)
|
||||
local objPos = rotateLocalCoordinates(deltaPos, self)
|
||||
objPos.x = -objPos.x * globalScaleFactor
|
||||
objPos.y = objPos.y * globalScaleFactor
|
||||
objPos.z = objPos.z * globalScaleFactor
|
||||
--Offset rotation of bag
|
||||
local rot = self.getRotation()
|
||||
rot.y = -rot.y + 180
|
||||
--Create function
|
||||
local funcName = "selectButton_" .. howManyButtons
|
||||
local func = function() buttonClick_selection(dummyIndex, obj) end
|
||||
self.setVar(funcName, func)
|
||||
self.createButton({
|
||||
click_function=funcName, function_owner=self,
|
||||
position=objPos, rotation=rot, height=1000, width=1000,
|
||||
color={0.75,0.25,0.25,0.6},
|
||||
})
|
||||
howManyButtons = howManyButtons + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Creates submit and cancel buttons
|
||||
function createSetupActionButtons()
|
||||
self.createButton({
|
||||
label="Cancel", click_function="buttonClick_cancel", function_owner=self,
|
||||
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=1100,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Submit", click_function="buttonClick_submit", function_owner=self,
|
||||
position={0,0.3,-2.8}, rotation={0,180,0}, height=350, width=1100,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Reset", click_function="buttonClick_reset", function_owner=self,
|
||||
position={-2,0.3,0}, rotation={0,270,0}, height=350, width=800,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
--During Setup
|
||||
|
||||
|
||||
--Checks or unchecks buttons
|
||||
function buttonClick_selection(index, obj)
|
||||
local color = {0,1,0,0.6}
|
||||
if memoryList[obj.getGUID()] == nil then
|
||||
self.editButton({index=index, color=color})
|
||||
--Adding pos/rot to memory table
|
||||
local pos, rot = obj.getPosition(), obj.getRotation()
|
||||
--I need to add it like this or it won't save due to indexing issue
|
||||
memoryList[obj.getGUID()] = {
|
||||
pos={x=round(pos.x,4), y=round(pos.y,4), z=round(pos.z,4)},
|
||||
rot={x=round(rot.x,4), y=round(rot.y,4), z=round(rot.z,4)},
|
||||
lock=obj.getLock()
|
||||
}
|
||||
obj.highlightOn({0,1,0})
|
||||
else
|
||||
color = {0.75,0.25,0.25,0.6}
|
||||
self.editButton({index=index, color=color})
|
||||
memoryList[obj.getGUID()] = nil
|
||||
obj.highlightOff()
|
||||
end
|
||||
end
|
||||
|
||||
--Cancels selection process
|
||||
function buttonClick_cancel()
|
||||
memoryList = memoryListBackup
|
||||
self.clearButtons()
|
||||
if next(memoryList) == nil then
|
||||
createSetupButton()
|
||||
else
|
||||
createMemoryActionButtons()
|
||||
end
|
||||
removeAllHighlights()
|
||||
broadcastToAll("Selection Canceled", {1,1,1})
|
||||
end
|
||||
|
||||
--Saves selections
|
||||
function buttonClick_submit()
|
||||
if next(memoryList) == nil then
|
||||
broadcastToAll("You cannot submit without any selections.", {0.75, 0.25, 0.25})
|
||||
else
|
||||
self.clearButtons()
|
||||
createMemoryActionButtons()
|
||||
local count = 0
|
||||
for guid in pairs(memoryList) do
|
||||
count = count + 1
|
||||
local obj = getObjectFromGUID(guid)
|
||||
if obj ~= nil then obj.highlightOff() end
|
||||
end
|
||||
broadcastToAll(count.." Objects Saved", {1,1,1})
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
--Resets bag to starting status
|
||||
function buttonClick_reset()
|
||||
memoryList = {}
|
||||
self.clearButtons()
|
||||
createSetupButton()
|
||||
removeAllHighlights()
|
||||
broadcastToAll("Tool Reset", {1,1,1})
|
||||
updateSave()
|
||||
end
|
||||
|
||||
|
||||
--After Setup
|
||||
|
||||
|
||||
--Creates recall and place buttons
|
||||
function createMemoryActionButtons()
|
||||
self.createButton({
|
||||
label="Place", click_function="buttonClick_place", function_owner=self,
|
||||
position={0.6,0.1,2.1}, rotation={0,0,0}, height=220, width=500,
|
||||
font_size=130, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Recall", click_function="buttonClick_recall", function_owner=self,
|
||||
position={-0.6,0.1,2.1}, rotation={0,0,0}, height=220, width=500,
|
||||
font_size=130, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
-- self.createButton({
|
||||
-- label="Setup", click_function="buttonClick_setup", function_owner=self,
|
||||
-- position={2,0.3,0}, rotation={0,90,0}, height=350, width=800,
|
||||
-- font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
-- })
|
||||
end
|
||||
|
||||
--Sends objects from bag/table to their saved position/rotation
|
||||
function buttonClick_place()
|
||||
local bagObjList = self.getObjects()
|
||||
for guid, entry in pairs(memoryList) do
|
||||
local obj = getObjectFromGUID(guid)
|
||||
--If obj is out on the table, move it to the saved pos/rot
|
||||
if obj ~= nil then
|
||||
obj.setPositionSmooth(entry.pos)
|
||||
obj.setRotationSmooth(entry.rot)
|
||||
obj.setLock(entry.lock)
|
||||
else
|
||||
--If obj is inside of the bag
|
||||
for _, bagObj in ipairs(bagObjList) do
|
||||
if bagObj.guid == guid then
|
||||
local item = self.takeObject({
|
||||
guid=guid, position=entry.pos, rotation=entry.rot,
|
||||
})
|
||||
item.setLock(entry.lock)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
broadcastToAll("Objects Placed", {1,1,1})
|
||||
end
|
||||
|
||||
--Recalls objects to bag from table
|
||||
function buttonClick_recall()
|
||||
for guid, entry in pairs(memoryList) do
|
||||
local obj = getObjectFromGUID(guid)
|
||||
if obj ~= nil then self.putObject(obj) end
|
||||
end
|
||||
broadcastToAll("Objects Recalled", {1,1,1})
|
||||
end
|
||||
|
||||
|
||||
--Utility functions
|
||||
|
||||
|
||||
--Find delta (difference) between 2 x/y/z coordinates
|
||||
function findOffsetDistance(p1, p2, obj)
|
||||
local deltaPos = {}
|
||||
local bounds = obj.getBounds()
|
||||
deltaPos.x = (p2.x-p1.x)
|
||||
deltaPos.y = (p2.y-p1.y) + (bounds.size.y - bounds.offset.y)
|
||||
deltaPos.z = (p2.z-p1.z)
|
||||
return deltaPos
|
||||
end
|
||||
|
||||
--Used to rotate a set of coordinates by an angle
|
||||
function rotateLocalCoordinates(desiredPos, obj)
|
||||
local objPos, objRot = obj.getPosition(), obj.getRotation()
|
||||
local angle = math.rad(objRot.y)
|
||||
local x = desiredPos.x * math.cos(angle) - desiredPos.z * math.sin(angle)
|
||||
local z = desiredPos.x * math.sin(angle) + desiredPos.z * math.cos(angle)
|
||||
--return {x=objPos.x+x, y=objPos.y+desiredPos.y, z=objPos.z+z}
|
||||
return {x=x, y=desiredPos.y, z=z}
|
||||
end
|
||||
|
||||
--Coroutine delay, in seconds
|
||||
function wait(time)
|
||||
local start = os.time()
|
||||
repeat coroutine.yield(0) until os.time() > start + time
|
||||
end
|
||||
|
||||
--Duplicates a table (needed to prevent it making reference to the same objects)
|
||||
function duplicateTable(oldTable)
|
||||
local newTable = {}
|
||||
for k, v in pairs(oldTable) do
|
||||
newTable[k] = v
|
||||
end
|
||||
return newTable
|
||||
end
|
||||
|
||||
--Moves scripted highlight from all objects
|
||||
function removeAllHighlights()
|
||||
for _, obj in ipairs(getAllObjects()) do
|
||||
obj.highlightOff()
|
||||
end
|
||||
end
|
||||
|
||||
--Round number (num) to the Nth decimal (dec)
|
||||
function round(num, dec)
|
||||
local mult = 10^(dec or 0)
|
||||
return math.floor(num * mult + 0.5) / mult
|
||||
end
|
||||
function updateSave()
|
||||
local data_to_save = {["ml"]=memoryList}
|
||||
saved_data = JSON.encode(data_to_save)
|
||||
self.script_state = saved_data
|
||||
end
|
||||
|
||||
function onload(saved_data)
|
||||
if saved_data ~= "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
--Set up information off of loaded_data
|
||||
memoryList = loaded_data.ml
|
||||
else
|
||||
--Set up information for if there is no saved saved data
|
||||
memoryList = {}
|
||||
end
|
||||
|
||||
if next(memoryList) == nil then
|
||||
createSetupButton()
|
||||
else
|
||||
createMemoryActionButtons()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--Beginning Setup
|
||||
|
||||
|
||||
--Make setup button
|
||||
function createSetupButton()
|
||||
self.createButton({
|
||||
label="Setup", click_function="buttonClick_setup", function_owner=self,
|
||||
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=800,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
end
|
||||
|
||||
--Triggered by setup button,
|
||||
function buttonClick_setup()
|
||||
memoryListBackup = duplicateTable(memoryList)
|
||||
memoryList = {}
|
||||
self.clearButtons()
|
||||
createButtonsOnAllObjects()
|
||||
createSetupActionButtons()
|
||||
end
|
||||
|
||||
--Creates selection buttons on objects
|
||||
function createButtonsOnAllObjects()
|
||||
local howManyButtons = 0
|
||||
for _, obj in ipairs(getAllObjects()) do
|
||||
if obj ~= self then
|
||||
local dummyIndex = howManyButtons
|
||||
--On a normal bag, the button positions aren't the same size as the bag.
|
||||
globalScaleFactor = 1.25 * 1/self.getScale().x
|
||||
--Super sweet math to set button positions
|
||||
local selfPos = self.getPosition()
|
||||
local objPos = obj.getPosition()
|
||||
local deltaPos = findOffsetDistance(selfPos, objPos, obj)
|
||||
local objPos = rotateLocalCoordinates(deltaPos, self)
|
||||
objPos.x = -objPos.x * globalScaleFactor
|
||||
objPos.y = objPos.y * globalScaleFactor
|
||||
objPos.z = objPos.z * globalScaleFactor
|
||||
--Offset rotation of bag
|
||||
local rot = self.getRotation()
|
||||
rot.y = -rot.y + 180
|
||||
--Create function
|
||||
local funcName = "selectButton_" .. howManyButtons
|
||||
local func = function() buttonClick_selection(dummyIndex, obj) end
|
||||
self.setVar(funcName, func)
|
||||
self.createButton({
|
||||
click_function=funcName, function_owner=self,
|
||||
position=objPos, rotation=rot, height=1000, width=1000,
|
||||
color={0.75,0.25,0.25,0.6},
|
||||
})
|
||||
howManyButtons = howManyButtons + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Creates submit and cancel buttons
|
||||
function createSetupActionButtons()
|
||||
self.createButton({
|
||||
label="Cancel", click_function="buttonClick_cancel", function_owner=self,
|
||||
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=1100,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Submit", click_function="buttonClick_submit", function_owner=self,
|
||||
position={0,0.3,-2.8}, rotation={0,180,0}, height=350, width=1100,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Reset", click_function="buttonClick_reset", function_owner=self,
|
||||
position={-2,0.3,0}, rotation={0,270,0}, height=350, width=800,
|
||||
font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
--During Setup
|
||||
|
||||
|
||||
--Checks or unchecks buttons
|
||||
function buttonClick_selection(index, obj)
|
||||
local color = {0,1,0,0.6}
|
||||
if memoryList[obj.getGUID()] == nil then
|
||||
self.editButton({index=index, color=color})
|
||||
--Adding pos/rot to memory table
|
||||
local pos, rot = obj.getPosition(), obj.getRotation()
|
||||
--I need to add it like this or it won't save due to indexing issue
|
||||
memoryList[obj.getGUID()] = {
|
||||
pos={x=round(pos.x,4), y=round(pos.y,4), z=round(pos.z,4)},
|
||||
rot={x=round(rot.x,4), y=round(rot.y,4), z=round(rot.z,4)},
|
||||
lock=obj.getLock()
|
||||
}
|
||||
obj.highlightOn({0,1,0})
|
||||
else
|
||||
color = {0.75,0.25,0.25,0.6}
|
||||
self.editButton({index=index, color=color})
|
||||
memoryList[obj.getGUID()] = nil
|
||||
obj.highlightOff()
|
||||
end
|
||||
end
|
||||
|
||||
--Cancels selection process
|
||||
function buttonClick_cancel()
|
||||
memoryList = memoryListBackup
|
||||
self.clearButtons()
|
||||
if next(memoryList) == nil then
|
||||
createSetupButton()
|
||||
else
|
||||
createMemoryActionButtons()
|
||||
end
|
||||
removeAllHighlights()
|
||||
broadcastToAll("Selection Canceled", {1,1,1})
|
||||
end
|
||||
|
||||
--Saves selections
|
||||
function buttonClick_submit()
|
||||
if next(memoryList) == nil then
|
||||
broadcastToAll("You cannot submit without any selections.", {0.75, 0.25, 0.25})
|
||||
else
|
||||
self.clearButtons()
|
||||
createMemoryActionButtons()
|
||||
local count = 0
|
||||
for guid in pairs(memoryList) do
|
||||
count = count + 1
|
||||
local obj = getObjectFromGUID(guid)
|
||||
if obj ~= nil then obj.highlightOff() end
|
||||
end
|
||||
broadcastToAll(count.." Objects Saved", {1,1,1})
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
--Resets bag to starting status
|
||||
function buttonClick_reset()
|
||||
memoryList = {}
|
||||
self.clearButtons()
|
||||
createSetupButton()
|
||||
removeAllHighlights()
|
||||
broadcastToAll("Tool Reset", {1,1,1})
|
||||
updateSave()
|
||||
end
|
||||
|
||||
|
||||
--After Setup
|
||||
|
||||
|
||||
--Creates recall and place buttons
|
||||
function createMemoryActionButtons()
|
||||
self.createButton({
|
||||
label="Place", click_function="buttonClick_place", function_owner=self,
|
||||
position={0.6,0.1,2.1}, rotation={0,0,0}, height=220, width=500,
|
||||
font_size=130, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
self.createButton({
|
||||
label="Recall", click_function="buttonClick_recall", function_owner=self,
|
||||
position={-0.6,0.1,2.1}, rotation={0,0,0}, height=220, width=500,
|
||||
font_size=130, color={0,0,0}, font_color={1,1,1}
|
||||
})
|
||||
-- self.createButton({
|
||||
-- label="Setup", click_function="buttonClick_setup", function_owner=self,
|
||||
-- position={2,0.3,0}, rotation={0,90,0}, height=350, width=800,
|
||||
-- font_size=250, color={0,0,0}, font_color={1,1,1}
|
||||
-- })
|
||||
end
|
||||
|
||||
--Sends objects from bag/table to their saved position/rotation
|
||||
function buttonClick_place()
|
||||
local bagObjList = self.getObjects()
|
||||
for guid, entry in pairs(memoryList) do
|
||||
local obj = getObjectFromGUID(guid)
|
||||
--If obj is out on the table, move it to the saved pos/rot
|
||||
if obj ~= nil then
|
||||
obj.setPositionSmooth(entry.pos)
|
||||
obj.setRotationSmooth(entry.rot)
|
||||
obj.setLock(entry.lock)
|
||||
else
|
||||
--If obj is inside of the bag
|
||||
for _, bagObj in ipairs(bagObjList) do
|
||||
if bagObj.guid == guid then
|
||||
local item = self.takeObject({
|
||||
guid=guid, position=entry.pos, rotation=entry.rot,
|
||||
})
|
||||
item.setLock(entry.lock)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
broadcastToAll("Objects Placed", {1,1,1})
|
||||
end
|
||||
|
||||
--Recalls objects to bag from table
|
||||
function buttonClick_recall()
|
||||
for guid, entry in pairs(memoryList) do
|
||||
local obj = getObjectFromGUID(guid)
|
||||
if obj ~= nil then self.putObject(obj) end
|
||||
end
|
||||
broadcastToAll("Objects Recalled", {1,1,1})
|
||||
end
|
||||
|
||||
|
||||
--Utility functions
|
||||
|
||||
|
||||
--Find delta (difference) between 2 x/y/z coordinates
|
||||
function findOffsetDistance(p1, p2, obj)
|
||||
local deltaPos = {}
|
||||
local bounds = obj.getBounds()
|
||||
deltaPos.x = (p2.x-p1.x)
|
||||
deltaPos.y = (p2.y-p1.y) + (bounds.size.y - bounds.offset.y)
|
||||
deltaPos.z = (p2.z-p1.z)
|
||||
return deltaPos
|
||||
end
|
||||
|
||||
--Used to rotate a set of coordinates by an angle
|
||||
function rotateLocalCoordinates(desiredPos, obj)
|
||||
local objPos, objRot = obj.getPosition(), obj.getRotation()
|
||||
local angle = math.rad(objRot.y)
|
||||
local x = desiredPos.x * math.cos(angle) - desiredPos.z * math.sin(angle)
|
||||
local z = desiredPos.x * math.sin(angle) + desiredPos.z * math.cos(angle)
|
||||
--return {x=objPos.x+x, y=objPos.y+desiredPos.y, z=objPos.z+z}
|
||||
return {x=x, y=desiredPos.y, z=z}
|
||||
end
|
||||
|
||||
--Coroutine delay, in seconds
|
||||
function wait(time)
|
||||
local start = os.time()
|
||||
repeat coroutine.yield(0) until os.time() > start + time
|
||||
end
|
||||
|
||||
--Duplicates a table (needed to prevent it making reference to the same objects)
|
||||
function duplicateTable(oldTable)
|
||||
local newTable = {}
|
||||
for k, v in pairs(oldTable) do
|
||||
newTable[k] = v
|
||||
end
|
||||
return newTable
|
||||
end
|
||||
|
||||
--Moves scripted highlight from all objects
|
||||
function removeAllHighlights()
|
||||
for _, obj in ipairs(getAllObjects()) do
|
||||
obj.highlightOff()
|
||||
end
|
||||
end
|
||||
|
||||
--Round number (num) to the Nth decimal (dec)
|
||||
function round(num, dec)
|
||||
local mult = 10^(dec or 0)
|
||||
return math.floor(num * mult + 0.5) / mult
|
||||
end
|
||||
|
@ -1,25 +1,25 @@
|
||||
name = 'The Last King'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
name = 'The Last King'
|
||||
|
||||
function onLoad()
|
||||
Global.call('createSetupButtons', {object=self, key=name})
|
||||
end
|
||||
|
||||
function easyClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='easy'})
|
||||
end
|
||||
|
||||
function normalClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='normal'})
|
||||
end
|
||||
|
||||
function hardClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='hard'})
|
||||
end
|
||||
|
||||
function expertClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='expert'})
|
||||
end
|
||||
|
||||
function standaloneClick()
|
||||
Global.call('fillContainer', {object=self, key=name, mode='standalone'})
|
||||
end
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user