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

Ultra's simple programs.

Started by ultraboomer, 21 September 2012 - 07:51 PM
ultraboomer #1
Posted 21 September 2012 - 09:51 PM
Simple mineshaft

there are probably a bunch of other programs just like this one, but this is my take on it.

It's a simple 2 high mineshaft miner that returns to it's point of origin and drops off to a chest on the left.

it places torches to stop mobs every 6 blocks.

it's here on pastebin : http://pastebin.com/8gWDZ7tu

as I said, nothing unique, just my version.

torches must be placed into the first slot, and a chest on the left of it's starting position.

It also cannot account for falling gravel, because while i tried to do this, it would not work. Still gonna keep trying. It will work through falling gravel, but it will mess up the count on how many blocks it has moved, and as such, where it will return to.



Simple farm

This farm simply goes in a line the distance you tell it to, and makes a farm along the way. It will not turn no matter how far it goes. And it uses the same code as my mineshaft for remembering how far to move, so be careful not to let it run into anything. It will deposit into a chest behind it's start position. It will not, for some reason, place the seeds it gathers into the seeds it uses to plant.

It even comes with a built in bonemeal mode.

If you do not enter bonemeal mode, when it reaches the end it will say do not disturb. Don't. It will sit there and wait for 20 minutes then harvest whatever grew. In bonemeal mode,it will not unload extra bonemeal but without it will of course still unload the slot bonemeal goes in. Interesting bug about bonemeal mode i can't seem to fix, it goes one further than you tell it to. And wastes a bonemeal if it's over grass. Just place cobble or water there to fix that.

Here it is on pastebin: http://pastebin.com/P5fGvPWz


ultra's not-so-simple staircase

I'm working on a program that will create a staircase going up or down, and will only use time trying to break stuff if you tell it there is stuff to break. however, it's not going so well. my if then statement won;t recognise that i put a then there.

here it is on pastebin if anyone is feeling generous enough to tell me what's wrong: http://pastebin.com/kd8CQ4Th
GeorgeK #2
Posted 22 September 2012 - 04:30 PM
it has no protocol to refuel itself. though, I did try to make it so it wouldn't move if it didn't have enough fuel for both ways. don't suppose anyone could tell me why it's not working? http://pastebin.com/TT2ppasL

You just forgot an end there ;p


if turtle.getFuelLevel()<x*2 then
  print("not enough fuel, will not run")
  x = 0
end //add this

Cheers,
George
ultraboomer #3
Posted 23 September 2012 - 12:11 AM
Thanks, i'm a major noob to programming of any kind. But i am learning. Thanks for the help. updating main post.
drysdan #4
Posted 26 October 2013 - 11:17 PM
I know this post is kinda old, but the program is nice. I'd like to amend the farm program so that it repeats itself, either indefinitely or a specified number of cycles. I have no idea how to do that, though. Anybody with some expertise wanna help out?
Gone #5
Posted 27 October 2013 - 07:54 PM
Edited on 04 January 2017 - 01:08 AM
drysdan #6
Posted 29 October 2013 - 01:55 PM
You can make the turtle turnLeft (or Right), forward twice, and then turnLeft (or Right) again. After that, you can tell it to repeat the placing program (x) again. Make sure to clear it with the creator, though, because sometimes programmers don't want their code modified :)/> .

Hoped this helped!

Thanks. That's kinda what I want it to do? It works perfectly now, I just want it to repeat the cycle without further input. Not a clue how to code that in, though. Like to basically have it start, ask the distance I want it to farm (which it currently does) and then just keep repeating the current code indefinitely. It already farms out the line, then returns to the start as it harvests, and turns back around to face the line farm again. I just don't know how to tell it to keep doing what it's doing, without requiring me to re-run the program.

Edit: Nevermind, I dove in and figured it out. I rewrote it without the bonemeal mode, and just used a 'while true do' statement to keep it cycling.