Advertisement
Moster_fr

GUI

Jul 15th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.86 KB | None | 0 0
  1. local GrL, GaL, SL, GrR, GaR, SR = 0, 0, 0, 0, 0, 0
  2.  
  3. local function Numbers(X,H)
  4.  
  5.  if (H == 1) then
  6.   term.setCursorPos(X,17)
  7.   term.write("1")
  8.  end
  9.  
  10.  if (H == 2) then
  11.   term.setCursorPos(X,16)
  12.   term.write("2")
  13.  end
  14.  
  15.  if (H == 3) then
  16.   term.setCursorPos(X,15)
  17.   term.write("3")
  18.  end
  19.  
  20.  if (H == 4) then
  21.   term.setCursorPos(X,14)
  22.   term.write("4")
  23.  end
  24.  
  25.  if (H == 5) then
  26.   term.setCursorPos(X,13)
  27.   term.write("5")
  28.  end
  29.  
  30.  if (H == 6) then
  31.   term.setCursorPos(X,12)
  32.   term.write("6")
  33.  end
  34.  
  35.  if (H == 7) then
  36.   term.setCursorPos(X,11)
  37.   term.write("7")
  38.  end
  39.  
  40.  if (H == 8) then
  41.   term.setCursorPos(X,10)
  42.   term.write("8")
  43.  end
  44.  
  45.  if (H == 9) then
  46.   term.setCursorPos(X,9)
  47.   term.write("9")
  48.  end
  49.  
  50.  if (H == 10) then
  51.   term.setCursorPos((X-1),8)
  52.   term.write("MAX")
  53.  end
  54. end
  55.  
  56. local function update(Direction)
  57.  
  58.  if Direction == "Right" then
  59.   paintutils.drawFilledBox(2,8,4,17,colors.black)
  60.   paintutils.drawFilledBox(2,(18-GrR),4,17,colors.lime)
  61.   Numbers(3,GrR)
  62.   sleep(1)
  63.   paintutils.drawFilledBox(6,8,8,17,colors.black)
  64.   paintutils.drawFilledBox(6,(18-GaR),8,17,colors.lime)
  65.   Numbers(7,GaR)
  66.   sleep(1)
  67.   paintutils.drawFilledBox(10,8,12,17,colors.black)
  68.   paintutils.drawFilledBox(10,(18-SR),12,17,colors.lime)
  69.   Numbers(11,SR)
  70.   sleep(1)
  71.  end
  72.  
  73.  if Direction == "Left" then
  74.   paintutils.drawFilledBox(18,8,20,17,colors.black)
  75.   paintutils.drawFilledBox(18,(18-GrL),20,17,colors.lime)
  76.   Numbers(19,GrL)
  77.   sleep(1)
  78.   paintutils.drawFilledBox(22,8,24,17,colors.black)
  79.   paintutils.drawFilledBox(22,(18-GaL),24,17,colors.lime)
  80.   Numbers(23,GaL)
  81.   sleep(1)
  82.   paintutils.drawFilledBox(26,8,28,17,colors.black)
  83.   paintutils.drawFilledBox(26,(18-SL),28,17,colors.lime)
  84.   Numbers(27,SL)
  85.   sleep(1)
  86.  end
  87. end
  88.  
  89.  
  90. local function Receive()
  91. id, message = rednet.receive()
  92.  
  93.  if message == "Left" then
  94.   id, message = rednet.receive()
  95.   GrL = message
  96.   id, message = rednet.receive()
  97.   GaL = message
  98.   id, message = rednet.receive()
  99.   SL = message
  100.   update("Left")
  101.  end
  102.  
  103.  if message == "Right" then
  104.   id, message = rednet.receive()
  105.   GrR = message
  106.   id, message = rednet.receive()
  107.   GaR = message
  108.   id, message = rednet.receive()
  109.   SR = message
  110.   update("Right")
  111.  end
  112.  
  113.  if message == "Stop" then
  114.   paintutils.drawLine(12,2,18,2,colors.black)
  115.   term.setCursorPos(14,2)
  116.   term.setTextColour(colors.red)
  117.   term.write("END")
  118.   paintutils.drawFilledBox(2,8,28,19,colors.black)
  119.   paintutils.drawFilledBox(1,18,29,19,colors.black)
  120.   term.redirect(c)
  121.   rednet.close(MdSide)
  122.   error()
  123.  end
  124. end
  125.  
  126. print("Entrer l'ID du computer")
  127. local Comp = read()
  128.  while true do
  129.   print("Entrer le cote du Modem left/right/top/bottom ")
  130.   MdSide = read()
  131.    if (MdSide == "left") or (MdSide == "right") or (MdSide == "top") or (MdSide == "bottom") then
  132.     break
  133.    end
  134.  end
  135.  while true do
  136.   print("Entrer le cote du Moniteur left/right/top/bottom")
  137.   MnSide = read()
  138.    if (MnSide == "left") or (MnSide == "right") or (MnSide == "top") or (MnSide == "bottom") then
  139.     break
  140.    end
  141.  end
  142.  
  143. term.clear()
  144. p = peripheral.wrap(MnSide)
  145. c = term.current()
  146. rednet.open(MdSide)
  147. term.redirect(p)
  148. term.setBackgroundColour(colors.black)
  149. term.clear()
  150. term.setCursorPos(11,1)
  151. term.setTextColour(colors.white)
  152. term.write("Grainator")
  153. term.setCursorPos(12,2)
  154. term.setTextColour(colors.yellow)
  155. term.write("running")
  156. term.setTextColour(colors.lightGray)
  157. paintutils.drawFilledBox(1,18,29,19,colors.green)
  158. paintutils.drawPixel(1,16,colors.white)
  159. paintutils.drawPixel(1,14,colors.white)
  160. paintutils.drawPixel(1,12,colors.white)
  161. paintutils.drawPixel(1,10,colors.white)
  162. paintutils.drawPixel(1,8,colors.white)
  163. paintutils.drawPixel(29,16,colors.white)
  164. paintutils.drawPixel(29,14,colors.white)
  165. paintutils.drawPixel(29,12,colors.white)
  166. paintutils.drawPixel(29,10,colors.white)
  167. paintutils.drawPixel(29,8,colors.white)
  168.  
  169.  while true do
  170.   Receive()
  171.  end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement