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

Computer Craft Prioritizing

Started by Wooki_inthetrees, 19 August 2014 - 05:20 PM
Wooki_inthetrees #1
Posted 19 August 2014 - 07:20 PM
so im attempting to make a id card type of system and i believe i figured it out most of the way but for the past 3 hours ive been trying to come up with a way to prioritize so that it doesnt run startup from the disk which i didnt know if was possible so i even tried this

fs.delete("disk/startup")
io.open("disk/secure")

local f = fs.open("disk/startup", "w")
f.writeLine(fs.delete("disk/startup"))
f.writeLine(io.open("disk/secure"))
io.open("lock")
to stop it from running the startup added to the floppy but no matter what it runs the "hackers" floppy over this one im at a loss of what to do is there anything???
Dragon53535 #2
Posted 19 August 2014 - 07:23 PM
Computercraft itself is coded to run any startup disk it finds, however you could have the program wait for a disk to be put inside the system and then execute your code.
Wooki_inthetrees #3
Posted 19 August 2014 - 07:26 PM
hmmm well is there anyway to prevent someone from inserting a disk with a faulted startup allowed them to access the system? somehow make the system delete their startup or anything?
Edited on 19 August 2014 - 05:28 PM
Dog #4
Posted 19 August 2014 - 07:30 PM
…however you could have the program wait for a disk to be put inside the system and then execute your code.
That still wouldn't stop someone from booting to floppy and completely bypassing his code, which is what Wooki_inthetrees is trying to avoid.

Wooki_inthetrees, if I recall correctly (and I may not), ComputerCraft looks at each side of the computer in a specific order and "back" is checked before "front". You could conceivably place a floppy drive on the back of the computer and run your program from that floppy - that way if someone attached a floppy to the front, the computer would always boot from your floppy instead of the "hacker's" floppy.

Hope that helps :)/>
Edited on 19 August 2014 - 05:30 PM
Wooki_inthetrees #5
Posted 19 August 2014 - 07:32 PM
yes thats very helpful :P/> lets test it !!!!
Wooki_inthetrees #6
Posted 19 August 2014 - 07:45 PM
i actually think that code is faulted whats the api to run another program like how would i do fs.delete("disk/startup") (api to run disk/secure)
Dragon53535 #7
Posted 19 August 2014 - 07:55 PM
To run a program, the easiest way is shell.run(programpath) And yes, he's right, i put two floppies in two different disk drives around 1 computer, and the one behind ran first.
Edited on 19 August 2014 - 05:58 PM
Dog #8
Posted 19 August 2014 - 08:04 PM
i actually think that code is faulted whats the api to run another program like how would i do fs.delete("disk/startup") (api to run disk/secure)
Please make an attempt to use punctuation and capitalization - I'm not sure I even understand what you're asking here.

What do you mean by "I actually think that code is faulted"? I just tested my suggestion and it works as expected so I don't know what you're referring to.

The shell api will allow you to run another program as Dragon53535 said, but I'd point out that unless you are passing a variable to shell.run you'll need quotes around the program path and name like this…

shell.run("programpath")

This still won't do what you want if your program is on the computer and the "hacker" uses a disk drive.
Dragon53535 #9
Posted 19 August 2014 - 08:09 PM
An easy way is to put the startup file in the disk as just shell.run("startup") and then put whatever you want to run inside your computer's startup file.
Dog #10
Posted 19 August 2014 - 08:20 PM
An easy way is to put the startup file in the disk as just shell.run("startup") and then put whatever you want to run inside your computer's startup file.
Why add the extra shell.run()? Why not just put the startup program on the disk itself?
Dragon53535 #11
Posted 19 August 2014 - 08:29 PM
That would work i guess, but i like using computers for my stuff :P/> and of course if he's using peripheral.wrap() then he should be find specifying the other disk drive. So yeah i guess he should be fine.
Lyqyd #12
Posted 19 August 2014 - 10:06 PM
Top has the highest priority.