I have made myself a password program (protected from Ctrl+T) that i would like to run on access to the computer, say you have a password protected door using a monitor on the side of the computer with a numpad lock, but anyone can right click the computer and change the password to said numpad (i like configurability) is there a way to make my password program run, as soon as the computer itself gets accessed?
This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
How to run a program on access?
Started by weirdwolf, 27 November 2016 - 12:15 AMPosted 27 November 2016 - 01:15 AM
Alright, straight to the problem at hand.
I have made myself a password program (protected from Ctrl+T) that i would like to run on access to the computer, say you have a password protected door using a monitor on the side of the computer with a numpad lock, but anyone can right click the computer and change the password to said numpad (i like configurability) is there a way to make my password program run, as soon as the computer itself gets accessed?
I have made myself a password program (protected from Ctrl+T) that i would like to run on access to the computer, say you have a password protected door using a monitor on the side of the computer with a numpad lock, but anyone can right click the computer and change the password to said numpad (i like configurability) is there a way to make my password program run, as soon as the computer itself gets accessed?
Posted 27 November 2016 - 01:40 AM
Posted 27 November 2016 - 01:36 PM
Not quite what i was gunning for, what i'd like is for, when the computer is running a program already, when you then access the computer a password program will run, then if you get the correct password it'll go back to running the other program, and to make sure the first program is 'always' running, it would look for input, and if nothing has been written for a couple of seconds it would terminate and go back to the first program, so a loop of the two programs if you will
Posted 28 November 2016 - 12:10 AM
The computer can't tell if a user is sitting in front of it or not.
Is there any particular need to only run one program at a time? It sounds like you could just run your two scripts in different multishell tabs… assuming you couldn't just code all functionality into one script.
Is there any particular need to only run one program at a time? It sounds like you could just run your two scripts in different multishell tabs… assuming you couldn't just code all functionality into one script.
Posted 28 November 2016 - 03:44 PM
there isn't a way to check if a player has clicked the computer? like checking where on a monitor a player has right-clicked?
Posted 28 November 2016 - 09:07 PM
there isn't a way to check if a player has clicked the computer? like checking where on a monitor a player has right-clicked?
Sure, it's possible to get mouse events, but they won't tell the program if a player interacted with the computer or not.
Posted 28 November 2016 - 10:19 PM
First, make coroutine manager, or find one online. Also make a timer var On the coroutine manager run your program and rom/programs/shell. Next, create a whitelist with user-events.
Now, rig os.pullEventRaw to check against that list, and if it finds a match, then reset the timerVar. But do this after also rigging it to check timerVar, and if timer var is greater than 180000 than go back to the login screen.
Now, rig os.pullEventRaw to check against that list, and if it finds a match, then reset the timerVar. But do this after also rigging it to check timerVar, and if timer var is greater than 180000 than go back to the login screen.
Edited on 28 November 2016 - 09:22 PM
Posted 28 November 2016 - 10:24 PM
First, make coroutine manager, or find one online
No. Using the built-in coroutine manager is much better, as it is guaranteed to work properly.
Posted 29 November 2016 - 11:39 AM
Might have been useful to have a link: http://www.computercraft.info/wiki/Parallel_(API)First, make coroutine manager, or find one online
No. Using the built-in coroutine manager is much better, as it is guaranteed to work properly.
Posted 02 December 2016 - 02:35 AM
Might have been useful to have a link: http://www.computerc.../Parallel_(API)First, make coroutine manager, or find one online
No. Using the built-in coroutine manager is much better, as it is guaranteed to work properly.
I swear, 90% of the time someone says to make a custom coroutine manager, the built in API is adequate and as mentioned - will work properly.
Posted 02 December 2016 - 11:51 AM
BB's guide to coroutines is overdue here.