Posted 30 November 2012 - 07:21 AM
I use mining turtles instead of a quarry and was wondering if there was any way to get it to display to a monitor when it is done so i can go start it again
local tArgs={...}
local mon
local function findMonitor()
for i,v in pairs(rs.getSides()) do
if peripheral.getType(v) == "monitor" then
mon = peripheral.wrap(v)
return
end
end
error("No monitor found!")
end
shell.run("excavate", unpack(tArgs) )
findMonitor()
mon.write("Done digging!")
so i would just put a monitor next to where the turtle starts and run excavate?Sure you can, if you let the turtle stop next to a monitor. Are you using excavate for this? If so, try something like this:local tArgs={...} local mon local function findMonitor() for i,v in pairs(rs.getSides()) do if peripheral.getType(v) == "monitor" then mon = peripheral.wrap(v) return end end error("No monitor found!") end shell.run("excavate", unpack(tArgs) ) findMonitor() mon.write("Done digging!")
Just run it like you'd run excavate.
Indeed, if the monitor is next to the spot where the turtle finishes (this is the same spot where it starts), the turtle will find the monitor and display "Done digging!" on it.so i would just put a monitor next to where the turtle starts and run excavate?Sure you can, if you let the turtle stop next to a monitor. Are you using excavate for this? If so, try something like this:local tArgs={...} local mon local function findMonitor() for i,v in pairs(rs.getSides()) do if peripheral.getType(v) == "monitor" then mon = peripheral.wrap(v) return end end error("No monitor found!") end shell.run("excavate", unpack(tArgs) ) findMonitor() mon.write("Done digging!")
Just run it like you'd run excavate.
i wanted it to display in my house, which is quite far from where the turtle finihes, so maybe having it turn on a redstone signal and hooking up some lights as an indicator wood work, how would i do that?Indeed, if the monitor is next to the spot where the turtle finishes (this is the same spot where it starts), the turtle will find the monitor and display "Done digging!" on it.so i would just put a monitor next to where the turtle starts and run excavate?Sure you can, if you let the turtle stop next to a monitor. Are you using excavate for this? If so, try something like this:local tArgs={...} local mon local function findMonitor() for i,v in pairs(rs.getSides()) do if peripheral.getType(v) == "monitor" then mon = peripheral.wrap(v) return end end error("No monitor found!") end shell.run("excavate", unpack(tArgs) ) findMonitor() mon.write("Done digging!")
Just run it like you'd run excavate.
rs.setOutput('left',true)
I'm not sure if you know this, but 'left' is the side of where the redstone is placed. This can be 'left','right','front','back','top' and 'bottom'.
local server_id = 123
rednet.open('right')
rednet.send(server_id, "done_mining")
rednet.close('right')
rednet.open('top') -- change with the side of the modem
local mon
local function findMonitor()
for i,v in pairs(rs.getSides()) do
if peripheral.getType(v) == "monitor" then
mon = peripheral.wrap(v)
return
end
end
error("No monitor found!")
end
findMonitor()
mon.setTextScale(3) -- might want to change this
while true do
local id,msg,dist = rednet.receive()
if msg == 'done_digging' then
mon.write("Done digging!")
print("Press a key to reset...")
os.pullEvent('key')
mon.clear()
mon.setCursorPos(1,1)
end
end
alright, thanks :D/>You could either hook up redstone next to where the turtle starts and put these lines instead of 'mon.write …':I'm not sure if you know this, but 'left' is the side of where the redstone is placed. This can be 'left','right','front','back','top' and 'bottom'.rs.setOutput('left',true)
Or else, you could use a wireless turtle and send a signal over rednet to indicate that the turtle is done. A very basic implementation would use this as the last line:local server_id = 123 rednet.open('right') rednet.send(server_id, "done_mining") rednet.close('right')
Then you'd place a computer next to a monitor in your base (within range of rednet, 64 blocks is a safe distance). You run the 'id' command on that computer to get the server_id variable that you need to change in the turtle program. Then on the computer in your base, make a program like this:rednet.open('top') -- change with the side of the modem local mon local function findMonitor() for i,v in pairs(rs.getSides()) do if peripheral.getType(v) == "monitor" then mon = peripheral.wrap(v) return end end error("No monitor found!") end findMonitor() mon.setTextScale(3) -- might want to change this while true do local id,msg,dist = rednet.receive() if msg == 'done_digging' then mon.write("Done digging!") print("Press a key to reset...") os.pullEvent('key') mon.clear() mon.setCursorPos(1,1) end end