Advertisement
ecco7777

terminal glasses chat

Aug 4th, 2016
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.85 KB | None | 0 0
  1. function wrap(peripheralName,peripheralVar)
  2. sides={"top","bottom","left","right","front","back"}
  3. for i=1,6 do
  4. if peripheral.getType(sides[i])==peripheralName then
  5. peripheralVar=peripheral.wrap(sides[i])
  6. end
  7. end
  8. end
  9.  
  10. wrap("terminal_glasses_bridge", t)
  11. wrap("chat",c)
  12. t=peripheral.wrap("top")
  13. c=peripheral.wrap("left")
  14.  
  15. chatLog={}
  16. for i=1,10 do
  17. chatLog[i]=" "
  18. end
  19.  
  20. i=1
  21.  
  22.  
  23. while true do
  24. event, arg1, arg2, arg3 = os.pullEvent()
  25.  
  26. if event=="chat" then
  27. if #chatLog >= 10 then
  28. for i=1, #chatLog do
  29. chatLog[i]=chatLog[i+1]
  30. end
  31. end
  32. chatLog[#chatLog+1]=arg1.." : "..arg2
  33. end
  34.  
  35. if event=="chat_death" then
  36. if #chatLog >= 11 then
  37. for i=1, #chatLog do
  38. chatLog[i]=chatLog[i+1]
  39. end
  40. end
  41. chatLog[#chatLog+1]=arg1.." starb"
  42. end
  43.  
  44. t.clear()
  45. for i=1,#chatLog do
  46. t.addBox(1,1,400,100,0x000000,0.1)
  47. t.addText(1,i*8,chatLog[i],0xffffff)
  48. end
  49.  
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement