Advertisement
Esbenmine

Glasses

Aug 5th, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.66 KB | None | 0 0
  1. --Made by Esbenmine
  2. term.clear()
  3. term.setCursorPos(1,1)
  4. -- ID Register List
  5. rednet.open("top")
  6. glass = peripheral.wrap("bottom")
  7. glass.clear()
  8. while true do
  9.   boxW = 150
  10.   boxW1 = 152
  11.   boxY = 20
  12.   boxH = 82
  13.   boxH1 = 80
  14.   text = {}
  15.   Receive = false
  16.   repeat
  17.     id2, Thing = rednet.receive()
  18.     if Thing == "@ChatBox" then
  19.       Receive = true
  20.       id, Username = rednet.receive() --Receive username
  21.       id1, Message = rednet.receive() --Receive message
  22.     else
  23.       Receive = false
  24.     end
  25.   until Receive
  26.   if id == id1 then
  27.     for i = 1, boxH do --For loop to make the drop down box thing
  28.       glass.addBox(23, boxY, boxW, i, 0xFFFFFF,0.8) --Adds a box
  29.       sleep(0.1) --Wait 0.1
  30.       glass.clear() --Clear glasses
  31.     end --End of for loop
  32.     glass.addBox(23, boxY, boxW, boxH, 0xFFFFFF,0.8) --Add a box
  33.     glass.addText(52, 23, "Message received",0x000000) --Add text
  34.     glass.addText(30, 38, Username..":".." ",0x000000) --Add text Username
  35.     glass.addText(142, 23, "!",0xFF6A00) --Add text !
  36.     lastY = 1
  37.     if Message:len() > boxW/6 then --If the message is longer than the box
  38.       for i = 1, (Message:len()/(boxW/6))+1 do --For loop
  39.         text[i] = Message:sub(lastY,(i*(boxW/6))) --Making a line of text
  40.         lastY = i*(boxW/6)+1 --Variable
  41.         if i < boxH/17 then
  42.           glass.addText(30,(((i+1)*10)+1+boxY+10),text[i], 0x000000)
  43.           print(text[i])
  44.         else
  45.           glass.addText(30,(((i+1)*10)+1+boxY+10),text[i]:sub(1,(text[i]:len()-3)).."...".." ", 0x000000)
  46.           break
  47.         end
  48.       end
  49.     else
  50.       glass.addText(30,51,Message,0x000000)
  51.     end
  52.     sleep(1)
  53.   else
  54.   end
  55. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement