local searchLib = require("util/SearchLib") exposedValue = 0 function onLoad() self.createButton({ label = "", click_function = "countItems", function_owner = self, position = { 0, 0.1, 0 }, height = 0, width = 0, font_color = { 0, 0, 0 }, font_size = 2000 }) loopID = Wait.time(countItems, 1.5, -1) end -- Activated once per second, counts items in bowls function countItems() local totalValue = 0 for _, item in ipairs(getClues()) do totalValue = totalValue + math.abs(item.getQuantity()) end exposedValue = totalValue self.editButton({ index = 0, label = totalValue }) end function removeAllClues(trash) for _, obj in ipairs(getClues()) do trash.putObject(obj) end end function getClues() return searchLib.inArea(self.getPosition(), self.getRotation(), { 2, 1, 2 }, "isClue") end