Advertisement
Guest User

ComputerCraft, need help

a guest
Jul 1st, 2015
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. --Varibles
  2.  
  3. version = "1.2.6"
  4.  
  5. running = true
  6.  
  7.  
  8.  
  9. --Colors
  10. colTaskBar = colors.red
  11. colBackground = color.black
  12.  
  13.  
  14. --Images
  15.  
  16. _dt = paintutils.loadImage("/os/.backgrounds/dt")
  17.  
  18.  
  19.  
  20. --Booleans
  21. _ms = 0
  22. _rcm = 0
  23.  
  24.  
  25.  
  26.  
  27. --Functions
  28.  
  29. clear = function()
  30.  
  31. term.setBackgroundColor(colors.black)
  32.  
  33. term.clear()
  34.  
  35. term.setCursorPos(1, 1)
  36.  
  37. end
  38.  
  39.  
  40. drawRightClickMenu = function()
  41. term.setBackgroundColor( colors.white )
  42. term.setTextColor( colors.blue )
  43. term.setCursorPos(x, y)
  44. term.write(" LUA ")
  45. term.setCursorPos(x, y+1)
  46. term.write(" IDE ")
  47. local event, button, xPos, yPos = os.pullEvent("mouse_click")
  48. while true do
  49.  
  50. if button == 1 and yPos == y and xPos <= (x+6) and xPos >= x then
  51. running = false
  52. clear()
  53. term.setTextColor( colors.red )
  54. print("You are now in Command Pronpt")
  55. print("OS will shutdown after exiting LUA Prompt")
  56. print("Any function of the OS is in the LUA functions now.")
  57. shell.run("lua")
  58. break
  59. elseif button == 1 and yPos == (y+1) and xPos <= (x+6) and xPos >= x then
  60. shell.run("edit", "/Gui")
  61. init()
  62. break
  63. else
  64. redraw()
  65. break
  66.  
  67. end
  68.  
  69. end
  70. _rcm = 0
  71.  
  72. drawMenu1 = function()
  73. term.setCursorPos(1, 2)
  74. term.setBackground Color( colors.white )
  75. term.setTextColor( colors.red)
  76. print("Power")
  77.  
  78. end
  79.  
  80. redraw = function()
  81. drawDeskTop()
  82. drawTaskBar()
  83. end
  84.  
  85. drawTaskBar = function()
  86.  
  87. term.setCursorPos(1, 1)
  88.  
  89. term.setBackgroundColor(colTaskBar)
  90.  
  91. term.clearLine()
  92.  
  93. term.setCursorPos(1, 1)
  94.  
  95. term.setBackgroundColor(colors.red)
  96.  
  97. term.setTextColor( colors.white )
  98.  
  99. term.write("Menu")
  100.  
  101.  
  102.  
  103.  
  104. end
  105.  
  106.  
  107.  
  108.  
  109. stop = function()
  110. clear()
  111. running = false
  112. term.setTextColor( colors.blue )
  113. print("Thanks for using Ironist Teck OS")
  114. exit()
  115. end
  116.  
  117.  
  118.  
  119.  
  120. drawDeskTop = function()
  121.  
  122. term.setBackgroundColor(colBackground)
  123.  
  124. term.clear()
  125.  
  126. term.setCursorPos(1, 1)
  127.  
  128. paintutils.drawImage(_dt, 1, 1)
  129.  
  130.  
  131. end
  132.  
  133.  
  134. LoadConfig = function
  135.  
  136.  
  137. runTime = function()
  138.  
  139. while running do
  140. event, button, x, y = os.pullEvent("mouse_click")
  141.  
  142. if _ms == 0 and button == 1 and x < 5 and y == 1 then
  143. drawMenu1()
  144. _ms = 1 (<-- the computer says that this is the problem but I don't know how to fix it)
  145. elseif _ms == 1 and button == and y == 2 and x > 5 then
  146. stop()
  147. elseif _ms == 1 and button == 1 and x < 5 and y == 1 then
  148. init()
  149. elseif _ms == 0 and _rcm == 0 and button == 2 then
  150. _rcm = 1
  151. drawRightClickMenu(x ,y)
  152.  
  153. end
  154.  
  155. end
  156.  
  157. end
  158.  
  159.  
  160.  
  161.  
  162. init = function()
  163.  
  164. _ms = 0
  165. drawDeskTop()
  166.  
  167. drawTaskBar()
  168.  
  169. runTime()
  170.  
  171. end
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180. --Main Stuff
  181.  
  182.  
  183. init()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement