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

I might just be an idiot...?

Started by SomeoneJimmy, 26 January 2016 - 04:00 AM
SomeoneJimmy #1
Posted 26 January 2016 - 05:00 AM
I'm not completely new, but I stepped away from minecraft for a bit and now I came back to it. So I'm trying to semi-automate some gourmaryllis (from the botania mod). I've got the script for the main part of the program down, but for some reason I can't seem to work out this statement. I usually like to run programs and then have it ask me if I want to clear the screen because I usually have some text print so I can see a bit of progression.

So here's what I have for the clear screen bit:


print("Looks like that's it.  Clear?")
print("Hit 1 for yes, 2 for no.")
local e = read()
if e == 1 then
  print("Ok then. clearing screen!")
  sleep(1)
  term.clear()
else
  print("You don't want to clear that mess?  Ok...")
end

The problem is whenever I type in 1, it still goes and prints, "You don't want to clear that mess? Ok…" I tested it out by replacing e with 1 so it reads, "1 == 1", and it works. So any idea on what I did wrong?
Bomb Bloke #2
Posted 26 January 2016 - 05:02 AM
read() returns a string.

if e == "1" then
SomeoneJimmy #3
Posted 26 January 2016 - 06:40 AM
Ah, ok. Yeah that would make more sense. Thanks for answering anyways.