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

Question about the new CC version

Started by Astrophylite, 19 February 2016 - 04:46 PM
Astrophylite #1
Posted 19 February 2016 - 05:46 PM
Hey guys!

I have a quick question - Dan has sped up the CTRL+R, CTRL+S and CTRL+T time down to like, 1 second (or there about) and I was wondering, is there a way to interrupt this now or not? I'm trying to make a door system and I'm locking the doors when you've tried the password too many times but then I realized you can just CTRL+R and try the password over and over again…

Any help will be appreciated,
_zircon_.
eniallator #2
Posted 19 February 2016 - 06:54 PM
use os.pullEventRaw()

If you are using read() for getting user input then you should try doing
local oldPullEvent = os.pullEvent
os.pullEvent = os.pullEventRaw

but if you are just using os.pullEvent for user input then instead of os.pullEvent, use os.pullEventRaw
Astrophylite #3
Posted 19 February 2016 - 06:55 PM
I am using that for blocking termination but this does not help interrupt CTRL+R (reboot) and CTRL+S (shutdown)..

_zircon_.
eniallator #4
Posted 19 February 2016 - 07:11 PM
I am using that for blocking termination but this does not help interrupt CTRL+R (reboot) and CTRL+S (shutdown)..

_zircon_.

You can run the program at startup then although i am not sure how to prevent the computer reading a disk
Astrophylite #5
Posted 19 February 2016 - 07:36 PM
Am I able to re-code the shell program and remove the boot-from-disk thing?

Thanks,
_zircon_.
Creator #6
Posted 19 February 2016 - 07:44 PM
Am I able to re-code the shell program and remove the boot-from-disk thing?

Thanks,
_zircon_.

No, the shell is run by the bios, I think. However, the setting api (or "set bootFromDisk false" in the shell) will allow you to block disks.
MKlegoman357 #7
Posted 19 February 2016 - 07:57 PM
For your timeout issue, you can save it on a file. For example, you could create a file indicating how much seconds the timeout should last, and update that file every second. When the computer is restarted you'd read that file and resume the timeout if necessary.
Astrophylite #8
Posted 19 February 2016 - 08:00 PM
For your timeout issue, you can save it on a file. For example, you could create a file indicating how much seconds the timeout should last, and update that file every second. When the computer is restarted you'd read that file and resume the timeout if necessary.
You saved the day yet again, man! I'll try this out and update the post if it's working or not :)/>

Am I able to re-code the shell program and remove the boot-from-disk thing?

Thanks,
_zircon_.

No, the shell is run by the bios, I think. However, the setting api (or "set bootFromDisk false" in the shell) will allow you to block disks.
How would I go about doing this?

Thanks,
_zircon_.
Edited on 19 February 2016 - 07:00 PM
Creator #9
Posted 19 February 2016 - 08:07 PM
Go to the shell, type set and look at the options by using up and down buttons. One of the options has disk or startup in it, select it by pressing TAB and append false to it. Then proceed to press ENTER. Do not turn off you physical computer during this insanely complicated task.
Astrophylite #10
Posted 19 February 2016 - 08:28 PM
Go to the shell, type set and look at the options by using up and down buttons. One of the options has disk or startup in it, select it by pressing TAB and append false to it. Then proceed to press ENTER. Do not turn off you physical computer during this insanely complicated task.
I am only a beginner, this task is too hard for me :(/>
Loljk but thanks man :)/>

Thanks,
_zircon_.
Edited on 19 February 2016 - 07:29 PM
Creator #11
Posted 19 February 2016 - 08:31 PM
So, did it work?
HPWebcamAble #12
Posted 19 February 2016 - 08:58 PM
You can now prevent the computer from running startup disks in adjacent drives, like Creator mentioned.

However, to prevent computers from being completely inaccessible, Dan made it possible to stick them in a disk drive (like a floppy disk) and modify the files on them.
Astrophylite #13
Posted 19 February 2016 - 09:01 PM
So, did it work?
Yeah.

For your timeout issue, you can save it on a file. For example, you could create a file indicating how much seconds the timeout should last, and update that file every second. When the computer is restarted you'd read that file and resume the timeout if necessary.
I can't figure out how to get this working.. Every time I try to write to my attempts file, I look in it and it just shows {}
http://pastebin.com/c47PBdWd startup code

Any help will be appreciated,
_zircon_

EDIT: I haven't worked with opening & writing to files in ages, so please excuse the mess…

You can now prevent the computer from running startup disks in adjacent drives, like Creator mentioned.

However, to prevent computers from being completely inaccessible, Dan made it possible to stick them in a disk drive (like a floppy disk) and modify the files on them.
I don't want the computer to be completely inaccessible, I just want the computer to be locked down after they fail 3 times…
Creator #14
Posted 19 February 2016 - 09:20 PM
Are you doing file:write(stuff) ?

The correct way is file.write(stuff) if you are using the fs api.

Another user got this issue recently too.

Checked the code, and you are using a ":". A "." will suffice.
Edited on 19 February 2016 - 08:20 PM
MKlegoman357 #15
Posted 19 February 2016 - 09:21 PM
The fs API uses the dot syntax for the file handles (for example: handle.write(), not handle:write()). Also, you'll want to save not only the number of attempts but also the timeout. If you'll not save the timeout then after the computer lock because of too many attempts you'll have to wait for 9999 seconds for it to reset, while keeping the computer turned on. As soon as you restart it it will start the 9999 timer again. Also, you're trying to write to an an-opened file handle on line 33.
Astrophylite #16
Posted 20 February 2016 - 08:36 AM
The fs API uses the dot syntax for the file handles (for example: handle.write(), not handle:write()). Also, you'll want to save not only the number of attempts but also the timeout. If you'll not save the timeout then after the computer lock because of too many attempts you'll have to wait for 9999 seconds for it to reset, while keeping the computer turned on. As soon as you restart it it will start the 9999 timer again. Also, you're trying to write to an an-opened file handle on line 33.
Thanks man! That was the problem ;)/>

Thanks,
_zircon_.
Edited on 20 February 2016 - 07:36 AM
Astrophylite #17
Posted 20 February 2016 - 08:42 AM
Erm… So this worked once and then it's erroring on line 18…
if(attempts >= maxAttempts) then
local attempts = tonumber(file.readLine())
^ defined attempts
local file = fs.open("/attempts","r")
^ defined file

Any ideas why this isn't working??
_zircon_.

EDIT: The only thing inside attempts is 0.0
Edited on 20 February 2016 - 07:43 AM
Creator #18
Posted 20 February 2016 - 09:54 AM
Just use file.readAll, that way you are sure that you get all the info!
Astrophylite #19
Posted 20 February 2016 - 10:09 AM
Just use file.readAll, that way you are sure that you get all the info!
It's fixed now, just a few bugs that I can fix :)/>

Thanks,
_zircon_.