Guest User

Untitled

a guest
May 22nd, 2014
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.26 KB | None | 0 0
  1. --fixes monitor and rednet
  2. monitor = peripheral.wrap("left")
  3. monitor.setTextScale(1)
  4. monitor.setCursorBlink(false)
  5. monitor.setBackgroundColor(1)
  6. monitor.clear()
  7. modemside = "top"
  8. rednet.open(modemside)
  9.  
  10. --variables
  11. turtles = {"[T1]","[T2]","[T3]","[T4]","[T5]","[T6]", "[All]"}
  12. selectedTurtle = {false, false, false, false, false, false, true}
  13. commands = {"[F]", "[B]", "[L]", "[R]", "[U]", "[D]", "[Dig]", "[DD]", "[DigHole]", "[Build]", "[BuildD]", "[Home]", "[Goto]", "[GetCoords]"}
  14. commandLength = {commands[1]:len(), commands[2]:len(), commands[3]:len(), commands[4]:len(), commands[5]:len(), commands[6]:len(), commands[7]:len(), commands[8]:len(), commands[9]:len(), commands[10]:len(), commands[11]:len(), commands[12]:len(), commands[13]:len(), commands[14]:len()}
  15. selectedCommands = {false, false, true, false, false, false, false, false, false, false, false, false, false, false}
  16. turtleColor = {2,4,8,16,32,64,512,1024,2048,4096,8192,16384,0}
  17. textColor = 128
  18. selectedColor = colors.black
  19.  
  20. --selects turtle (x)
  21. function selectTurtle(x)
  22.     if selectedTurtle[x] == true then
  23.         selectedTurtle[x] = false
  24.     else
  25.         selectedTurtle[x] = true
  26.     end
  27. end
  28.  
  29. --selects command (x)
  30. function selectCommand(x)
  31.     for i=0,#commands do
  32.         selectedCommand[i] = false
  33.     end
  34.     selectedCommand[x] = true
  35. end
  36.  
  37. --draws all turtles
  38. function drawTurtles()
  39.   monitor.setCursorPos(1,1)
  40.   monitor.setBackgroundColor(8)
  41.   monitor.clearLine()
  42.     print("Drawing turtles")
  43.     x = 3
  44.     y = 1
  45.     for i=1,#turtles+1,1 do
  46.         if selectedTurtle[i] == true then
  47.             monitor.setTextColor(selectedColor)
  48.             monitor.setCursorPos(x,y)
  49.             monitor.write(turtles[i])
  50.         else
  51.             monitor.setTextColor(1)
  52.             monitor.setCursorPos(x,y)
  53.             monitor.write(turtles[i])
  54.         end
  55.         x=x+5
  56.     end
  57. end
  58.  
  59. --draws all commands
  60. function drawCommands()
  61. print("Drawing commands...")
  62.     x = 2
  63.     y = 3
  64.     ox = x
  65.     for i=1, #commands+1 do
  66.         if selectedCommands[i] == true then
  67.             monitor.setTextColor(selectedColor)
  68.             monitor.setCursorPos(x,y)
  69.             monitor.write(commands[i])
  70.         else
  71.             monitor.setTextColor(128)
  72.             monitor.setCursorPos(x,y)
  73.             monitor.write(commands[i])
  74.         end
  75.         xl,yh = monitor.getSize()
  76.         if x+commandLength[i]>xl-1 then
  77.             y=y+1
  78.             x=ox
  79.         else
  80.             x=x+11
  81.         end
  82.     end
  83. end
  84.  
  85. drawTurtles()
  86. drawCommands()
Advertisement
Add Comment
Please, Sign In to add comment