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

GPS Deploy 1.1 **UPDATED** 04/01/2014

Started by neonerz, 20 January 2013 - 09:39 AM
neonerz #1
Posted 20 January 2013 - 10:39 AM
**UPDATED** 04/01/2014
- Made the computers fit inside one chunk (it's now 5x5 instead of 17x17)
- Works with No Fuel Mode servers (thanks happydude11209)
- Fixed bug in gps-deploy locate code (thanks kittykiller)
- Fixed bug where I call computers, monitors (thanks Mad_Professor)

If you label your computers and need support for that, check out KaosKlaus' edited version which includes support for labeled computers.

Here is a GPS Deployment script I made to add GPS hosts to your world. I'd love for comments, suggestions or bug reports.

This is the first application in a suite of GPS tools I have in the works.

[media]http://www.youtube.com/watch?v=5NlBU7MNKX8[/media]

Read script or watch video for detailed instructions.

Pastebin Install:

pastebin get qLthLak5 gps-deploy

TurtleScripts Market Install:

market get gjdh4o gps-deploy y
(I will try to keep the TurtleScripts Market copy always updated, but you could be 100% sure the pastebin version will always have the latest code)

When placing the turtle, it needs to be facing south(0). Please make sure the turtle has a clear view to the sky before deploying.

Turtle Slots:
  1. Fuel
  2. Minimum of 4 Computers
  3. Minimum of 4 Modems
  4. If Mining Turtle - Minimum of 1 Disk Drive | If Standard Turtle - Minimum of 4 Disk Drives
  5. Disk

Usage:
gps-deploy <x> <y> <z> [height]
This command will deploy the GPS satellite at y=254 or y+[height] if [height] is specified. The x, and z coordinates need to be the absolute coordinates of the turtles starting place. A good way to get the coordinates is to place a turtle down, stand on it, and press F3. Since turtles are less than a block high, F3 will show you the Y coordinate of the turtle. The X, and Z are a bit trickier. While standing on the turtle you'll see a X coordinate of for example X = -6.412 (-7) then the X coordinate you'd enter into the script would be -7, not -6. This goes the same for the Z coordinate.

gps-deploy locate [height]
If you have a already working GPS system, you could use the locate command to automatically enter the x, y, z coordinates of the mining turtle. You could still specify a custom height if you don't want the satellite to be deployed at y=254</z></y></x>
Edited on 14 April 2014 - 09:25 PM
BigSHinyToys #2
Posted 20 January 2013 - 02:39 PM
well explained program good work added to GPS tutorial page.
xInDiGo #3
Posted 22 January 2013 - 08:39 PM
hey this worked great! now my turtles can get its coordinates! also, how about maybe setting up a relay computer while its up there for some long range rednet!

but what are some handy things i can do with a turtles gps coordinates?
Rubbed #4
Posted 24 January 2013 - 01:12 PM
Here is the pastebin links if you want to save 60 seconds of your lives, I don't know why the poster didn't use pastebin, but idk what was going on in his head.
Turtlesender: RhWcgaNi
TurtleWG: Gs1KAhc1
There you go. :)/>

Here is the pastebin links if you want to save 60 seconds of your lives, I don't know why the poster didn't use pastebin, but idk what was going on in his head. Turtlesender: RhWcgaNi TurtleWG: Gs1KAhc1 There you go. :)/>/>
LOL WRONG TAB!

Nvm wrong tab, Wrong person, wrong everything. disregard this comment.
Rubbed #5
Posted 24 January 2013 - 08:06 PM
You should make it so it doesn't crash when attempting to run the program when turtles don't need fuel.
kittykiller #6
Posted 25 January 2013 - 01:08 PM
line 97 should be
xcord, ycord, zcord = gps.locate(5, false)

not
xcord, zcord, ycord = gps.locate(5, false)

When I was testing this out in creative I noticed when I tried gps-deploy locate the computers were giving out the wrong cords and when I looked at the code I noticed that they were backwards.

And when I changed it to X,Y,Z from X,Z,Y it worked fine :)/>
vafo #7
Posted 26 January 2013 - 01:55 PM
line 97 should be
xcord, ycord, zcord = gps.locate(5, false)

not
xcord, zcord, ycord = gps.locate(5, false)

When I was testing this out in creative I noticed when I tried gps-deploy locate the computers were giving out the wrong cords and when I looked at the code I noticed that they were backwards.

And when I changed it to X,Y,Z from X,Z,Y it worked fine :)/>
Pastebin for updated code to above comment:
http://pastebin.com/PsH9RvKV
xInDiGo #8
Posted 26 February 2013 - 12:53 PM
::edit::

never mind
solidmoose #9
Posted 09 March 2013 - 07:06 PM
how would I run this when my server has unlimited fuel set for the turtles? it crashes every time :s
subzero22 #10
Posted 16 March 2013 - 09:17 AM
This has worked great except for when the first time I was facing north and had my cords backwards lol. Well anyway there is one small problem. If the turtle has no fuel in it already and put put a stack of fuel for it to do it's job. Then set the height to 100 when it comes back to return it will only be a couple spaces down from the gps and run out of fuel. It will just give the finished prompt and sit there. You should make it so that when coming back down it checks if it has enough fuel to do so.
crimsonknight3 #11
Posted 21 April 2013 - 04:27 PM
There is a command built in to computer craft that can get it's direction *digs through his brain* your running ftb, which *should* have misc peripherals you can add this to your turtle that deploys the satellite. Not sure how you would do it with your mining turtles though as they cant have more than the mining + wireless upgrades….

Compass Upgrade
Craft a Compass alongside a turtle to get a Compass Turtle.
Exposes a single function, getFacing() which returns the turtle's facing - 0-3, same as the f: value in the F3 screen.
Vorg #12
Posted 10 May 2013 - 01:01 PM
There is a command built in to computer craft that can get it's direction *digs through his brain* your running ftb, which *should* have misc peripherals you can add this to your turtle that deploys the satellite. Not sure how you would do it with your mining turtles though as they cant have more than the mining + wireless upgrades….

Compass Upgrade
Craft a Compass alongside a turtle to get a Compass Turtle.
Exposes a single function, getFacing() which returns the turtle's facing - 0-3, same as the f: value in the F3 screen.

He needs a mining turtle to remove the disk drive. So the deployment turtle would have to forgo the modem and all gps functions for the compass. Or it would need to drop a mining turtle to remove the drives. then it would have to know to follow the deploy turtle as it could not be picked back up.
Ampix0 #13
Posted 12 May 2013 - 01:26 AM
Very cool. Right now I simply track the height change of the turtle. I am looking for an enclosed way to track the entire path. Right now I am not sure it is possible (I mean totally enclosed)
CupricWolf #14
Posted 03 June 2013 - 08:22 PM
This code assumes that the turtles use fuel and don't gracefully handle turtle.getFuelLevel() returning a string. I edited it and it will now ignore all fuel if the game is in no fuel mode. it is here –> XHk0u2DG
CupricWolf #15
Posted 03 June 2013 - 08:43 PM
how would I run this when my server has unlimited fuel set for the turtles? it crashes every time :s
I fixed that! :)/> XHK0u2DG
Conan1981m #16
Posted 07 June 2013 - 11:23 AM
Really good work ;-)
I was wondering where the gps would be before i watched the video ..
placing them so high is quite a good idea as well ;-)
logwet #17
Posted 14 July 2013 - 01:55 AM
Wow! this worked great! thanks for making this, it's been a great help for me! :D/>
Elrond1369 #18
Posted 24 July 2013 - 11:22 AM
Here is my code for controlling a gps satellite
Spoiler

file = io.open("pass.dat","r")
pass = file:read() file:close()
print(os.getComputerID())
rednet.open("bottom")
cable = peripheral.wrap("top")
while true do
event, id, msg = os.pullEvent("rednet_message")
if msg == pass then
file = io.open("stat.dat","r")
stat = file:read() file:close()
sleep(.5)
if stat == "turnOn" then
stat="shutdown"
rednet.send(id, "Transmitters Shutting down...")
else
stat="turnOn"
rednet.send(id, "Transmitters starting up...")
end
file = io.open("stat.dat","w")
file:write(stat) file:close()
for i, p in pairs(cable.getNamesRemote()) do
cable.callRemote(p, stat)
end
end
end
cheetah #19
Posted 25 July 2013 - 02:15 AM
This has worked great except for when the first time I was facing north and had my cords backwards lol. Well anyway there is one small problem. If the turtle has no fuel in it already and put put a stack of fuel for it to do it's job. Then set the height to 100 when it comes back to return it will only be a couple spaces down from the gps and run out of fuel. It will just give the finished prompt and sit there. You should make it so that when coming back down it checks if it has enough fuel to do so.

If you somehow find a stack of coal is not enough - use coke coal instead.
Dave-ee Jones #20
Posted 09 August 2013 - 03:30 AM
Brilliant program :D/>

Will definitely use this later :)/>
NEOparmen #21
Posted 09 August 2013 - 12:21 PM
Great Program!
Croft3r #22
Posted 20 October 2013 - 10:07 PM
Thank you for making this program. It is so much easier then having to setup the GPS manually. Now my dream of a city of turtles roaming as they please is a little bit closer.
Mad_Professor #23
Posted 24 October 2013 - 10:31 PM
Doesn't work for me, asked for 4 monitors gave it 4 and then stop workign, climb up to see what was wrong it got stuck on turnOn, looked at code

peripheral.call("front","turnOn")

no call exist in computercraft for this.
Mad_Professor #24
Posted 25 October 2013 - 04:23 AM
I fixed it! It can take a stack of computers, it just asks for monitors in the script, changed "monitor" with "computer" and problem solved.
Landstryder #25
Posted 29 October 2013 - 09:41 AM
This is a great program. I would definitely include this in any turtle utilities pack!
KaosKlaus #26
Posted 16 February 2014 - 10:59 PM
I like to have all my Computers labeled, so I modified this program to support labeled computers. You can use labeled (not-stackable) Computers for deployment and the label of each GPS-host will be set after placement. Also fixed a few minor issues. Usage hasn't changed, but slot requirements have changed slightly. And last but not least, turtles are now more patient - They don't mind you standing on them, while starting the program, they'll just wait until you get off and continue on. :rolleyes:/>

Turtle Slots:
  1. Fuel
  2. Disk
  3. Minimum of 4 Modems
  4. If Mining Turtle - Minimum of 1 Disk Drive | If Standard Turtle - Minimum of 4 Disk Drives
  5. Computers
  6. Computers
  7. Computers
  8. Computers
Code:
http://pastebin.com/Uy1umavZ

Install:
pastebin get Uy1umavZ gps-deploy

Usage:

When placing the turtle, it needs to be facing south(0). Please make sure the turtle has a clear view to the sky before deploying.

gps-deploy <x> <y> <z> [height]
This command will deploy the GPS satellite at y=254 or y+[height] if [height] is specified. The x, and z coordinates need to be the absolute coordinates of the turtles starting place. A good way to get the coordinates is to place a turtle down, stand on it, and press F3. Since turtles are less than a block high, F3 will show you the Y coordinate of the turtle. The X, and Z are a bit trickier. While standing on the turtle you'll see a X coordinate of for example X = -6.412 (-7) then the X coordinate you'd enter into the script would be -7, not -6. This goes the same for the Z coordinate.

gps-deploy locate [height]
If you have a already working GPS system, you could use the locate command to automatically enter the x, y, z coordinates of the mining turtle. You could still specify a custom height if you don't want the satellite to be deployed at y=254</z></y></x>
Edited on 17 February 2014 - 07:53 AM
Dog #27
Posted 27 February 2014 - 07:18 AM
Fixed the unlimited fuel check and started localizing variables.

On Pastebin

pastebin get YmFixAZz gps-deploy
neonerz #28
Posted 02 April 2014 - 04:44 AM
Thanks everyone for the interest! I know it's been a while since I released this but I made some updates (including some things suggested in this thread)

- Made the computers fit inside one chunk (it's now 5x5 instead of 17x17)
- Works with No Fuel Mode servers (thanks happydude11209)
- Fixed bug in gps-deploy locate code (thanks kittykiller)
- Fixed bug where I call computers, monitors (thanks Mad_Professor)

@KaosKlaus - I didn't want to implement your code because of the heavy edits you made to some functions (and I'd have to read through them all :P/> ). I linked your post to the OP so if anyone needs labeled computer support, they can use your version.
theCybes #29
Posted 03 April 2014 - 09:46 PM
Very nice and useful program :)/>

I added


shell.openTab("repeat")

to the computers in the air to allow relaying messages across long distances. Requires advanced computers and v1.6
Muuzied #30
Posted 13 April 2014 - 07:29 AM
Should this work with Computercraft 1.3.2? Cuz I Just get this error when try to start it: "gps-deploy:209: attempt to call nil"
Anybody else got this problem?
Cranium #31
Posted 13 April 2014 - 07:39 AM
Should this work with Computercraft 1.3.2? Cuz I Just get this error when try to start it: "gps-deploy:209: attempt to call nil"
Anybody else got this problem?
No, this will not work in that VERY outdated version…
1.4 was the version to add fuel requirements, which is part of the error you are getting.
Muuzied #32
Posted 13 April 2014 - 07:51 AM
Damnit! Tekkit Classic uses 1.3.2, is it anyway to change the code for that version?


/A
Cranium #33
Posted 13 April 2014 - 07:53 AM
You can remove calls to the fuel functions. That would just about do it.
Muuzied #34
Posted 13 April 2014 - 07:54 AM
Im a true noobie on CC how do you do that? lol



/A
Cranium #35
Posted 13 April 2014 - 08:13 AM
Well, you'd probably get a more complete answer if you posted in Ask A Pro. They can help you edit the program to remove references to newer versions.
Also, i'd recommend that you upgrade. Tekkit Classic is VERY old.
Muuzied #36
Posted 13 April 2014 - 08:21 AM
Okey, thx! Yeah I know, but I kinda like the old Tekkit more then the new one, old school ftw


/A
neonerz #37
Posted 14 April 2014 - 11:22 PM
Okey, thx! Yeah I know, but I kinda like the old Tekkit more then the new one, old school ftw

Assuming Cranium is right and the only problem is the fuel requirement, you could try this: http://pastebin.com/bc7EpxJ1

I removed the fuel requirement, but I didn't test it, and don't have that version of CC to try it on, so it may or may not work.
Lyqyd #38
Posted 14 April 2014 - 11:29 PM
It won't work. Automatic GPS deployment isn't possible prior to 1.4 unless you are manually programming the computers on the ground before giving them to the turtle to set up. The turtle was unable to place the disk in the disk drive (or remove it) prior to the changes 1.4 made to the turtle API.
adamhlt #39
Posted 20 April 2014 - 02:27 AM
Thanks for your program, it works great, but once set up the turtles don't seem to still work upon logging onto the server the next time. I have to manually reboot them each time I log onto the server. Any ideas on how to fix this? Have I done something wrong? Thanks
gamewin1 #40
Posted 03 May 2014 - 05:15 PM
My turtle gets stuck at the ceiling of the world and doesn't do anything else after that. What could be the issue?
Furest_ #41
Posted 05 August 2014 - 10:28 PM
Hi,
My upper computers placed by the turtle says they are located one block higher than where they are… But the lowers have the good one.
Why?
Edited on 05 August 2014 - 08:32 PM
SilverSatin #42
Posted 17 October 2014 - 07:03 PM
I cant seem to get the script to work,,,

My mining turtle just throws back the following message after I set the coordinates to launch;


gps-deploy: 89 : No such modem:  right

i'm surprised nobody else seem to have a problem with it… am I using the wront turtle? it's supposed to be a normal turtle ot a mining turtle right ?
Lyqyd #43
Posted 17 October 2014 - 07:38 PM
Looks like it wants you to use a wireless mining turtle.
KingofGamesYami #44
Posted 17 October 2014 - 07:39 PM
I cant seem to get the script to work,,,

My mining turtle just throws back the following message after I set the coordinates to launch;


gps-deploy: 89 : No such modem:  right

i'm surprised nobody else seem to have a problem with it… am I using the wront turtle? it's supposed to be a normal turtle ot a mining turtle right ?
Well, since it's looking for a modem, I'd say you need a wireless mining turtle.

Edit: Ninja'd
Edited on 17 October 2014 - 05:39 PM
SimonT456 #45
Posted 29 October 2014 - 09:11 PM
thanks, this program worked well
Mad_Professor #46
Posted 16 February 2015 - 11:06 AM
Seems that this script is broken, the wireless mining turtle just stops while going up, stops when deploying a disk drive. Doesn't throw any errors.
civilwargeeky #47
Posted 23 February 2015 - 03:24 AM
Seems that this script is broken, the wireless mining turtle just stops while going up, stops when deploying a disk drive. Doesn't throw any errors.
I'm not sure if you're having the same problem, but I found that the turtle is unable to place any blocks close to the world height limit.
A less-than-ideal solution I found was giving the fourth parameter about 100 or so (from a base of 64) works fine, at least for small areas.
Restioson #48
Posted 19 April 2015 - 02:23 PM
When I tried to run this program using an advanced mining turtle, it stopped at when it was at 254 (the world limit for building). Have I done anything wrong, is there a bug, or is it incompatible with the advanced mining turtle?
PS: (I manually moved the turtle down and restarted asking it to place the cluster 0 above, and it worked)
Love the program, btw!
Restioson
hotmaildotcom1 #49
Posted 30 July 2015 - 02:08 AM
Excellent program I use it on pretty much every server I play on
Dog #50
Posted 05 February 2017 - 01:52 AM
In keeping with the spirit of forum members providing updates for this program; I thought I'd share the updates I've made over time. neonerZ hasn't been online in over two years and I still use the program quite often, so I hope others will find these updates useful as well. This version is based on v1.1, and with the number of changes and updates I thought it might be good to differentiate it by updating the version number to 1.2.

It's a rather big update that includes the following:
- Localized variables, reformatted table construction, eliminated duplicate and unnecessary sanity checks,
- reduced use of tonumber() and turtle calls, added automatic modem finding and an error for non-wireless
- turtles when using 'locate', automatic GPS host computer labeling (respects currently labeled computers),
- custom host support re-enabled, emergency return-to-start when unable to complete the job,
- re-ordered the program to make it more linear, converted many variables to camelCase, and more.

Operation of the program from a user's perspective hasn't changed at all - with two exceptions:
1. A wireless modem is no longer required unless you are using the locate command; but if the turtle has one it will use the modem to verify it's return coordinates upon completion.
2. The slot assignments have changed from v1.1: slot 1 = fuel, slot 2 = floppy disk, slot 3 = floppy drive, slot 4 = wireless modems, slots 5, 6, 7, 8 = computers.

I've tested it reasonably well with 100% accuracy in all tests. The only things I haven't tested are 'custom' host support and deploying from a negative Y coordinate starting position (but both should work fine). Don't bother deploying *to* coordinates *below* your current coordinates - it won't work right.

When placing computers in the turtle's inventory, slots 5, 6, 7, and 8 are all valid slots - you can use any and all four slots as you desire. This version supports both labeled and unlabeled computers - and you can mix and match if you like. It will automatically label the unlabeled computers and preserve the labels of the labeled computers.

One feature that was disabled (and now should work) was the ability to provide a program named 'custom' that would be run by each GPS satellite computer instead of the standard gps host program. To enable a custom program just put the program on the turtle's drive and name it 'custom', then start gpsDeploy - remember that the custom program will need to either provide GPS services or launch the standard gps host application on its own.

A quick note - if you specify height, keep in mind that your are specifying height relative to your current position, not absolute height. For example, if you specify a height of 5, the top row of satellites will be deployed 5 blocks higher than the turtle's starting position and the lower row of satellites will be deployed 2 blocks above the turtle's starting position. If you want to ensure the satellites are deployed at an absolute height of 254 (and 251 for the lower row) then specify no height and the program will automatically deploy the array at 254/251.

Pastebin: VXAyXqBv
ComputerCraft: pastebin get VXAyXqBv gpsDeploy