Posted 29 July 2012 - 02:20 AM
Hello… I have another question concerning a boot disk… I have followed what I thought would be a right way to go with the "If/Else" Statements, but it isn't working out for me with over 3 options for an input… Anyway here is the code!
On the screen in computercraft it says: For input string: "_2")
I am new to coding, so I cannot find the problem, sorry.
On the screen in computercraft it says: For input string: "_2")
I am new to coding, so I cannot find the problem, sorry.
os.pullEvent = os.pullEventRaw
term.clear()
term.setCursorPos(1,1)
write("Thank you for purchasing Light Control V1.0! nnThis product is designed to give you control over your lights! nnTo begin I need to know which version that you would like to install... nnPassword or No Password protection? nType Pass or NoPass or Cancel nn> ")
local input = read()
if input == "Pass" then
term.clear()
term.setCursorPos(1,1)
textutils.slowPrint("Installing Light Control Password Edition... Please Wait...")
os.sleep(4)
fs.delete("Lights")
fs.copy("disk/program", "Lights")
write("nnLight Control Password Edtion Installed Successfully!")
os.sleep(1)
write("nnThe Disk Will Now Eject")
os.sleep(2)
disk.eject("right")
os.sleep(1)
term.clear()
term.setCursorPos(1,1)
write("Enjoy Using Light Control v1.0!")
os.sleep(1)
write("nnYour Computer Will Now Reboot!")
os.sleep(2)
end
if input == "NoPass" then
term.clear()
term.setCursorPos(1,1)
textutils.slowPrint("Installing Light Control Password Free Edition")
os.sleep(4)
fs.delete("Lights")
fs.copy("disk/program2", "Lights")
write("nnLight Control Password Free Edition Installed Successfully!")
os.sleep(1)
write("nnThe Disk Will Now Eject")
os.sleep(2)
disk.eject("right")
os.sleep(1)
term.clear()
term.setCursorPos(1,1)
write("enjoy Using Light Control v1.0!")
os.sleep(1)
write("nnYour Computer Will Now Reboot!")
os.sleep(2_
end
if input == "Cancel" Then
term.clear()
term.setCursorPos(1,1)
textutils.slowPrint("Cancelling Installation... Please Wait...")
os.sleep(4)
write("nnCancellation Complete!")
os.sleep(2)
write("The Disk Will Now Eject")
os.sleep(1)
disk.eject("right")
os.sleep(1)
write("nnYour Computer Will Now Reboot")
os.sleep(2)
os.reboot()
end
else
write("ERROR! You Have Entered An Incorrect Answer! Try Again!")
os.sleep(1)
write("nnYour Computer Will Now Reboot!")
end