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

GPS Tower Builder

Started by bigbaddevil6, 26 June 2014 - 03:55 AM
bigbaddevil6 #1
Posted 26 June 2014 - 05:55 AM
As some people may know, you can use towers to allows turtles and computers to get their location in the world. It allows for some pretty smart pathing AI.

The one problem is you have to build a tower before a computer can use it. Well I have made a program that allows for you to give the coordinates to the computers and it will go up build the tower and program the computers for you and come back down. It reuses its materials such as a floppy disks and will continue to run even after a server reset.

I decided to go one extra step and allow for you to either give it the cords or tell it to locate an existing tower to get the cords from. It will go to highest point it can to give maximum range for the towers.

How to use with first tower
1. You will need a wireless mining turtle.
2. You will need to get the program from pastebin. The command you need to enter follows… pastebin get Zq7hsHp9 tower
3. That will download the program from pastebin and save it as tower on the turtle.
4. For the very first tower you will need to type the information as such: tower <x>, <y>, <z>, <f> The f is the face/direction. Its below the Z cord in F3, 0-3(its best that you stand on top the turtle when entering the coords and to uses the numbers inside the () because they are more accurate to the program)
5. Hit enter and the you should be prompted with a screen like this http://puu.sh/9KkZq/1c92d0730f.png It will show you the current coords as well as the coords for all 4 GPS computers. Press any key when you want to continue.
6. Next you will be prompted with a screen that looks like this. http://puu.sh/9Klo5/3e1cca0756.png. Put the items in the slots as shown on the screen. Fuel is any item that can be used as fuel in furnace.
7. Hit Enter when you are ready. It will have a 10 second countdown to stand clear of the turtle moving up. If you get in the way it can mess up the program.
8. It will go up and build the tower and come back down and ping the tower to make sure it worked properly.

How to use with an existing tower
1. Instead of entering: tower <x>, <y>, <z>, <f> you will just enter: tower locate
2. You will need to stand behind the turtle because it will need to move forward one and back to get the direction it is facing. (Make Sure it has a little bit of fuel to move that one block)
3. If it can not find the tower you will need to enter the coords as before with the first setup.
4. The rest is the same as before just a different command and that the turtle will need to move forward one block.

Pros
1. Reuses it's materials, such as the disk drive, and floppy disks.
2. No programming required the disk can be blank or one that you want to reuse.
3. Is allowed to get it coords from another tower when told so.
4. Checks to see if the tower setup properly.
5. Still runs after a server restart.

Cons
1. If the turtle is floating in the air then the last check will report false even though the tower is setup properly.
2. Not much bug testing has been done.
3. What ever problems people find.

I am open to suggestions on how to make the program better. I already know fixes for all problems it has that I listed. I just haven't implemented them yet. If there are any problems or questions let me know.

Change-log

Version: 1.2
1. Changed the code to assess obstructions better. The turtle is aggressive to mobs and players now in order to push them out of its way.
2. Added a print out and a 5 second sleep when the turtle is getting its face when using the locate command. It should allow for players to move before getting attacked.

Version: 1.3
1. Changed the prompts so the turtle asks for items items before doing anything.
2. Fixed the turtle reporting false on final check if it was to be started in mid air or if the block was mined out from under it.
3. Fixed readout for the user when the turtle is about to get its face being only shown when the turtle is stuck.

Version 1.4
1. Added color to the readouts to make them easier to read.
2. Added a help command to use to get a little more info with entering the information.
3. Allowed for unlimited fuel to be enabled so it will not crash when seeing how much fuel it has.



To Do List
1. Change the prompt for fuel to be at the beginning so that when using a new turtle and using the locate command you do not need to manually add fuel.
2. May change the the prompts entirely
3. Add a help command to explain the program inside the turtle.
4. Redo the turtle returning to the ground so it wont report false on tower hosting when it is actually true.

Here is the link to the Source Code: http://pastebin.com/Zq7hsHp9

Notes
Add a tower only when needed. The turtle will get confused when there are too many towers within an area.
Modems have an varying range when its is clear or raining. More info about modems here

In all of the example commands it is shown to use tower <> <> <> <>. You can change that with what you name the program. If you do pastebin get Zq7hsHp9 GPSTower then the commands will be GPSTower <> <> <> <>. I have been using tower because that is what I named to program and based my examples on.
Edited on 08 July 2014 - 09:48 PM
theoriginalbit #2
Posted 26 June 2014 - 06:03 AM
Cons
1. The tower can be screwed up if a player gets in its way.
2. The turtle needs to move forward one to get its face when using a tower could get stuck if someone or a block is in front of it
These can be easily mitigated, turtle movement functions return whether the Turtle was able to move or not. This tutorial may be helpful to you, it covers a slightly different aim to what you're doing here, but how it does it should be useful…
bigbaddevil6 #3
Posted 26 June 2014 - 06:16 AM
Alright tomorrow I'll work on implementing those changes. It's late at the moment where I am.
bigbaddevil6 #4
Posted 27 June 2014 - 08:11 PM
Added a Change Log to the post and all future updates will be edited there. The link is updated with every release.
Suzuha #5
Posted 27 June 2014 - 11:24 PM
Nice work, this would be great for Server play.
bigbaddevil6 #6
Posted 28 June 2014 - 09:42 PM
Thanks. I been debating on what I could add to it to make it more… powerful for lack of a better word. I also thought about making turtle vendor that all you need to do is request a turtle the color you want it to be, and then enter in pastebin info to load the programs onto the computer. Still just a thought though.