Advertisement
Microstar301

CCTERMSERV/CLIENT

Dec 1st, 2013
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.95 KB | None | 0 0
  1. ID=5
  2. rednet.open("top")
  3. term.clear()
  4. term.setCursorPos(1,1)
  5. rednet.send(ID,"CONNECT")
  6. term.clear()
  7. term.setCursorPos(1,1)
  8. while true do
  9. x,y=rednet.receive(5)
  10.  if x==ID then
  11.   P=1
  12.   if y=="PASS" then
  13.    local R=read("*")
  14.    P=0
  15.    rednet.send(x,R)
  16.   end
  17.   if y=="PULL" then
  18.    P=0
  19.    print("PRESS ANY KEY TO CONTINUE...")
  20.    os.pullEvent("char")
  21.    rednet.send(x,"PULLED")
  22.   end
  23.   if y=="CLEAR" then
  24.    P=0
  25.    term.clear()
  26.    term.setCursorPos(1,1)
  27.   end
  28.   if y=="WAIT" then
  29.    P=0
  30.    i,o=rednet.receive()
  31.    if i==ID then
  32.     for t=1,o do
  33.      sleep(0.5)
  34.     end
  35.    end
  36.   end
  37.   if y=="INPUT" then
  38.    R=read()
  39.    P=0
  40.    rednet.send(x,R)
  41.   end
  42.   if y=="EXIT" then
  43.    print("REFUSED...")
  44.    sleep(2)
  45.    print("REBOOTING...")
  46.    sleep(1)
  47.    P=0
  48.    return
  49.   end
  50.   if y=="write" then
  51.    P=0
  52.    i,o=rednet.receive()
  53.    if i==ID then
  54.     write(o)
  55.    end
  56.   end
  57.   if P==1 then
  58.    print(y)
  59.   end
  60.  end
  61. end
  62. rednet.close("top")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement