Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local smelt = false
- local runProg = true
- local lastOutput = false
- function cls()
- term.clear()
- term.setCursorPos(1,1)
- end
- function writeX (monitor, x, y)
- monitor.setCursorPos(x,y)
- monitor.write("x")
- end
- while runProg do
- if peripheral.isPresent("left") then
- local leftMonitor = peripheral.wrap("left")
- leftMonitor.clear()
- leftMonitor.setCursorPos(1,1)
- leftMonitor.write("Smelt:")
- leftMonitor.setCursorPos(1,2)
- leftMonitor.write((smelt and "YES" or "NO"))
- if (not smelt) then
- writeX(leftMonitor,3,3)
- writeX(leftMonitor,5,3)
- writeX(leftMonitor,4,4)
- writeX(leftMonitor,3,5)
- writeX(leftMonitor,5,5)
- else
- writeX(leftMonitor,2,4)
- writeX(leftMonitor,3,5)
- writeX(leftMonitor,4,5)
- writeX(leftMonitor,5,4)
- writeX(leftMonitor,6,3)
- end
- end
- cls()
- print("Smelting: " .. (smelt and "ENABLED" or "DISABLED"))
- print("")
- print("Type \"help\" for more options...")
- local input = read()
- cls()
- if input == "help" then
- print ("\"enable\" - enables smelting.")
- print ("\"disable\" - disables smelting.")
- print ("\"help\" - prints this page.")
- print ("\"exit\" - exits to terminal.")
- print ("")
- print ("Press any key to continue...")
- os.pullEvent ('key')
- elseif input == "exit" then
- runProg = false
- print ("Goodbye!")
- os.sleep(3)
- cls()
- elseif input == "enable" then
- if smelt ~= true then
- print("Enabling...")
- smelt = true
- redstone.setOutput("back", not lastOutput)
- os.sleep (0.1)
- redstone.setOutput("back", lastOutput)
- os.sleep (0.1)
- lastOutput = lastOutput --Just in here for documentation purposes
- else
- print ("Smelting is already enabled!")
- os.sleep(3)
- end
- elseif input == "disable" then
- if smelt ~= false then
- print("Disabling...")
- smelt = false
- redstone.setOutput("back", not lastOutput)
- os.sleep (0.1)
- lastOutput = not lastOutput
- else
- print("Smelting is already disabled!")
- os.sleep(3)
- end
- else
- print("Invalid command \"" .. input .. "\"")
- os.sleep(3)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment