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

Boot Installation Disk Help...

Started by ChaddJackson12, 28 July 2012 - 06:14 PM
ChaddJackson12 #1
Posted 28 July 2012 - 08:15 PM
I need some help with this code, I am very very new to lua (Because of this mod xD) and I can't seem to get this code to work. Please help me any way that you can, or find the error(s) that there are…. Thanks
os.pullEvent = os.pullEventRaw
term.clear()
term.setCursorPos(1,1)
write("Install Disk Player?")
write("Type Yes to proceed! Type anything else to cancel!")
local input = read()
if input == "Yes" then
term.clear()
term.setCursorPos(1,1)
textutils.slowPrint("Installing Disk Player...")
os.sleep(4)
fs.delete("romDisk Player")
fs.copy("diskDisk Player,romstartup")
write("Disk Player Installed Successfully!")
sleep(1)
textutils.slowPrint("Ejecting Disk")
sleep(2)
textutils.slowPrint("Restarting Computer")
sleep(2)
os.reboot()
else
textutils.slowPrint("Cancelling Installation...")
os.sleep(2)
textutils.slowPrint("Ejecting Disk")
os.sleep(2)
term.clear()
term.setCursorPos(1,1)
os.reboot
end

Also, I had to use "Type anything else to cancel" Because I do not know how to make "yes / no" option work.
MysticT #2
Posted 28 July 2012 - 08:23 PM
You didn't say what's the error. I suppose it's something like "Access denied", since you can't edit the rom.
Tiin57 #3
Posted 28 July 2012 - 08:24 PM
Here you go.

os.pullEvent = os.pullEventRaw
term.clear()
term.setCursorPos(1,1)
write("Install Disk Player? ")
write("Type Yes or No!")
local input = read()
if input == "Yes" then
term.clear()
term.setCursorPos(1,1)
textutils.slowPrint("Installing Disk Player...")
os.sleep(4)
fs.delete("startup") -- You cannot edit rom ingame.
fs.copy("diskDisk Player", "startup") -- The arguments for anything cannot be combined in one set of quotation marks. You need seperate sets.
write("Disk Player Installed Successfully!")
sleep(1)
textutils.slowPrint("Restarting Computer")
sleep(2)
os.reboot()
elseif input == "No" then -- This will add onto the if statement.
textutils.slowPrint("Cancelling Installation...")
os.sleep(2)
textutils.slowPrint("Ejecting Disk") -- Do you want it to actually eject the disk?
os.sleep(2)
term.clear()
term.setCursorPos(1,1)
os.reboot() -- You forgot the () here.
end
I added comments where the errors were. Hope it helps! (I also fixed your yes/no option)
Edit: Beaten to it. :)/>/>
ChaddJackson12 #4
Posted 28 July 2012 - 08:25 PM
Here you go.

os.pullEvent = os.pullEventRaw
term.clear()
term.setCursorPos(1,1)
write("Install Disk Player? ")
write("Type Yes or No!")
local input = read()
if input == "Yes" then
term.clear()
term.setCursorPos(1,1)
textutils.slowPrint("Installing Disk Player...")
os.sleep(4)
fs.delete("startup") -- You cannot edit rom ingame.
fs.copy("diskDisk Player", "startup") -- The arguments for anything cannot be combined in one set of quotation marks. You need seperate sets.
write("Disk Player Installed Successfully!")
sleep(1)
textutils.slowPrint("Restarting Computer")
sleep(2)
os.reboot()
elseif input == "No" then -- This will add onto the if statement.
textutils.slowPrint("Cancelling Installation...")
os.sleep(2)
textutils.slowPrint("Ejecting Disk") -- Do you want it to actually eject the disk?
os.sleep(2)
term.clear()
term.setCursorPos(1,1)
os.reboot() -- You forgot the () here.
end
I added comments where the errors were. Hope it helps! (I also fixed your yes/no option)
Edit: Beaten to it. :)/>/>
Oh my goodness…. Thank you sooo much, this was just what I was looking for!