Advertisement
Guest User

startup

a guest
Dec 23rd, 2012
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.26 KB | None | 0 0
  1. --[[Make sure this program is named "startup"
  2.         This program assumes your modem is on top of
  3.         the computer block and that your bundled cable
  4.         is hooked up to the back side of the computer.]]--
  5.  
  6. -- Opening the wireless modem
  7. rednet.open( "top" )
  8.  
  9. -- loop, waiting to receive from the other comp
  10. while true do
  11.     local network, command = rednet.receive()
  12.    
  13.     -- Command for turning forcefield ON
  14.     if command == "FF on" then
  15.    
  16.         -- waiting for a password to be sent from other comp
  17.         verPass = false
  18.         while not verPass do
  19.             local network, password = rednet.receive()
  20.            
  21.             -- checking if pw is true
  22.             if password == "yourPass" then
  23.            
  24.                 -- telling other comp pw is correct, and turning on
  25.                 -- the forcefield.
  26.                 rednet.send( 1, "correct" )
  27.                 rs.setBundledOutput( "back", colors.red )
  28.                 os.sleep( 0.2 )
  29.                 rs.setBundledOutput( "back", 0 )
  30.                 verPass = true
  31.                
  32.             -- checking if pw is false 
  33.             elseif password ~= "yourPass" then
  34.            
  35.                 -- telling other comp password is correct
  36.                 rednet.send( 1, "incorrect" )
  37.                 verPass = true
  38.             end
  39.         end
  40.    
  41.     -- command for turning the forcefield back off
  42.     elseif command == "FF off" then
  43.         rs.setBundledOutput( "back", colors.blue )
  44.         os.sleep( 0.2 )
  45.         rs.setBundledOutput( "back", 0 )
  46.     end
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement