Advertisement
RiseAboveHate

Siren_Client_1_1

Oct 30th, 2014
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.39 KB | None | 0 0
  1. term.clear()
  2. term.setCursorPos(1, 1)
  3.  
  4. local ServerID = ""
  5. local RB = ""
  6.  
  7. local SideRB = ""
  8.  
  9. if fs.exists("ServerIDFile") then
  10.  
  11.         ServerID = fs.open("ServerIDFile", "r")
  12.        
  13.         SID = ServerID.readLine()
  14.        
  15.         ServerID.close()
  16.        
  17. else
  18.  
  19.         term.write("Please write the Server id: ")
  20.         SID = read()
  21.        
  22.         ServerID = fs.open("ServerIDFile", "w")
  23.        
  24.         ServerID.write(SID)
  25.        
  26.         ServerID.close()
  27. end
  28. if fs.exists("RB") then
  29.  
  30.     RB = fs.open("RB", "r")
  31.    
  32.     SideRB = RB.readAll()
  33.    
  34.     RB.close()
  35.  
  36. else
  37.        
  38.     print("Please write the Rednet Block Side:")
  39.     term.write("")
  40.     SideRB = read()    
  41.    
  42.     if SideRB ~= "left" and SideRB ~= "right" and SideRB ~= "top" and SideRB ~= "bottom" and SideRB ~= "front" and SideRB ~= "back" then
  43.    
  44.         print("The Sides Of The Rednet Block needs to be one of these: \n Left | Right | Top | Bottom | Front | Back")
  45.         term.write("")
  46.         SideRB = read()        
  47.    
  48.     end
  49.    
  50.     RB = fs.open("RB", "w")
  51.    
  52.     RB.write(SideRB)
  53.    
  54.     RB.close()
  55.    
  56.     print("The Rednet Block Side that you entered is: "..SideRB)       
  57.    
  58. end
  59.  
  60. rednet.open(SideRB)
  61.  
  62. while true do
  63.  
  64.   id, message = rednet.receive()
  65.   if id == tonumber(SID) and message == "on" then
  66.     disk.playAudio("top")
  67.     print("|Input| Signal: On | ServerID: "..SID.." |Input|")
  68.   elseif id == tonumber(SID) and message == "off" then
  69.     disk.stopAudio("top")
  70.     print("|Input| Signal: Off | ServerID: "..SID.." |Input|")
  71.   end
  72.  
  73. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement