krom

BatMaster

Feb 16th, 2013
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.87 KB | None | 0 0
  1. local nSlaveID = 28
  2. local nTimeout = 30
  3. local bCool = true
  4.  
  5.  
  6. local function slowmo(str)
  7.     local x, y = term.getCursorPos()
  8.     local l = string.len(str)
  9.     if l == 0 then
  10.         return
  11.     end
  12.     term.setCursorPos(x,y)
  13.     for i=1,l do
  14.         term.write(string.sub(str,i,1))
  15.         sleep(0.2)
  16.         x = x+1    
  17.     end
  18. end
  19.  
  20. yourmonitor = peripheral.wrap("right")
  21. term.redirect(yourmonitor)
  22.  
  23. term.clear()
  24. term.setCursorPos(1,1)
  25.  
  26. print("**************")
  27. print("* Welcome    *")
  28. print("**************")
  29. print("")
  30. print("Enabling network, connecting to BatteryGuy")
  31. rednet.open("top")
  32. print("Network enabled. Receiving...")
  33.  
  34. local time
  35.  
  36. while bCool  == true do
  37.     local id,msg,foo = rednet.receive(nTimeout)
  38.  
  39.     if id == nil then
  40.         print("Timeout")
  41.         bCool = false
  42.     else
  43.         time = os.time()
  44.         time = textutils.formatTime(time, true)
  45.         print(time.." - "..msg)
  46.     end
  47. end
Advertisement
Add Comment
Please, Sign In to add comment