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

[Error] For input string

Started by ikon106, 11 December 2012 - 04:09 AM
ikon106 #1
Posted 11 December 2012 - 05:09 AM
When I type in the name of the program (9by9) I just wrote it says:
For input string: "9by9"
What does that mean?
PixelToast #2
Posted 11 December 2012 - 05:27 AM
your typing it in the lua prompt
if you want to run a program do it from the shell
or just type shell.run("program")
ikon106 #3
Posted 11 December 2012 - 07:29 AM
your typing it in the lua prompt
if you want to run a program do it from the shell
or just type shell.run("program")

I am not, and even when I go into the lua promt and type shell.run("program") I get the same message. I even tried to do shhell.run outside the promt and it said that no such program existed.
Lyqyd #4
Posted 11 December 2012 - 07:48 AM
Try typing, "edit 9by9" into the command prompt. Does it open your program's code?
ikon106 #5
Posted 11 December 2012 - 08:02 AM
Try typing, "edit 9by9" into the command prompt. Does it open your program's code?

No, it opens a completly blank page.. That is very wierd, because when I edit the file with Notepad++ It shows the code..

If it means anything: the program file is located in mods/ComputerCraft/lua/rom/programs/turtle
PixelToast #6
Posted 11 December 2012 - 08:14 AM
are you editing the file on a turtle?

thats verry weird .-.
when i get unexplained errors like that i just restart MC

can we see your code?
ikon106 #7
Posted 11 December 2012 - 08:19 AM
are you editing the file on a turtle?

thats verry weird .-.
when i get unexplained errors like that i just restart MC

can we see your code?

Sure, How do you paste it so it still looks nice? By that I mean not make it look like this text here..
PixelToast #8
Posted 11 December 2012 - 08:21 AM
are you editing the file on a turtle?

thats verry weird .-.
when i get unexplained errors like that i just restart MC

can we see your code?

Sure, How do you paste it so it still looks nice? By that I mean not make it look like this text here..
use the

[CODE]
tag
ikon106 #9
Posted 11 December 2012 - 08:32 AM
.
faubiguy #10
Posted 11 December 2012 - 08:34 AM
The problem is that your using a variable named 9by9 in your for loop. Variables aren't allowed to start with numbers.

Since you don't actually use the variable 9by9, you can just use _ as a dummy variable in its place.
ikon106 #11
Posted 11 December 2012 - 08:35 AM
are you editing the file on a turtle?

thats verry weird .-.
when i get unexplained errors like that i just restart MC

can we see your code?

Sure, How do you paste it so it still looks nice? By that I mean not make it look like this text here..
use the

[CODE]
tag




write("How many rows should it be: ")
rows = read()
for 9by9=1, rows do
  turtle.up()
  function line()
	for linex=1, 8 do
	  turtle.placeDown()
	turtle.forward()
	end
  end
  function turn()
	turtle.placeDown()
  turtle.turnLeft()
  turtle.forward()
  end
  line()
  turn()
  line()
  turn()
  line()
  turn()
  line()
  turn()
end

It basically just makes 9by9 walls for now. And I was editing it outside of the game.
PixelToast #12
Posted 11 December 2012 - 08:41 AM
well theres your problem
you cant start variables with a number
theres also some more problems
here be fixed:

write("How many rows should it be: ")
local rows = tonumber(read())
for i=1,rows do
turtle.up()
for i=1,4 do
  for i=1,8 do
   turtle.placeDown()
   while not turtle.forward() do end
  end
  turtle.placeDown()
  turtle.turnLeft()
  while not turtle.forward() do end
end
end
ikon106 #13
Posted 11 December 2012 - 09:39 AM
well theres your problem
you cant start variables with a number
theres also some more problems
here be fixed:

write("How many rows should it be: ")
local rows = tonumber(read())
for i=1,rows do
turtle.up()
for i=1,4 do
  for i=1,8 do
   turtle.placeDown()
   while not turtle.forward() do end
  end
  turtle.placeDown()
  turtle.turnLeft()
  while not turtle.forward() do end
end
end

Thank you so much :D/>
ikon106 #14
Posted 11 December 2012 - 10:02 AM
well theres your problem
you cant start variables with a number
theres also some more problems
here be fixed:

write("How many rows should it be: ")
local rows = tonumber(read())
for i=1,rows do
turtle.up()
for i=1,4 do
  for i=1,8 do
   turtle.placeDown()
   while not turtle.forward() do end
  end
  turtle.placeDown()
  turtle.turnLeft()
  while not turtle.forward() do end
end
end

Why is it while not instead of just turtle.forward?
PixelToast #15
Posted 11 December 2012 - 10:08 AM
Why is it while not instead of just turtle.forward?
ive had some problems with turtle.forward() returning false
Lyqyd #16
Posted 11 December 2012 - 11:30 AM
If, after fixing the code itself, the turtle still says it can't find the program, run "edit /rom/programs/turtle/9by9" on the turtle and see if your code comes up.