Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- storing argument present when program is launched
- -- ( on / off )
- local com = {...}
- if #com ~= 1 then
- print( "usage: ff <on/off>" )
- end
- -- Opening the wireless modem
- rednet.open( "top" )
- -- determining if you entered "on"
- if com[1] == "on" then
- -- telling other comp you want to turn on the forcefield
- rednet.send( 0, "FF on" )
- -- password input
- print( "Enter password:" )
- password = read( "*" )
- os.sleep( 0.5 )
- -- sending password to other comp
- rednet.send( 0, tostring( password ) )
- --[[waiting for other comp to confirm or deny password.
- this is handled by the other comp, so this just tells
- you if you entered the correct password or not so you
- know to try again.]]--
- wVer = false
- while not wVer do
- local network, passVer = rednet.receive()
- if passVer == "correct" then
- print( "Password accepted." )
- wVer = true
- elseif passVer == "incorrect" then
- print( "Password incorrect." )
- wVer = true
- end
- end
- -- determining if you entered "off"
- elseif com[1] == "off" then
- rednet.send( 0, "FF off" )
- else
- print( "usage: ff <on/off>" )
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement