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

(Error) Nil and Nil

Started by speedemon24, 18 November 2012 - 07:28 AM
speedemon24 #1
Posted 18 November 2012 - 08:28 AM
I have been having problems with a few goto progrmas from pastebin which I think should work correctly. But whenever I excute a command the turtle moves forwrd once then stops and it reads back
"goto:35: attempt to compare__lt on nil and nil"
Im asking here though becuase I tired other programs and got back the same thing.
Here is the link to the code in the example.
http://www.computercraft.info/forums2/index.php?/topic/3911-decent-goto-program-for-turtle/
remiX #2
Posted 18 November 2012 - 08:53 AM
Do you have a gps tower setup?
Kingdaro #3
Posted 18 November 2012 - 08:54 AM
Have you set up GPS before using the program?

EDIT: hNGGGFFF NINJAS
speedemon24 #4
Posted 18 November 2012 - 09:03 AM
yes i have at y 265. The gps locate function works fine
speedemon24 #5
Posted 18 November 2012 - 03:40 PM
ok guys I tired this on my server and thats when I was getting this error but in my single player I set up everything the same, same code, and it works fine.
Im wondering if it is a config file error on the server. Also my server is a vinalla FTB with one change to the CC config being allow HTTP. So if anyone can provide assassitance it would be great. Im going to post this link on the FTB fourms and see if they know what is going on. Here is a pic of it not working
Orwell #6
Posted 18 November 2012 - 03:51 PM
Can you try this in a lua terminal or as a program and see if the coordinates pop up?

rednet.open('right')
textutils.tabulate( { gps.locate(3,false) } )
remiX #7
Posted 18 November 2012 - 04:15 PM
Just after this line

nx,ny,nz = gps.locate(3,false)
Check what this results in
print(cx.. " " .. cy.. " " .. cz.. " " .. nx.. " " .. ny.. " " .. nz)
Just to check if they are not nil.
speedemon24 #8
Posted 18 November 2012 - 05:30 PM
Just after this line

nx,ny,nz = gps.locate(3,false)
Check what this results in
print(cx.. " " .. cy.. " " .. cz.. " " .. nx.. " " .. ny.. " " .. nz)
Just to check if they are not nil.

I did this and I get "attempt to concatenate string and nil." See I dont even know if this is a coding program becuase the program worked fine in single player but in multiplayer it does not seem to work for me.
remiX #9
Posted 18 November 2012 - 09:53 PM
That means one, or multiple of them are nil. And thats your problem to "goto:35: attempt to compare__lt on nil and nil"

And these cx, cy, cz, nx, ny, nz values are defined from

local cx,cy,cz = gps.locate(2,false)
and
nx,ny,nz = gps.locate(3,false)
I've never used gps.locate before but I'm sure the servers gps.locate is bugged ^^
MaHuJa #10
Posted 20 November 2012 - 01:49 AM
Here's a theory… when you're calling gps.locate(), and it works, it's because you've done something else (like the gps program) that did the rednet.open() for you.

Given that this is a turtle, the command is
rednet.open "right"
and when this is not already done, I would expect gps.locate() to return nils.
Orwell #11
Posted 20 November 2012 - 03:51 AM
Here's a theory… when you're calling gps.locate(), and it works, it's because you've done something else (like the gps program) that did the rednet.open() for you.

Given that this is a turtle, the command is
rednet.open "right"
and when this is not already done, I would expect gps.locate() to return nils.
The code he links to does

rednet.open("right")
at the top. And I already asked him to do this:

rednet.open('right')
textutils.tabulate( { gps.locate(3,false) } )
But he didn't reply on that.