Advertisement
Muzze77

Test

Oct 18th, 2014
820
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.04 KB | None | 0 0
  1. shell.run("clear")
  2.  
  3.  
  4.  
  5. rednet.open("back")
  6. black = colors.black
  7. white = colors.white
  8. green = colors.green
  9. red = colors.red
  10. blue = colors.blue
  11. gray = colors.gray
  12. lgray = colors.lightGray
  13.  
  14.  
  15. function cleL(line)
  16. term.clearLine(line)
  17. end
  18.  
  19. function reset()
  20.  
  21. term.setBackgroundColor(black)
  22. term.setTextColor(white)
  23.  
  24. end
  25.  
  26. function cbut(cx,cy,ctext,bcol,tcol)
  27. ncx = cx
  28. term.setCursorPos(cx, cy)
  29. term.setBackgroundColor(bcol)
  30. term.setTextColor(tcol)
  31. print(ctext)
  32. reset()
  33. end
  34.  
  35.  
  36.  
  37. --## START SCREEN ##--
  38. cbut(4,4,"         ", red, black)
  39. cbut(4,5,"  START  ", red, black)
  40. cbut(4,6,"         ", red, black)
  41.  
  42. cbut(4,9, "         ", red, black)
  43. cbut(4,10,"  XXXXX  ", red, black)
  44. cbut(4,11,"         ", red, black)
  45.  
  46. cbut(4,14,"         ", red, black)
  47. cbut(4,15,"  XXXXX  ", red, black)
  48. cbut(4,16,"         ", red, black)
  49.  
  50.  
  51. sel = 1
  52. sel2 = 1
  53. --################--
  54. while true do
  55. evt, button, x, y = os.pullEvent("monitor_touch")
  56.     if button == 1 then
  57.    
  58.    
  59. --ST--
  60.         for mx = 4, 13, 1 do
  61.         for my = 4, 6, 1 do
  62.         if x == mx then
  63.             if y == my then
  64.    
  65.             if sel == 0 then
  66. cbut(4,4,"         ", red, black)
  67. cbut(4,5,"  START  ", red, black)
  68. cbut(4,6,"         ", red, black)
  69.  
  70.    
  71.             sel = 1
  72.             rednet.broadcast("ST OFF")
  73.            
  74.             elseif sel == 1 then
  75. cbut(4,4,"         ", green, black)
  76. cbut(4,5,"  START  ", green, black)
  77. cbut(4,6,"         ", green, black)
  78.  
  79.    
  80.             sel = 0
  81.             rednet.broadcast("ST ON")
  82.            
  83.         end
  84.         end
  85.         end
  86.         end
  87.         end
  88.    
  89. --ST--
  90.         for mx = 4, 9, 1 do
  91.         for my = 9, 11, 1 do
  92.         if x == mx then
  93.             if y == my then
  94.    
  95.             if sel2 == 0 then
  96.        
  97.             cbut(4,9, "         " , red, black)
  98.             cbut(4,10,"  XXXXX  ", red, black)
  99.             cbut(4,11,"         ", red, black)
  100.  
  101.             sel2 = 1
  102.             rednet.broadcast("SC OFF")
  103.            
  104.             elseif sel2 == 1 then
  105.  
  106.             cbut(4,9, "         ", green, black)
  107.             cbut(4,10,"  XXXXX  ", green, black)
  108.             cbut(4,11,"         ", green, black)           
  109.            
  110.            
  111.  
  112.    
  113.             rednet.broadcast("SC ON")
  114.             sel2 = 0
  115.         end
  116.         end
  117.         end
  118.         end
  119.         end
  120.    
  121.    
  122.        
  123.    
  124.    
  125.    
  126.    
  127.    
  128.    
  129.     end
  130.    
  131.    
  132.    
  133.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement