Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local redside = "back" -- Redstone Output Seite
- local monside = "top" -- Seite des Monitors
- local option1 = 60 -- Zeit fuer Option1 in s
- local option2 = 120 -- Zeit fuer Option2 in s
- local option3 = 180 -- Zeit fuer Option3 in s
- local option4 = 300 -- Zeit fuer Option4 in s
- local option5 = 600 -- zeit fuer Option5 in s
- local input = 0 -- Diesen Wert nicht veraendern
- local time = 0 -- Diesen Wert nicth veraendern
- m = peripheral.wrap(monside)
- m.clear()
- redstone.setOutput(redside,false)
- function Layout()
- m.setBackgroundColor(colors.cyan)
- m.clear()
- m.setCursorPos(1,1)
- m.write(option1)
- m.write(" ")
- m.setBackgroundColor(colors.green)
- m.setCursorPos(1,2)
- m.write(option2)
- m.write(" ")
- m.setBackgroundColor(colors.yellow)
- m.setCursorPos(1,3)
- m.write(option3)
- m.write(" ")
- m.setBackgroundColor(colors.orange)
- m.setCursorPos(1,4)
- m.write(option4)
- m.write(" ")
- m.setBackgroundColor(colors.red)
- m.setCursorPos(1,5)
- m.write(option5)
- m.write(" ")
- end
- Layout()
- function SetTime()
- if input == 1 then
- time = option1
- elseif input == 2 then
- time = option2
- elseif input == 3 then
- time = option3
- elseif input == 4 then
- time = option4
- elseif input == 5 then
- time = option5
- end
- end
- function Timer()
- while time >= 0.2 do
- m.clear()
- m.setCursorPos(1,3)
- m.write(time)
- time = time - 0.1
- sleep(0.1)
- local event,side,x,y = os.pullEvent()
- if event == "monitor_touch" then
- if x >= 1 and y == 5 then
- time = 0
- break
- end
- end
- end
- end
- function Toggle()
- Layout()
- redstone.setOutput(redside,true)
- SetTime()
- Timer()
- redstone.setOutput(redside,false)
- Layout()
- end
- while true do
- event,side,x,y = os.pullEvent()
- if event == "monitor_touch" then
- if x >= 1 and y == 1 then
- input = 1
- Toggle()
- elseif x >= 1 and y == 2 then
- input = 2
- Toggle()
- elseif x >= 1 and y == 3 then
- input = 3
- Toggle()
- elseif x >= 1 and y == 4 then
- input = 4
- Toggle()
- elseif x >= 1 and y == 5 then
- input = 5
- Toggle()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment