_Finn_

main

Jul 22nd, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.09 KB | None | 0 0
  1. os.loadAPI("System/API/context")
  2.  
  3. local CommandBlock = peripheral.wrap("bottom")
  4.  
  5. local function cb(command)
  6.   CommandBlock.setCommand (command)
  7.   CommandBlock.runCommand ()
  8. end
  9.  
  10. local function time()
  11.   cb("/time set")
  12. end
  13.  
  14. term.clear()
  15.  
  16. while true do
  17.   local event,button,x,y = os.pullEvent()
  18.   if event == "mouse_click" then
  19.     if button == 2 and y > 1 then
  20.       local action = context.menu(x,y,{"Morning",false},{"Day",false},{"Evening",false},{"Night",false},"-",{"Clear screen"},"-",{"Exit"})
  21.       if action == "Morning" then
  22.         cb("/time set 0")
  23.       elseif action == "Day" then
  24.         cb("/time set 6000")
  25.       elseif action == "Evening" then
  26.         cb("/time set 12250")
  27.       elseif action == "Night" then
  28.         cb("/time set 15000")
  29.       elseif action == "Clear screen" then
  30.         term.setBackgroundColor(colors.black)
  31.         term.clear()
  32.       elseif action == "Exit" then
  33.         term.setTextColor(colors.white)
  34.         term.setBackgroundColor(colors.black)
  35.         term.setCursorPos(1,1)
  36.         term.clear()
  37.         break
  38.       end
  39.     end
  40.   end
  41. end
Advertisement
Add Comment
Please, Sign In to add comment