Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (not fs.exists("config")) then
- shell.run("pastebin get d41aYUsX config")
- end
- if (fs.exists("button")) then
- fs.delete("button")
- end
- local isDebug = false
- shell.run("pastebin get qc4QeDgu button")
- os.loadAPI("button")
- os.loadAPI("config")
- local mon = peripheral.wrap(config.monitorId)
- function reboot()
- os.reboot()
- end
- function debug()
- if (isDebug) then
- isDebug = false
- else
- isDebug = true
- end
- redstone.setOutput(config.debugSide, isDebug)
- end
- function givePrice(count)
- for i = count-1,1,-1 do
- redstone.setOutput(config.priceSide, true)
- sleep(0.1)
- redstone.setOutput(config.priceSide, false)
- sleep(0.1)
- end
- if (count > 0) then
- redstone.setOutput(config.priceSide, true)
- sleep(0.8)
- redstone.setOutput(config.priceSide, false)
- end
- sleep(0.1)
- end
- function kill()
- mon.setTextScale(2)
- mon.clear()
- mon.setCursorPos(8,10)
- mon.write("The program has exited!")
- error("Exited on user input")
- end
- button.setTable("give price", function () givePrice(8) end, 44, 53, 26, 26)
- button.setTable("exit", kill, 55, 58, 26, 26)
- button.setTable("debug", debug, 60, 64, 26, 26)
- button.setTable("reboot", reboot, 66, 71, 26, 26)
- button.screen()
- function getClick()
- event,side,x,y = os.pullEvent("monitor_touch")
- button.checkxy(x,y)
- end
- while (true) do
- getClick()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement