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

[Lua][Question]minedows help my program 2

Started by josheyhalo, 28 April 2012 - 11:33 PM
josheyhalo #1
Posted 29 April 2012 - 01:33 AM
how to add an interface like the one used by other better cc programs
Edited on 30 April 2012 - 01:14 AM
Luanub #2
Posted 29 April 2012 - 02:08 AM
io.flush() is for use with files and it appears that your not using a file to save data to so that is probably where your error is coming from.

The io.read() or you could just do read() will capture the answer from the user.

You also need to change the input to answer on line 60 since answer is what is capturing the users input.

I think you have your if statement wrong too. ~= is not equal and == is equal.

correct line 60 should be:

if answer == "yes" then
Edited on 29 April 2012 - 12:13 AM
MysticT #3
Posted 29 April 2012 - 02:14 AM
Just remove the io.flush() call, it isn't implemented in CC cause it's not needed (there's no buffer to flush).
Also, you defined the variable answer and readed the input in that variable, but you check for the variable input, wich isn't defined.
Luanub #4
Posted 30 April 2012 - 02:05 AM
Try doing this


print("virus found")
sleep(1)

print("start antivirus")


repeat
   io.write("continue with this operation (yes/no)? ")
   local answer = io.read()
   if answer == "yes" then
	  print("loading.")
	  sleep(1)
	  print("loading..")
   elseif answer == "no"
	  print("minedows offline")
  end
until answer=="yes" or answer=="no"
josheyhalo #5
Posted 30 April 2012 - 02:11 AM
Try doing this


print("virus found")
sleep(1)

print("start antivirus")


repeat
   io.write("continue with this operation (yes/no)? ")
   local answer = io.read()
   if answer == "yes" then
	  print("loading.")
	  sleep(1)
	  print("loading..")
   elseif answer == "no"
	  print("minedows offline")
  end
until answer=="yes" or answer=="no"

help

bios:206: [string "lock5"]:62: 'then' expected

Try doing this


print("virus found")
sleep(1)

print("start antivirus")


repeat
   io.write("continue with this operation (yes/no)? ")
   local answer = io.read()
   if answer == "yes" then
	  print("loading.")
	  sleep(1)
	  print("loading..")
   elseif answer == "no"
	  print("minedows offline")
  end
until answer=="yes" or answer=="no"

help

bios:206: [string "lock5"]:62: 'then' expected

do i add then to

print("minedows offline")
Luanub #6
Posted 30 April 2012 - 02:15 AM
Sorry I missed a then change to this


elseif answer == "no" then
josheyhalo #7
Posted 30 April 2012 - 02:38 AM
Sorry I missed a then change to this


elseif answer == "no" then


thank you*1000000000000000000000000000000000000000