Advertisement
Guest User

glasses

a guest
Sep 21st, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.76 KB | None | 0 0
  1. glass = peripheral.wrap("right")
  2. chatlog = {"a ","b ","c ","d ","e "}
  3.  
  4. function addBox()
  5.   glass.addBox(0,0,128,64,0xFFFFFF,0.2)
  6. end
  7.  
  8. function timeDis()
  9.   time = textutils.formatTime(os.time(),false)
  10.   glass.addText(6,2,time,0x000000)
  11. end
  12.  
  13. function getChat()
  14.   checking = os.pullEvent()
  15.   print(checking)
  16.   if checking.match(checking,"say ") then
  17.     chatlog.insert(tab,1,checking.sub(checking,5,-1))
  18.   end
  19.   checking = " "
  20. end
  21.  
  22. function disChat()
  23.   i = 1
  24.   --print(chatlog[1])
  25.   for c = 5,1,-1 do
  26.     glass.addText(4,i+15,chatlog[c],0x000000)
  27.     i = i+9
  28.   end
  29. end
  30.  
  31. function update()
  32.   os.queueEvent("update")
  33. end
  34.  
  35.  
  36. while true do
  37.   glass.clear()
  38.   addBox()
  39.   timeDis()
  40.   disChat()
  41.   parallel.waitForAny(getChat, update)
  42.   sleep(.2)
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement