Advertisement
SpaceRanger4321

FIX THIS

Jan 8th, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.39 KB | None | 0 0
  1. local functions = { -- PUT RCM OPTIONS HERE (ALL LOWERCASE AND WITH NO SPACES)
  2.     debug = function() return error("Debug in function") end,
  3.     reboot = function() setBack("red") setText("white") clr() cp(1,1) write("Re-Booting") sleep(3) os.reboot() end
  4.     shutdown = function() setBack("orange") setText("white") clr() cp(1,1) write("Shutting Down") sleep(3) os.shutdown() end
  5. }
  6.  
  7. running = true
  8. update = true
  9.  
  10. function runtime()
  11.     setRcmMenu({"Debug", "Reboot", "Shutdown"})
  12.     setBack("yellow") clr()
  13.     while running do
  14.         if update then
  15.             update = false
  16.             paintutils.drawImage(desktop_img,1,1)
  17.             paintutils.drawLine(1,h,w,h,colors.white)
  18.             paintutils.drawPixel(1,h,colors.blue)
  19.             local current = term.current()
  20.             for i=1, #window do
  21.                 if window[i].display then
  22.                     local current2 = term.current()
  23.                     term.redirect(current)
  24.                     paintutils.drawPixel(i+2,h,colors.lightGray) cp(i+2,h) write("^")
  25.                     local wx,wy = term.getSize()
  26.                     paintutils.drawLine(1,0,wx,0,colors.white)
  27.                     term.redirect(current2)
  28.                 else
  29.                     local current2 = term.current()
  30.                     term.redirect(current)
  31.                     paintutils.drawPixel(i+2,h,colors.gray) cp(i+2,h) write("-")
  32.                     term.redirect(current2)
  33.                 end
  34.             end
  35.             term.redirect(current)
  36.             if rcm_data.active == true then
  37.                 rcm(rcm_data.x,rcm_data.y,rcm_data.menu,w,h-1)
  38.             end
  39.         end
  40.         a,i,x,y = pullEvents("mouse_click", "mouse_drag")
  41.         if a == "mouse_click" then
  42.             if i == 1 then
  43.                 if rcm_data.active then
  44.                     if rcm_click(x,y) then
  45.                         if notnil(functions[string.lower(rcm_data.menu[y-rcm_data.y+1] or "")]) then functions[string.lower(rcm_data.menu[y-rcm_data.y+1])]() end
  46.                     end
  47.                     rcm_data.active = false update = true setBack("yellow") clr()
  48.                 else
  49.                    
  50.                 end
  51.             elseif i == 2 then
  52.                 setBack("yellow") clr() rcm_data.active = true rcm_data.x,rcm_data.y = x,y update = true
  53.             end
  54.         elseif a == "mouse_drag" then
  55.            
  56.         end
  57.     end
  58. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement