Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------------------------
- -- Functions --
- -------------------------
- function centerText(text)
- x,y = term.getSize()
- x2,y2 = term.getCursorPos()
- term.setCursorPos(math.ceil((x/2) - (text:len() / 2)), y2)
- write(text)
- end
- function w()
- term.clear()
- term.setCursorPos(1,6)
- centerText("Light")
- print("\n")
- centerText(" Hangar")
- print("\n")
- centerText(" Generator")
- print("\n")
- centerText("Alarm")
- print("\n")
- centerText(" Sign Out")
- end
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- end
- function click()
- event, p1, x, y = os.pullEvent(mouse_click)
- end
- -------------------------
- -- Desktop --
- -------------------------
- while true do
- clear()
- w()
- click()
- if y == 6 then
- shell.run("light")
- y = 0
- x = 0
- end
- if y == 8 then
- shell.run("hangar")
- y = 0
- x = 0
- end
- if y == 10 then
- shell.run("generator")
- y = 0
- x = 0
- end
- if y == 12 then
- shell.run("alarm")
- y = 0
- x = 0
- end
- if y == 14 then
- shell.run("start")
- y = 0
- x = 0
- end
- end
- -------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement