Jump to content




Drive Thru


  • You cannot reply to this topic
5 replies to this topic

#1 awesomness1290

  • Members
  • 69 posts

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 by awesomness1290, 14 November 2014 - 04:00 AM.


#2 Agent Silence

  • Members
  • 319 posts
  • Location[string "FindMe"]:23143: bad argument #1 to 'returnPos' (vector expected, got nil)

Posted 14 November 2014 - 05:25 AM

there is no end at the well... end

#3 Dog

  • Members
  • 1,179 posts
  • LocationEarth orbit

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 by Dog, 14 November 2014 - 05:33 AM.


#4 awesomness1290

  • Members
  • 69 posts

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

#5 SGunner2014

  • Members
  • 113 posts
  • LocationMaidstone, UK

Posted 14 November 2014 - 05:48 PM

There is an unnecessary "end" before the else statement.

- Sam

#6 awesomness1290

  • Members
  • 69 posts

Posted 14 November 2014 - 07:35 PM

Thank you all for the help it works fine now!





3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users