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

Floppy disk installation/shop

Started by MistahEpic, 22 April 2013 - 01:02 AM
MistahEpic #1
Posted 22 April 2013 - 03:02 AM
I got a lot down already, but there appears to be a problem…



local option1 = "1"
local describe1 = "1*"
local exit = "exit"

print("Welcome, customer.")
print("Please pick a card type to be burned: ")
print("")
print("1. Door Combo")
print("")
print("Add a '*' after your order to view product description.")
print("Example: '1*'")
print("")
term.write(">")
local input = read()
if input == option1 then
term.clear()
term.setCursorPos(1,1)
print("Burning Disk...")
sleep(5)
print("")
print("Please collect your disk at the door.")
disk.eject("back")
sleep(5)
os.shutdown()

elseif input == describe1 then
term.clear()
term.setCursorPos(1,1)
print("Door Combination Lock")
print("Censors input characters with stars.")
print("Program termination locked without password.")
print("Automatic shutdown to reset program")
print("")
print("Type 'exit' to return to the main menu")
print("")
term.write(">")
local input = read()
if input == exit then
os.reboot()
end

I keep getting the error: bios:338: [string "startup"]:40: 'end' expected (to close 'if' at line 15)

I also want it to execute the command "cp doorLock disk/startup" one line before "disk.eject("back")" but I have no idea what that would look like in lua, so… revise and explain, fool please. thanks in advance
remiX #2
Posted 22 April 2013 - 03:08 AM
Missing an end riiight at the end :P/>

local option1 = "1"
local describe1 = "1*"
local exit = "exit"

print("Welcome, customer.")
print("Please pick a card type to be burned: ")
print("")
print("1. Door Combo")
print("")
print("Add a '*' after your order to view product description.")
print("Example: '1*'")
print("")
term.write(">")
local input = read()
if input == option1 then
	term.clear()
	term.setCursorPos(1,1)
	print("Burning Disk...")
	sleep(5)
	print("")
	print("Please collect your disk at the door.")
	disk.eject("back")
	sleep(5)
	os.shutdown()
elseif input == describe1 then
	term.clear()
	term.setCursorPos(1,1)
	print("Door Combination Lock")
	print("Censors input characters with stars.")
	print("Program termination locked without password.")
	print("Automatic shutdown to reset program")
	print("")
	print("Type 'exit' to return to the main menu")
	print("")
	term.write(">")
	local input = read()
	if input == exit then
		os.reboot()
	end
end -- missing an end here

Indentation helps a lot.
MistahEpic #3
Posted 22 April 2013 - 03:37 AM
Missing an end riiight at the end :P/>

local option1 = "1"
local describe1 = "1*"
local exit = "exit"

print("Welcome, customer.")
print("Please pick a card type to be burned: ")
print("")
print("1. Door Combo")
print("")
print("Add a '*' after your order to view product description.")
print("Example: '1*'")
print("")
term.write(">")
local input = read()
if input == option1 then
	term.clear()
	term.setCursorPos(1,1)
	print("Burning Disk...")
	sleep(5)
	print("")
	print("Please collect your disk at the door.")
	disk.eject("back")
	sleep(5)
	os.shutdown()
elseif input == describe1 then
	term.clear()
	term.setCursorPos(1,1)
	print("Door Combination Lock")
	print("Censors input characters with stars.")
	print("Program termination locked without password.")
	print("Automatic shutdown to reset program")
	print("")
	print("Type 'exit' to return to the main menu")
	print("")
	term.write(">")
	local input = read()
	if input == exit then
		os.reboot()
	end
end -- missing an end here

Indentation helps a lot.

thanks, and what about the "cp doorLock disk/startup" thing i asked for? you know how to do that?
remiX #4
Posted 22 April 2013 - 03:38 AM
fs.copy( "doorLock", "disk/startup" )
MistahEpic #5
Posted 22 April 2013 - 03:46 AM
fs.copy( "doorLock", "disk/startup" )

thanks