Jump to content




Help


4 replies to this topic

#1 Amokaci

  • Members
  • 5 posts

Posted 08 April 2013 - 06:58 AM

Hello i am a beginner in [LUA]

i hope the community can help me

i foun a very good script it is from Jaffa
(Jaffa's attack turtle program
-- Version: 1.0.1.0)

and i wanna change it a little bit that i can use it for a Mining Turtle to make a auto cobblestonegenerator (with a filter in the back of the turtle and both are connected with 2x jacketwire)

all functions work only check () doesent work

i try to say the turtle every time u get in slot 1 64 cobble stone send a redstone signal to the Filter the the filter suck 64 cobble to the chest (barrel)
i have change many but still not work i hope u all can help me.

Code:
Spoiler

Sorry when i missed something i am really a beginner

#2 JokerRH

  • Members
  • 147 posts

Posted 08 April 2013 - 08:21 AM

for i = 16, 1, -1 do
  turtle.select(i)
end
if you want to decrement write a -1 to the for loop and a turtle only has 16 slots (If i recall correct)
But why do you make it so complicated?

turtle.select(1)
while true do
  for i = 1, 64 do
    turtle.dig()
    sleep(1.5)
  end

  rs.setOutput("back", true) --"back" or whereever you have your jackedet wire
  sleep(0.2)
  rs.setOutput("back", false)
end


#3 Amokaci

  • Members
  • 5 posts

Posted 08 April 2013 - 08:44 AM

sry when i write it wrong

i mean every time the turtle get 64 cobble in slot 1 he send only 1 signal to the filter that he can suck the 64 cobble out

and when he get another 64 cobble then again send a only 1 redstone signal to the filter

sry my english is not the best i learnd it for 2 years ;)

#4 QuantumGrav

  • Members
  • 36 posts
  • LocationUnited States

Posted 08 April 2013 - 04:02 PM

The code could look like:

turtle.select(1)
while true do
turtle.dig()
if turtle.getItemCount(1) == 64 then
rs.setOutput("back", true)
sleep(0.1)
rs.setOutput("back", false)
end
end

(Sorry for no code block. I'm working from a mobile.)

That should do what you would like!

I don't know if turtles can drop stuff to a barrel, but if they can, you could just change the barrel to below the turtle, then, instead of the setOuputs and sleep, just put 'turtle.dropDown()'. That would prevent having to use the filter and make the code a tad bit more efficient.

Hope that helps!

#5 Amokaci

  • Members
  • 5 posts

Posted 09 April 2013 - 12:53 AM

thank you for the help now it works perfect

great community





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users