Advertisement
Imgoodisher

Computercraft modular tickertape

Aug 4th, 2012
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.68 KB | None | 0 0
  1. rednet.open("top")
  2.  
  3. nextid = 9001
  4. term.redirect(peripheral.wrap("back"))
  5. peripheral.call("back", "setTextScale", 5)
  6. term.clear()
  7. x, y = term.getSize()
  8.  
  9. chars = {}
  10. for i=1, x do table.insert(chars, " ") end
  11.  
  12. while true do
  13.  event, param1, param2, param3 = os.pullEvent()
  14.  --print(tostring(event).." "..tostring(param2))
  15.  
  16.  if event == "key" and param1 ~= 1 then
  17.   term.restore()
  18.   break end
  19.  
  20.  if event == "rednet_message" and param2 ~= nil then
  21.   table.insert(chars, param2)
  22.  
  23.   if chars[x] ~= nil then
  24.    rednet.send(nextid, chars[1])
  25.    table.remove(chars, 1) end
  26.  
  27.   for i = #chars, 1, -1 do
  28.    term.setCursorPos(i, 1)
  29.    write(chars[i])
  30.   end
  31.  
  32.  end
  33. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement