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

[help] [mining API] does not work, when two numbers are entered?

Started by Goof, 19 November 2012 - 06:07 AM
Goof #1
Posted 19 November 2012 - 07:07 AM
Hey…


i have a problem… its not an error like bios:203: etc…. but

i have made this MikkAPI with multiple function. (doWall, doQuarry)

in the doQuarry, it has a fail…

when it asks, for the heigth and width of the tunnel, and i pressed in "20" and "20"
then after it digs the first 2 blocks, it starts to nextRow.. but it would still need 18 blocks to dig… why?

like…



for i = 1, 20 do and then i edited the forward..
turtle.digdown()
goForward() -- this is a function in the API.
end

to -


for i = 1, 20 do
turtle.digDown()
if i < 20 then
goForward() --- its here it bugs out.. i tested it with sleep(1).. it only does this if statement 2 times, then continues bugging out the API.
end
sleep(1)
end

Full Code:

Spoilerhttp://pastebin.com/eFDNibnU

Can anyone help me with this?? i have tested the program for all numbers under 10… and thoose numbers works fine…


Thanks in advance
:)/>/>

___________________________________

-Mikk809h

ComputerCraft is awesome
Orwell #2
Posted 19 November 2012 - 08:08 AM
I don't even know how you don't get an error by this, but the variable on your for loops seem to be strings?
You read them through read(), so they are strings. Though, when used in for loops, your variables need to be numbers. You can convert them by using the tonumber() function like this (example from line 299):

local input = read()
widTT1 = tonumber( input )
Make sure to do that with all those variables.
Goof #3
Posted 19 November 2012 - 09:51 AM
Thanks.. I will try that ASAP. Thanks.