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

Question: Terminating stuff, ect.

Started by NoticeMeh, 18 March 2013 - 10:43 AM
NoticeMeh #1
Posted 18 March 2013 - 11:43 AM
I have been trying.. forever for this. I need this for my movie place.

I really don't want someone going into the management room and terminating my password-lock thing, right? But sometimes I would need to terminate the computer itself, too. So what my question is, is how do you make Ctrl+T blockable, but if you type something like "cmnea" it terminates the program? I've saw the explanation on one thread before, but I forgot it.

Thx if u can help :)/>
Lyqyd #2
Posted 18 March 2013 - 02:56 PM
Split into new topic.
theoriginalbit #3
Posted 18 March 2013 - 03:03 PM
well it depends on a few key things. most of which is how you have your program, programmed. post the code to your door lock and we can help you specifically to that. :)/>
PixelToast #4
Posted 18 March 2013 - 03:09 PM

local oldPull=os.pullEvent
os.pullEvent=os.pullEventRaw -- prevent ctrl-t
while true do
term.clear()
term.setCursorPos(1,1)
write("enter something:\n>") -- \n means nextline
local a=read()
if a=="cmnea" then
break -- break out of the while loop
end
end
os.pullEvent=oldPull -- make ctrl-t work again
--eof
SuicidalSTDz #5
Posted 18 March 2013 - 03:10 PM
local oldPull = os.pullEvent
os.pullEvent = os.pullEventRaw
local termWord = "cmnea"
input = read()
if something then
--Do something
elseif something then
--Do something
elseif input == termWord then
os.pullEvent = oldPull
else
--Do something
end

Damn: Ninja'd by a piece of pixelated toast! <_</>