17 posts
Posted 11 April 2012 - 07:36 PM
Hello, i was wondering if it was possible to start the GPS program and set it to host at certain coordinates, because i have a GPS system set up but it is a pain to goto each GPS host and manually enter the coordinates.
I've tried
shell.run(gps host -186 72 215)
but all that gives is "bios:206: [string "gps"]:1: ')' expected". I thank you in advanced to any help you can give
2 posts
Posted 11 April 2012 - 07:47 PM
shell.run("/rom/programs/gps","host",-186,72,215)
this will work for you and for the other gps becons just change the numbers
1604 posts
Posted 11 April 2012 - 07:48 PM
You have to sepparate the parameters with commas, and they must be strings (since that's what the program expects).
Use:
shell.run("gps", "host", "-186", "72", "215")
28 posts
Posted 16 April 2012 - 11:43 AM
Every time I use gps locate, it says ("Could Not Determine The Position.")
17 posts
Posted 03 May 2012 - 09:36 PM
to darkdave and mystict thank you for your help (sorry for late reply)
to con2000, have you set up at least 4 different beacons at different postions?
34 posts
Posted 11 May 2012 - 05:40 PM
Ok, understand this, but is there a way to assign the found x, y and z to variables? When I try
x, y, z = shell.run ("gps", "locate")
print (x, y, z)
It just prints true.
1604 posts
Posted 11 May 2012 - 05:48 PM
Ok, understand this, but is there a way to assign the found x, y and z to variables? When I try
x, y, z = shell.run ("gps", "locate")
print (x, y, z)
It just prints true.
That's because the program doesn't return the values, you need to use the gps API:
local x, y, z = gps.locate(timeout) -- change timeout to the time to wait for responses
print(x, y, z)
436 posts
Posted 11 May 2012 - 05:50 PM
Ok, understand this, but is there a way to assign the found x, y and z to variables? When I try
x, y, z = shell.run ("gps", "locate")
print (x, y, z)
It just prints true.
Use x,y,z = gps.locate(timeout, debug).
So far as I know, shell.run() always returns a boolean, stating whether or not the program worked. Thus, "true", because the program reached the end without an error.
34 posts
Posted 11 May 2012 - 07:11 PM
Ok, got it working, except for one thing. When I close Minecraft, and start it later, all modems are closed. Resulting in the fact that I have to make the hosting computers manually host again. Is there a code for hosting gps, so you can put it in the startup file?
1604 posts
Posted 11 May 2012 - 07:39 PM
errn, did you read the post? that's what it is about.
You have to use shell.run:
shell.run("gps", "host", "x", "y", "z") -- replace x, y and z with the corresponding values
436 posts
Posted 11 May 2012 - 07:40 PM
Uhmm, yes and no. From what I can tell, the GPS API sends out its coordinates when it receives "PING". So, you could always make your terminals always look for that, then send their coordinates to the sender. However, to make them dedicated terminals, just make a startup file with shell.run ("gps", "host", x,y,z). It's much simpler in the end.
EDIT: Twice ninja'd. I don't know what to make of that.
34 posts
Posted 12 May 2012 - 12:54 PM
Uhh, well. Sorry, wasn't there with my mind. Now another question. Which x, y and z uses the gps? That of the modem, of those of the computer? Because I have set up 5 hosts, with coördinates checked with F3, but when I use gps locate it doesn't give the correct coördinates.
Nvm. Already found that I accidentally used the coördinates at eye level while standing on top of the computer in stead of computer lvl at one of the computers.
8543 posts
Posted 12 May 2012 - 04:58 PM
You have to sepparate the parameters with commas, and they must be strings (since that's what the program expects).
Use:
shell.run("gps", "host", "-186", "72", "215")
Numbers don't actually have to be strings; they'll work fine without the quotes. The strings do need the quotes, though.
1604 posts
Posted 12 May 2012 - 06:00 PM
You have to sepparate the parameters with commas, and they must be strings (since that's what the program expects).
Use:
shell.run("gps", "host", "-186", "72", "215")
Numbers don't actually have to be strings; they'll work fine without the quotes. The strings do need the quotes, though.
Yes, but it's better to always give strings as arguments for shell.run(), since the programs expect strings that come from the shell (when you type the program name and arguments). But yes, it would work since the gps program uses tonumber() on the parameters, wich will return the same given number.