Advertisement
Guest User

altar

a guest
Jul 7th, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.78 KB | None | 0 0
  1. local ilosc = 3
  2.  
  3.  
  4. rednet.open("right")
  5. glass = peripheral.wrap("left")
  6. mon = peripheral.wrap("top")
  7. local table = {}
  8.  
  9. for i = 1,ilosc do
  10.   table[i-1] = "no connection"
  11. end
  12.  
  13. while true do
  14.   id, message = rednet.receive()
  15.   altar = string.sub(message,0,6)
  16.   message = string.sub(message, 7)
  17.   numer = string.sub(altar,6)
  18.   table[numer-1] = message
  19.   mon.clear()
  20.   for i = 1,ilosc do
  21.     mon.setCursorPos(1,i)
  22.     mon.setTextScale(1.4)
  23.     mon.write("Altar"..i..": ")
  24.     if(table[i-1] == "no connection") then
  25.       mon.setTextColor(colors.yellow)
  26.     else
  27.       mon.setTextColor(colors.green)
  28.     end
  29.     mon.write(table[i-1])
  30.     mon.setTextColor(colors.red)
  31.     glass.addText(1,(i-1)*10+1,"Altar"..i..": "..table[i-1],0xFF0000)
  32.   end
  33.   glass.sync()
  34.   glass.clear()
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement