Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ Config ]]--
- manual_update = true
- --[[
- This will allow you to input a command to update the counter.
- $$update is the command to update the counter.
- The counter will update every 3 minutes if this is false.
- ]]--
- --[[
- Do not edit anything below UNLESS you know what you are doing.
- You have been warned!
- ]]--
- --[[ Tables ]]--
- local tArgs = { ... }
- --[[ Usage Checker ]]--
- if #tArgs < 3 then
- printError(shell.getRunningProgram().." <Item ID> <Meta-data> <Item Name>")
- printError("Ensure the item name is SINGULAR!")
- printError("The item name CAN be more than 1 word.")
- printError("Ex: <Program name> 264 0 My diamonds")
- error("Usage error!")
- elseif #tArgs > 3 then
- print("It appears you may have a name with spaces.")
- print("Please type the item's name")
- printError("Ensure the item is written singular!")
- print("")
- write("> ")
- name = read()
- name = name.."(s)"
- term.clear()
- term.setCursorPos(1, 1)
- print("Name saved!")
- sleep(1)
- term.clear()
- term.setCursorPos(1, 1)
- elseif tArgs[3] ~= nil then
- name = tArgs[3].."(s)"
- end
- --[[ Variables ]]--
- local network = nil
- local bridge = nil
- --[[ Functions ]]--
- function cs()
- --[[ Clears screen ]]--
- term.clear()
- term.setCursorPos(1, 1)
- end
- function bar(title)
- cs()
- textutils.slowPrint(title)
- write("[")
- termX, termY = term.getSize()
- currX, currY = term.getCursorPos()
- term.setCursorPos(termX, currY)
- write("]")
- term.setCursorPos(2, currY)
- for i=1, termX-2 do
- write("+")
- sleep(math.random(0.1, 0.3))
- end
- end
- function findVars()
- sides = peripheral.getNames()
- bar("Finding variables...")
- for i=1, #sides do
- pside = peripheral.getType(sides[i])
- if string.find(pside, "controller") then
- network = peripheral.wrap(sides[i])
- elseif string.find(pside, "glassesbridge") then
- bridge = peripheral.wrap(sides[i])
- end
- cs()
- print("Variables located!")
- end
- end
- --[[ Config Reminder ]]--
- cs()
- print("RandomShovel has a message for you!")
- print("This program has come with a config!")
- print("Use: edit "..shell.getRunningProgram().." to see it!")
- sleep(10)
- --[[ Find Variables ]]--
- findVars()
- cs()
- --[[ Boxes and Icons ]]--
- bridge.clear()
- function backMenu()
- bridge.clear()
- statusBackground = bridge.addBox(3, 120, 0, 15, 0x000000, 0.5)
- statusBackground.setZ(1)
- statusText = bridge.addText(6, 125, " ", 0xFFFFFF)
- statusText.setZ(2)
- background = bridge.addBox(3, 100, 0, 15, 0x000000, 0.5)
- background.setWidth(bridge.getStringWidth(network.countOfItemType(tonumber(tArgs[1]), tonumber(tArgs[2]))..' '..tostring(name))+6)
- backgroundText = bridge.addText(6, 105, network.countOfItemType(tonumber(tArgs[1]), tonumber(tArgs[2]))..' '..tostring(name), 0xFFFFFF)
- backgroundText.setZ(2)
- background.setZ(1)
- end
- function updateCount()
- if manual_update == false then
- local currstatus = "Updating in 3 minutes..."
- statusBackground.setWidth(bridge.getStringWidth(tostring(currstatus))+6)
- statusText.setText(currstatus)
- sleep(60)
- local currstatus = "Updating in 2 minutes..."
- statusBackground.setWidth(bridge.getStringWidth(tostring(currstatus))+6)
- statusText.setText(currstatus)
- sleep(60)
- local currstatus = "Updating in 1 minute..."
- statusBackground.setWidth(bridge.getStringWidth(tostring(currstatus))+6)
- statusText.setText(currstatus)
- sleep(60)
- local currstatus = "Updating..."
- statusBackground.setWidth(bridge.getStringWidth(tostring(currstatus))+6)
- statusText.setText(currstatus)
- statusText.setText(currstatus)
- sleep(1)
- currstatus = "Updated!"
- statusBackground.setWidth(bridge.getStringWidth(tostring(currstatus))+6)
- statusText.setText(currstatus)
- else
- event, command = os.pullEvent(chat_command)
- if command == "Update" or command == "update" then
- local currstatus = "Updating..."
- statusBackground.setWidth(bridge.getStringWidth(tostring(currstatus))+6)
- statusText.setText(currstatus)
- sleep(1)
- local currstatus = "Updated!"
- statusText.setText(currstatus)
- sleep(1)
- end
- end
- end
- --[[ Main ]]--
- print("Running "..shell.getRunningProgram().."...")
- backMenu()
- while true do
- updateCount()
- backMenu()
- sleep(0.1)
- end
Advertisement
Add Comment
Please, Sign In to add comment