Tekkit lite - computercraft script not functioning as intended ?
4 replies, posted
Hello,
First, I would like to apologize if my problem is put on the wrong spot. I tried the support thread but the issues were related to clients not working, java errors and so forth. Not in the same category as my problem. Should I've posted this somewhere else then I would kindly ask you to direct me to the right place. cheers.
Here's the problem:
Like the title says, I play with tekkit lite along with a little server for friends. I'm in the middle of building an underground base along with password protected doors and so forth.
I've been using this video as a tutorial on how to program a computer to emit a redstone signal for 5 seconds, which opens my door.
[media]http://www.youtube.com/watch?v=YPUzOE60a8c[/media]
I right-click the pc and edit the startup. This is the script I'm using.
[quote]
local side = "back"
local password = "Albarn"
write "Password: "
local input = read("*")
if input == (password) then
term.clear()
write "Access Granted"
rs.setOutput(back, true)
sleep(5)
rs.setOutput(back, false)
os.reboot()
else
term.clear()
write "Access Denied!!"
sleep(3)
os.reboot()
end
[/quote]
However, when I fill in the password I get the following message:
[quote]
Acess grantedstartup:8: attempt to call nil.
Any clue on how to fix this ? I do understand the basic on how this script works but I have no proper experience to tackle this issue myself.
[/quote]
Thanks.
rs.setOutput(back, false)
should be
rs.setOutput(side, false)
instead
That's a really old tutorial. I think the problem there is that you're using an outdated API.
Replace all instances of rs.setOutput with the more updated redstone.setOutput
[url]http://computercraft.info/wiki/Redstone_%28API%29[/url] For more information.
Both are valid, "rs" is just shorthand.
[quote]All methods from the redstone API can also be called using "rs", which points to the same library.[/quote]
Tip: add this at the beginning[code]local pullEvent = os.pullEvent
os.pullEvent = os.pullEventRaw[/code]and you won't be able to stop the script with ctrl-t, thus defeating the password
Sorry, you need to Log In to post a reply to this thread.