i want my mining turtle to place a block when it receive a redstone signal. and destroy that block when i get the redstone signal off. because i don't want always the whole applied energestic network to connect. so 1 cable need to be mined and placed when i wanted too.
Destroy And Place Block With Redstone Signal
Started by thijs1444, Aug 15 2013 03:14 AM
5 replies to this topic
#1
Posted 15 August 2013 - 03:14 AM
#2
Posted 15 August 2013 - 01:57 PM
Split into new topic.
Why not just use one of the AE dark cables, which break the network at that cable when they receive a redstone signal? I mean, you could use a quick script to do it, but using the dark cables seems much easier in this case.
Why not just use one of the AE dark cables, which break the network at that cable when they receive a redstone signal? I mean, you could use a quick script to do it, but using the dark cables seems much easier in this case.
#3
Posted 16 August 2013 - 12:53 AM
thx for your answer. didn't know that cable exist. but turtles are still cooler:P how can i close the topic? or am i not able to do that?
#4
Posted 16 August 2013 - 01:35 AM
hi thijs,
not tested but sth like this should work.
not tested but sth like this should work.
local status = true
while true do
mysignal = redstone.getInput("back") --checks redstone signal at the back
if mysignal == true and status == true then --if signal true and status true digs the cable (status true is just to make sure he is not digging whole time)
turtle.dig() --dig the cable in front
status = false --set status to false means network is off
elseif mysignal == false and status == false then -- if no redstone signal and network is off
turtle.select(1) -- select slot with the cable
turtle.place() --place the cable
status = true --remember that system is on now.
end -- end if
sleep(1) --sleep 1 second
end --end while
Edited by LordIkol, 16 August 2013 - 01:55 AM.
#5
Posted 16 August 2013 - 01:45 AM
LordIkol, on 16 August 2013 - 01:35 AM, said:
not tested but sth like this should work.
local status == true
A slightly improved version of the above (better for servers as the computer doesn't run every second, and only when it is needed ... also no bug
local status = true
turtle.select(1)
while true do
os.pullEvent("redstone") --# wait until there is a change in redstone! Instead of sleeping
rsSignal = rs.getInput("back")
if rsSignal and status then
turtle.dig()
status = false
elseif not (rsSignal and status) then
turtle.place()
status = true
end
end
Another way I'd do it...
turtle.select(1)
while true do
os.pullEvent("redstone")
local rsInput = rs.getInput("back")
if rsInput and turtle.detect() then
turtle.dig()
elseif not (rsInput and turtle.detect()) then
turtle.place()
end
end
#6
Posted 16 August 2013 - 02:01 AM
corrected my mistake,
and yes, waiting for redstone event is much better cause then you don't need the state part.
i always forget that os.pullEvent for redstone thing
thanks bit you are the master
and yes, waiting for redstone event is much better cause then you don't need the state part.
i always forget that os.pullEvent for redstone thing
thanks bit you are the master
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











