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

[Question] how to auto-start a program in startup file?

Started by NLBlackEagle, 14 January 2013 - 09:09 AM
NLBlackEagle #1
Posted 14 January 2013 - 10:09 AM
Hello everyone, first of all my question seems to be an easy one but if you count the hours i've spend looking for an anwser and asking questions in other forums you wont mind me asking it here.

So, what im trying to do is diffecult to explain so posting the code will help me with that. Everything works fine except the reference shell.run("factory1")

Well here the code:

os.pullEvent = os.pullEventRaw
local loop = true
while loop == true do
term.clear()
term.setCursorPos(1,1)
print("password?")
local input = read()
if input == "example" then
term.setCursorPos(1,1)
print("factory mainframe access granted.")
print("executable programs:")
print("[1] reinforced stone factory")
term.setCursorPos(1,4)
local input = read()
if input == "1" then
shell.run("factory1")
end
end
end


This code is located on a floppy (cd disk > edit startup)
the factory1 program is also located on the floppy.

So, what code should I use to run factory1 ?


Thanks for reading this! Advice is welcome!
Grim Reaper #2
Posted 14 January 2013 - 10:14 AM
Try using:

shell.run("disk/factory1")

When you reference the file using "factory1", the computer will think you're trying to access something that is in the machine's root directory.
NLBlackEagle #3
Posted 14 January 2013 - 10:16 AM
I knew it was something simple! Thanks man :)/>
And excuse me for not knowing this I figured out about compucraft 3 days ago :P/>