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

[errors] 3 errors, 2 newb programs and 1 platformer

Started by christley, 18 December 2012 - 05:05 AM
christley #1
Posted 18 December 2012 - 06:05 AM
im getting 3 errors i wish to get help with. all programs are from sethblings videos, and all are copied by the exact letter

first 2 errors come from this video, in the first 2:30 minutes both programs are shown
http://www.youtube.com/watch?v=YiNFZNBAF5w

the slot program:
it says "expected number" on line 18. which feels weird since it doesnt have a line 18

the forward program:
tells me that "for limit must be a number" when i write forward 3

^to those 2 programs i have a thought about why they are getting errors and working for seth. the [] brackets, you need to press alt gr to acces them on a european keyboard, and he doesnt. alt gr activates the menu for saving. but thats only a thought, and if im right, how do i solve it?


third error comes to this program:
http://pastebin.com/0866ayjy

i cant get it to start, i have put in some cobble and coal, made sure he's fueled and type platform. he returns making #x# platform where # is a number. but then tells me that "error: block is in the way" but its floating on top of layer 75, 40 layers above the nearest mountain. and no blocks are close to him what so ever
OmegaVest #2
Posted 18 December 2012 - 06:19 AM
For the first two it sounds very much like the tonumber calls in the program failed to work.

You say you copied the programs "to the letter". Can we see them? Call me mistrusting, but even a near-perfect copy is only near perfect.


The last one, not sure. Gonna look into it further.
christley #3
Posted 18 December 2012 - 09:42 AM
For the first two it sounds very much like the tonumber calls in the program failed to work.

You say you copied the programs "to the letter". Can we see them? Call me mistrusting, but even a near-perfect copy is only near perfect.


The last one, not sure. Gonna look into it further.

slot: http://puu.sh/1C4h5
forward: http://puu.sh/1C4hX
Orwell #4
Posted 18 December 2012 - 09:49 AM
So, in the slot program you have:

local args = ( ... )
local slot = slot tonumber(args[1])
turtle.select(slot)
That should definitely be:

local args = { ... }
local slot = tonumber(args[1])
turtle.select(slot)

For forward, you have:

local args = ( ... )

local dist = tonumber(args[1])

for i=1,dist,1 do
  turtle.forward()
end
Make that:

local args = { ... }

local dist = tonumber(args[1])

for i=1,dist,1 do
  turtle.forward()
end


Using Alt Gr is indeed a problem. I fix this be pressing 'Alt Gr' once, and then when the menu is activated, hold 'Alt Gr' again and press the [ key at the same time.

Edit:
For the platform program, you have this on line 15:

turtle.select(slot)
But the variable slot is only declared for the local scope of this for loop at line 3:

for slot=3,16 do
So I'm quite sure that slot is a nil value there. Maybe I'm overlooking something though.