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

Drive Thru

Started by awesomness1290, 14 November 2014 - 02:55 AM
awesomness1290 #1
Posted 14 November 2014 - 03:55 AM
Im making a drive thru with ae2 and computercraft and i cant get this code to work plz help


rednet.open("back")
function clear()
  term.clear()
  term.setCursorpos(1,1)
end

clear()
term.write("Are you at the drive thru?: ")
Thru = read()
if Thru == "Yes" or "yes" then
  clear()
  print("Menu:")
  term.setCursorPos(4,1)
  print("Hamburger")
  print("Cheese Burger")
  print("PB&J")
  print("Grilled Cheese")
  print("Coffee")
  print("Choose One: ")
  choice = read()
  rednet.broadcast(choice)
  sleep(2)
  clear()
  print("Thanks for using the Drive Thru!")
  end
else:
  clear()
  print("Enjoy your day!")
  sleep(2)
Edited on 14 November 2014 - 03:00 AM
Agent Silence #2
Posted 14 November 2014 - 05:25 AM
there is no end at the well… end
Dog #3
Posted 14 November 2014 - 05:32 AM
To build on what Requiem said, you have some other issues that should be addressed:

Will a colon work after an else, such as on the 4th to last line?

Also, your if/or statement (for Thru) won't work the way you expect it to. Instead, it would be better to do this:

if string.lower(Thru) == "yes" then

On line 4, you have term.setCursorpos … it should be term.setCursorPos - note the capital P - capitalization matters in Lua.

Hope that helps :)/>
Edited on 14 November 2014 - 04:33 AM
awesomness1290 #4
Posted 14 November 2014 - 05:32 PM
I fixed everything you guys said and im still getting the same error: bios:366: [string "Thru"]:26: '<eof>' expected
SGunner2014 #5
Posted 14 November 2014 - 05:48 PM
There is an unnecessary "end" before the else statement.

- Sam
awesomness1290 #6
Posted 14 November 2014 - 07:35 PM
Thank you all for the help it works fine now!