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

Turtle bombers, ready for take off!

Started by Keaton, 02 August 2012 - 05:03 AM
Keaton #1
Posted 02 August 2012 - 07:03 AM
Well hello there~

my first REAL attempt at anything lua/turtle related and this is what i came up with, or rather what one of my friends requested i try to figure out.

So, basically its a nice little program that tell the turtle how high to to drop the tnt or other bombs of your choosing, then how far to go, and how often to drop them, and of course to come back and await you next evil bombing orders.

it looks a little something like this : [media]http://www.youtube.com/watch?v=qXLf3Oc_RrA&feature=plcp[/media]

Here is what i had on the floppy disk as the startup program :


fs.copy("disk/bombs","bombs")
rednet.open("right")
print("Ready to Go ")
turtle.forward()
shell.run("bombs")

so nothing too bad or hard there right?

well here is the other program on the disk referred to as "bombs" :


turtle.forward()
turtle.turnRight()

x = 10 so this is the part in the video as im sure you can tell were the cute little turtles turn and go right forming their little line~
while x > 0 do
turtle.forward()
x = x-1
end

turtle.turnLeft() facing forwards once again, always an important step, getting ready for lift off
turtle.select(1)
rs.setOutput("bottom", true)

sleep(20) this is here to provide ample setup time for explosive insertion into the first inventory spot of the turtles

x = 25 change this number to change how many blocks high they go, thats really all it does, for bigger explosions, higher is better to keep them nice and safe
while x > 0 do
turtle.up()
x = x-1
end

x = 25 this part is how far forward they go before starting the bomb dropping, again change just this number to change that
while x > 0 do
turtle.forward()
x = x-1
end

x = 10 ok so this is the part were since i am new to this, i just had to do it the only way i could find that worked, so bascally, they will go 40 spaces
while x > 0 do
turtle.forward() 10 cycles of the 4 forwards, and a drop
turtle.forward()
turtle.forward()
turtle.forward()
turtle.placeDown()
x = x-1
end

turtle.turnRight() turning aroundddddd
turtle.turnRight()

x = 66 aaaaaaaaaaaaaand on their way back, i arrived at this number by counting the 40 spaces in the drop sequence, the 25 forward at the beginning(1at start)
while x > 0 do 40 +25+1 = 66 so they should come all the way back
turtle.forward()
x = x-1
end

turtle.turnLeft() turn back around facing outwards
turtle.turnLeft()

x = 25 and coming back down to the starting positions of them
while x > 0 do
turtle.down()
x = x-1
end

all done, nothing too bad i hope, suggestions and any great tutorial links would be awsome
also i thought that may a bit hard to read or copy so ill just make a file here with a text file with it all too~
D3matt #2
Posted 02 August 2012 - 05:21 PM
Cool. But I've always wanted one that would allow me to specify GPS coordinates for the target, maybe for v2.0? Also maybe spreading them out a bit more so they cover a wider area, and waiting for a rednet signal to start?

Looks like you've done, ahem, extensive testing on that village.
Keaton #3
Posted 02 August 2012 - 07:04 PM
Ya a gps would be nice, I am not sure how to though, also rednet is something i haven't yet learned to play with. The covering a wider area part would probably be much easier with the rednet signal. If you know of any tutorials on that sort of thing that would be awesome, thanks for commenting
Sammich Lord #4
Posted 02 August 2012 - 07:31 PM
Ya a gps would be nice, I am not sure how to though, also rednet is something i haven't yet learned to play with. The covering a wider area part would probably be much easier with the rednet signal. If you know of any tutorials on that sort of thing that would be awesome, thanks for commenting
As for the GPS that would take some math to do. I think there is some programs that do that be I am not completely sure. As for rednet it is very easy to learn. Just sit down read through the API and look on the forums for programs that use it. I have made a few turtle bombers on a server I play on. I was thinking about making something like this that would have a main computer with a GUI that would set up like 5 turtles and tell them the X Y Z location to goto. But so far your program is nice but possibly add the feature to have a input to tell them how high to go?
BigSHinyToys #5
Posted 02 August 2012 - 07:43 PM
As for the GPS that would take some math to do. I think there is some programs that do that be I am not completely sure. As for rednet it is very easy to learn. Just sit down read through the API and look on the forums for programs that use it. I have made a few turtle bombers on a server I play on. I was thinking about making something like this that would have a main computer with a GUI that would set up like 5 turtles and tell them the X Y Z location to goto. But so far your program is nice but possibly add the feature to have a input to tell them how high to go?
GPS is simple. place four computers run this as "startup"

shell.run("gps","host",x,y,z)
replace x y and z with the numbers you want.

after that any turtle in range of all four can gets its pos with
gps.locate( 2, true )

Not that hard dan200 did all the spherical trigonometry
Keaton #6
Posted 02 August 2012 - 10:52 PM
Thank you for the help, but i am still a bit confused. I do not know what to put in the xyz and am not sure how to use this program to specify a location for them to go to. Thank you for your help, i am still new and do not know much.
ChunLing #7
Posted 03 August 2012 - 06:54 AM
Setting up the GPS is very simple, you just have to make sure that you input consistent values for the xyz coordinates of the modems attached to the GPS host computers.

The GPS api is a single command, gps.locate(timeout, debug), which takes a number (seconds to spend looking for GPS host signals) and a boolean (for debug information) and returns current xyz coordinates. Usually, people use the gps.locate command only a couple of times to establish the current location and direction of a turtle, then use 'inertial' guidance ("while not turtle.forward do something end' things) to track location, since getting a good GPS signal takes a few seconds. You don't want to use it every time you move, at least.
Keaton #8
Posted 03 August 2012 - 07:26 AM
Thank you for your help, tho i'm afraid that went completely over my head because i am sadly, as it says… clueless.
BigSHinyToys #9
Posted 03 August 2012 - 08:45 AM
This may help you visualize how it works
BigSHinyToys #10
Posted 03 August 2012 - 09:41 AM
I just made a tutorial for GPS this might be helpful
[How to guide] GPS Global Position System
Keaton #11
Posted 03 August 2012 - 04:02 PM
Oh, wow. Thank you so much for helping me, this tutorial should help a lot.
tactical_troll #12
Posted 15 August 2012 - 02:32 AM
cool
basdxz #13
Posted 15 August 2012 - 07:11 PM
Waiting for the GPS version.
KaoS #14
Posted 18 September 2012 - 02:18 PM
haha, you remind me of my starting days of CC, I lan my bros all the time, I set up turtles that were pre-programmed to go to each brother's base and drop 5 nukes, they just waited for redstone signal to go, tells you something when the first application you think of is a nuke launcher :)/>/>