This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
calmilamsy's profile picture

Lock with alert (Rednet)

Started by calmilamsy, 04 April 2013 - 06:21 AM
calmilamsy #1
Posted 04 April 2013 - 08:21 AM
Today i was messing around with Lua doing my own business when i had an idea :lol:/> thought i would make a password lock with an alert if someone does the password wrong! So here is what i have made up you can download/view it here:- lock:- paste bin.com/QBj5CJap receiver:- pastebin.com/bi26zfPi

Lock *universal*

print"Enter Password"
rednet.open("side") -- you need a modem on the appropriate side
while true do -- makes the thing repeat
x = io.read()
if x == "password here" then
rs.setOutput("side", true) -- replace side with the side the door is on
sleep(number) -- set the number to whatever length you want the door to be opened for
rs.setOutput("side", false)
else
rednet.broadcast("message")
os.shutdown()
end
end

Receiver *universal*

print"this is alert receiver 1"
rednet.open("side")
while true do
id, x = rednet.receive()
print(x)
end
if there is something wrong with my code let me know with the error message
*I cannot help you unless you tell me the error message*

i hoped i helped with future Security Systems! ;)/>
i will also take program requests

EDIT1:- I will realease my rednet turtle program once i get it done!
sleawnis #2
Posted 04 April 2013 - 10:36 AM
Very Nice Idea :)/> I Had The Same Idea Once, But Only Made It Output Redstone To A Different Side (Whitch Triggerd A Trap), I Never Thaught About Using Rednet :)/> Welldone
calmilamsy #3
Posted 04 April 2013 - 09:22 PM
Very Nice Idea :)/> I Had The Same Idea Once, But Only Made It Output Redstone To A Different Side (Whitch Triggerd A Trap), I Never Thaught About Using Rednet :)/> Welldone

its really simple really :P/> i just sat around fooling with it till it worked
Kilobyte #4
Posted 05 April 2013 - 11:21 PM
A few tips:
1. You should never have the password detection on a computer that a player can access easily (uness you have world protection plugins)
2. This is a serious issue: as of latest cc versions rednet is NO LONGER SECURE. You can sniff any data and even Fake send stuff. so you should maybe use lan cables. :P/>
Frederikam #5
Posted 05 April 2013 - 11:50 PM
A few extra tips.

The password that the user will enter will be visible. The problem with that is that nearby users can steal the password just by looking in the terminal (that's bad). The solution: use read("*") instead of read(). The difference with this is that the entered password will be shown as for example "******".

The other thing is that some users have zero tolerance against manual setup. The solution: Have the program ask at first what settings it should run with using the read() function. Now how do we store this (the fact that the setup has been run, the password and the time the redstone will be outputted (maybe also the side to output at?))? Let me introduce you to the fs api. This api lets you save and read files on a computer. I suggest you follow this tutorial.
calmilamsy #6
Posted 21 April 2013 - 12:11 AM
i know about that (this is just a heads up on what rednet can be used for) this is just the CORE of the code