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

Can Someone Make A Couple Scripts?

Started by unstopablekk, 26 February 2012 - 02:23 PM
unstopablekk #1
Posted 26 February 2012 - 03:23 PM
Questions
1.Can someone make a script for me that fills in holes in the ground after an explosion? ex: "ohh no! Creeper!" or Can someone edit my code so it does so? (so far it fills the hole in but turns when a block in front of it is detected so i just make a barrier and square off the hole)


Code for Question 1. : the script is called "fix" (without "" and all lowercase) if you guys need it for the code.


while turtle.forward() do
turtle.placeDown()
end
if turtle.detect() then
turtle.turnRight()
turtle.forward()
turtle.placeDown()
turtle.turnRight()
end
while turtle.forward() do
turtle.placeDown()
end
unstopablekk #2
Posted 26 February 2012 - 03:24 PM
2. Can someone make a script or is there already a script to where your turtle will follow you on command?
If so can I have the link, If not can someone make it if it is indeed possible?
rockymc #3
Posted 26 February 2012 - 04:01 PM
2. Can someone make a script or is there already a script to where your turtle will follow you on command?
If so can I have the link, If not can someone make it if it is indeed possible?

You mean like a remote wireless controller?
6677 #4
Posted 26 February 2012 - 04:03 PM
2. Can someone make a script or is there already a script to where your turtle will follow you on command?
If so can I have the link, If not can someone make it if it is indeed possible?
not possible for it to automatically follow you, sorry. they don't know where you are or where they are. Can remote control them though, look in the program library
Liraal #5
Posted 26 February 2012 - 04:07 PM
they may know where they are, just use my API with them
Sebra #6
Posted 26 February 2012 - 04:09 PM
1.Turtles are blind now ;)/>/>
2.Remote control works from other comp only and not so useful :(/>/>
3.Almost all, turtle can do now effectively is eating the land :(/>/>
6677 #7
Posted 26 February 2012 - 04:33 PM
1.Turtles are blind now ;)/>/>
2.Remote control works from other comp only and not so useful :(/>/>
3.Almost all, turtle can do now effectively is eating the land :(/>/>
Build a house with one.
Sebra #8
Posted 26 February 2012 - 04:40 PM
It is easier to do without turtle.
It cannot see, which block to place.
Liraal #9
Posted 26 February 2012 - 04:40 PM
1.Turtles are blind now ;)/>/>
2.Remote control works from other comp only and not so useful :(/>/>
3.Almost all, turtle can do now effectively is eating the land :(/>/>

I disagree, check out my API.
6677 #10
Posted 26 February 2012 - 04:44 PM
It is easier to do without turtle.
It cannot see, which block to place.
its more fun and challenging with a turtle.
If you fill its inventory in the correct pattern you can use turtle.select(num) to select a specific inventory slot for it to place.


You can also autoharvest wheat farms and tree farms etc. Theres alot to do with them.
Automatically dig rail tunnels etc.
Sebra #11
Posted 26 February 2012 - 04:50 PM
Oh yes. Find and cut all logs of a tree is an interesting task.
Tunnels and build patterns are blind tasks.
rowantwig #12
Posted 26 February 2012 - 07:15 PM
Here, for question #1. Place the turtle so it faces the leftmost part of the hole, give it a bunch of dirt, put this program in a file, and run the file.
It "feels" it's way around the hole (no pun intended) so it figures out the size of it, so you don't need to input anything or wall it off or such.
If there's some nearby cavity it's not supposed to fill (like a moat or a cliff) you might need to wall that off, though.
If it misses part of the hole, either fill it in manually or re-position the turtle and run the program again.

-- Select the first non-empty slot in the inventory.
function selectBlock()
for i=1, 9 do
  if turtle.getItemCount(i) ~= 0 then
   turtle.select(i)
   break
  end
end
end
-- Fill all blocks below the turtle.
-- Returns true if at least one block was filled, false otherwise.
function fillColumn()
local depth = 0
while turtle.down() do
  depth = depth+1
end
if depth == 0 then
  return false
end
for i=1, depth do
  turtle.up()
  selectBlock()
  turtle.placeDown()
end
return true
end
-- Fill a line of columns.
-- Returns true if at least one column was filled, false otherwise.
function fillLine()
local patience = 8
local filledAny = false
while patience > 0 do
  patience = patience-1
  if fillColumn() then
   filledAny = true
   patience = 3
  end
  turtle.forward()
end
return filledAny
end
-- Fill a line of lines, a.k.a. a grid.
function fillGrid()
local goingBack = false
while fillLine() do
  if goingBack then
   turtle.turnLeft()
   turtle.forward()
   turtle.turnLeft()
  else
   turtle.turnRight()
   turtle.forward()
   turtle.turnRight()
  end
  goingBack = not goingBack
end
end
-- Run program.
fillGrid()
unstopablekk #13
Posted 26 February 2012 - 08:08 PM
Thanks ill just copy and paste to notepad++ lol
Do you guys know of any good os for computercraft? I tried wolfos but it doesnt let me edit any of my files for my turtle and is almost impossible to find the files on the computer ;)/>/>
Liraal #14
Posted 26 February 2012 - 08:11 PM
Suppose you should use Mysticos or RedWorks. I'm making an Os right now as well, but it won't be ready for quite some time.
unstopablekk #15
Posted 26 February 2012 - 08:14 PM
which do you think is user friendly because i have a server with computercraft and my friends join but im the only one that knows how to script. I want them to have fun but I want to have the standard computer as well (i dont want it for all the computers, because a turtle is classified as a turtle and i cant do script writing)?
Liraal #16
Posted 26 February 2012 - 08:17 PM
I suppose it's RedWorks then. Besides, it's a more major project with more features.