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

More Help With Frames Quarry Movement multiple "<eof>" errors

Started by Himself12794, 22 November 2012 - 05:34 PM
Himself12794 #1
Posted 22 November 2012 - 06:34 PM
Update: I found the error, but now I'm getting the trying to compare string with number.
How would I set user input as an integer?

function moveNorth()
  c=colors.combine(c,colors.white)
  rs.setBundledOutput("top",c)
  sleep(1.5)
  c=colors.subtract(c,colors.white)
  rs.setBundledOutput("top",c)
  sleep(0.5)
end

function moveSouth()
  c=colors.combine(c,colors.red)
  rs.setBundledOutput("top",c)
  sleep(1.5)
  c=colors.subtract(c,colors.red)
  rs.setBundledOutput("top",c)
  sleep(0.5)
end

function moveEast()
  c=colors.combine(c,colors.blue)
  rs.setBundledOutput("top",c)
  sleep(1.5)
  c=colors.subtract(c,colors.blue)
  rs.setBundledOutput("top",c)
  sleep(0.5)
end

function moveWest()
  c=colors.combine(c,colors.green)
  rs.setBundledOutput("top",c)
  sleep(1.5)
  c=colors.combine(c,colors.green)
  rs.setBundledOutput("top",c)
  sleep(1.5)
end

function moveUp()
  c=colors.combine(c,colors.yellow)
  rs.setBundledOutput("top",c)
  sleep(1.5)
  c=colors.subtract(c,colors.yellow)
  rs.setBundledOutput("top",c)
  sleep(0.5)
end

function moveDown()
  c=colors.combine(c,colors.orange)
  rs.setBundledOutput("top",c)
  sleep(1.5)
  c=colors.subtract(c,colors.orange)
  rs.setBundledOutput("top",c)
end

function askCoords()
  function askZCoords()
	write("How many blocks up? --> ")
	zu=read()
	term.clear()
	term.setCursorPos(1,1)
	if zu=="0" then
	  print("How many blocks down, then? --> ")
	  zd=read()
	  if zd==0 then
		term.clear()
		term.setCursorPos(1,1)
		print("Fine, there will be no z-axis movement then.")
		sleep(1.5)
	  elseif zd>256 then
		term.clear()
		term.setCursorPos(1,1)
		print("World level height is 256 blocks, that is too far.")
		askCoords()
	  end
	elseif zu>256 then
	  print("World level height is 256 blocks, that is too far.")
	  askCoords()
	else
	  zd=0
	end
  askXCoords()
  end

  function askXCoords()
	term.clear()
	term.setCursorPos(1,1)
	print("How many blocks east? --> ")
	xe=read()
	term.clear()
	term.setCursorPos(1,1)
	if xe==0 then
	  print("How many blocks west, then? --> ")
	  xw=read()
	  term.clear()
	  term.setCursorPos(1,1)
	  if xw==0 then
		print("Fine, there will be no x-axis movement, then.")
		sleep(1.5)
		term.clear()
		term.setCursorPos(1,1)
	  end
	else
	  xw=0
	end
  askYCoords()
  end

function askYCoords()
	print("How many blocks north? --> ")
	yn=read()
	term.clear()
	term.setCursorPos(1,1)
	  if yn==0 then
		print("How many blocks south, then? --> ")
		ys=read()
		term.clear()
		term.setCursorPos(1,1)
		if ys==0 then
		  print("There will be no x-axis movement, then.")
		  sleep(1.5)
		  term.clear()
		  term.setCursorPos(1,1)
		end
	  else
		ys=0
	  end
   end
  askZCoords()
  askYCoords()
  askXCoords()
end

askCoords()		
	  
--for i=1, 10 do
  --moveUp()
  --write(i)
  --print("/10 Blocks Moved Up")
--end
Edited on 22 November 2012 - 06:05 PM
Goof #2
Posted 22 November 2012 - 06:56 PM
End Of File / EOF

you have 1 end to many, before your "askZCoords()"
Himself12794 #3
Posted 22 November 2012 - 07:17 PM
Thank you, that is wonderful. Appreciate the help!