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

Want to remove CTRL+T from my program.

Started by RobinTheKayOh, 15 April 2012 - 03:51 PM
RobinTheKayOh #1
Posted 15 April 2012 - 05:51 PM
I am about to start my own server. The code i wrote myself is going to have a password, if the password is correct, the doors open then closes itself. But its easly done to just do Ctrl + T and then Edit startup.

Easier question: How do i prevent Ctrl+T?

Here is the code:


term.clear()
term.setCursorPos(1,1)
print, blalbblabla
moreprint
wirte("Password: ")
input = read("*")
pass = "passhere"
if input == pass then
redstone give signal
sleep for 2 secs..
redstone remove signal..
os.reboot()
else
print moaar
sleep
os.reboot
end
cant_delete_account #2
Posted 15 April 2012 - 05:57 PM
Easy. Code (Put it at TOP of your program):

os.pullEvent = os.pullEventRaw
And, your code is effed up.
RobinTheKayOh #3
Posted 15 April 2012 - 06:02 PM
Easy. Code (Put it at TOP of your program):

os.pullEvent = os.pullEventRaw
And, your code is effed up.

Thank you so much! Your awesome :3
RobinTheKayOh #4
Posted 15 April 2012 - 06:08 PM
Easy. Code (Put it at TOP of your program):

os.pullEvent = os.pullEventRaw
And, your code is effed up.

Btw, is it any way to edit that startup again?
cant_delete_account #5
Posted 15 April 2012 - 06:10 PM
Easy. Code (Put it at TOP of your program):

os.pullEvent = os.pullEventRaw
And, your code is effed up.

Btw, is it any way to edit that startup again?
I'm too lazy to do that atm. xD
1v2 #6
Posted 15 April 2012 - 06:29 PM
You could try this


term.clear()
term.setCursorPos(1,1)
print, blalbblabla
moreprint
wirte("Password: ")
input = read("*")
pass = "passhere"
local debug = "debugpass"
if input == pass then
redstone give signal
sleep for 2 secs..
redstone remove signal..
os.reboot()
elseif input == debug then
exit()
else
print moaar
sleep
os.reboot
end
cant_delete_account #7
Posted 15 April 2012 - 06:32 PM
You could try this


term.clear()
term.setCursorPos(1,1)
print, blalbblabla
moreprint
wirte("Password: ")
input = read("*")
pass = "passhere"
local debug = "debugpass"
if input == pass then
redstone give signal
sleep for 2 secs..
redstone remove signal..
os.reboot()
elseif input == debug then
exit()
else
print moaar
sleep
os.reboot
end
exit() will call nil, and give you an error, use error() instead of exit()
Cloudy #8
Posted 15 April 2012 - 07:15 PM
You could try this


term.clear()
term.setCursorPos(1,1)
print, blalbblabla
moreprint
wirte("Password: ")
input = read("*")
pass = "passhere"
local debug = "debugpass"
if input == pass then
redstone give signal
sleep for 2 secs..
redstone remove signal..
os.reboot()
elseif input == debug then
exit()
else
print moaar
sleep
os.reboot
end
exit() will call nil, and give you an error, use error() instead of exit()

Or you can do it properly, and exit using "return".