Posted 05 December 2013 - 08:13 PM
Hello Everyone,
This is my first post on the forum and first time playing with cc. I dont have much, if any programming or scripting experience so this might be a simple question - or a funny monkey rigged concept. I'm trying to make a Redstone in motion mining well quarry with control via CC. I'm using the "carriage engine" as the pilot for platform and utilizing rs.setOutput give it a redstone pulse. One of the first real issues I've noticed was that Computers and Turtles reboot when moved. To over come this I came up with the idea of having a control computer on the ground somewhere -rednet.send to 4 wireless turtles sorrounding the carriage engine. I dont really know the range of the rednet signals?
I started looking for existing programs out there and found this:
http://pastebin.com/nTFx8ajQ
However its using rs.setBundledOutput and I did not know how to edit the program itself to send a msg to specified turtle to tell it to emit redstone puls. So I being the monkey rigger tried to have one computer run the quarry program and send the signals though MFR rednet cable to another computer that was open to wireless and had directions to send msg to right computer depending on color of bundled cable signal it received. The program I pieced together for this broadcaster:
(however I'm having issues keeping this program looping indefinetely so it can always broadcast when it recieves a redstone pulse)
The turtles have this program running:
and
Using this for thier Startup program:
I think the main problem right now is getting the broadcast computer to keep looping without getting the "Too long without yeilding"
Might be having an issue with the startup program on the frame computers.
Like I said before, I'm rather new to all this. Not sure what to make of it all but after messing around for some time I got a bit frustrated ;p
I saw another program on this forum that would save the blocks to move/direction in a file and would modify it every reboot. But I did not get that to work: Link Kept getting some 'nil' error.
Is this a viable way to do this? If so, how can I get this all to mesh together and work? Any input would be apprecieted. If you have a working program other than this I'd love to try to give it a go.
Thanks,
Arempi
This is my first post on the forum and first time playing with cc. I dont have much, if any programming or scripting experience so this might be a simple question - or a funny monkey rigged concept. I'm trying to make a Redstone in motion mining well quarry with control via CC. I'm using the "carriage engine" as the pilot for platform and utilizing rs.setOutput give it a redstone pulse. One of the first real issues I've noticed was that Computers and Turtles reboot when moved. To over come this I came up with the idea of having a control computer on the ground somewhere -rednet.send to 4 wireless turtles sorrounding the carriage engine. I dont really know the range of the rednet signals?
I started looking for existing programs out there and found this:
Spoiler
term.clear()
term.setCursorPos(1,1)
local first
local number
local notANumber
local counter
local current
local backToStartInput
backToStartInput = "no"
blue = "colors.green"
counter = 0
notANumber = false
first = true
firstbackToStart = true
function whatDirection()
while true do
term.clear()
term.setCursorPos(1,1)
if first == true then
first = false
print ("What direction do you want to go?")
print (" - up")
print (" - down")
print (" - north")
print (" - east")
print (" - south")
print (" - west")
directionInput = read ()
else
print ("Not a valid direction, please type a direction.")
print ("example: up")
print ("")
print ("What direction do you want to go?")
print (" - up")
print (" - down")
print (" - north")
print (" - east")
print (" - south")
print (" - west")
directionInput = read ()
end
if directionInput == "up" or directionInput == "down" or directionInput == "north" or directionInput == "north" or directionInput == "east" or directionInput == "south" or directionInput == "west" then
break
else
first = false
end
end
end
function backToStart()
while true do
term.clear()
term.setCursorPos(1,1)
if firstbackToStart == true then
firstbackToStart = false
print ("Would you like to move the quarry to original position after it's finished?")
print (" - yes")
print (" - no")
backToStartInput = read ()
else
print ("Please type yes or no")
print ("")
print ("Would you like to move the quarry to original position after it's finished?")
print (" - yes")
print (" - no")
backToStartInput = read ()
end
if backToStartInput == "yes" or backToStartInput == "no" then
break
else
firstbackToStart = false
end
end
end
function howMany()
while true do
term.clear()
term.setCursorPos(1,1)
if notANumber == true then
term.clear()
term.setCursorPos(1,1)
print ("'"..blocks.."' is not a number")
print ("")
print ("Direction: "..directionInput.."")
print ("")
print ("How many blocks?")
blocks = read()
else
print ("Direction: "..directionInput.."")
print ("")
print ("How many blocks?")
blocks = read()
end
blocks = tonumber(blocks)
if blocks then
notANumber = false
break --break out of while true loop
else notANumber = true
end
end
end
function moveQuarry()
--blue wire is north, signal 501
--purple wire is east, signal 502
--orange wire is south, signal 503
--yellow wire is west, signal 504
--white wire is up, signal 505
--red wire is down, signal 506
--green wire is block breakers, signal 507
if directionInput == "up" then
redstone.setBundledOutput("back",colors.white)
sleep(2)
redstone.setBundledOutput("back",0)
sleep(5)
redstone.setBundledOutput("back",colors.white)
sleep(2)
redstone.setBundledOutput("back",0)
sleep(5)
elseif directionInput == "down" then
redstone.setBundledOutput("back",colors.red)
sleep(2)
redstone.setBundledOutput("back",0)
sleep(5)
redstone.setBundledOutput("back",colors.red)
sleep(2)
redstone.setBundledOutput("back",0)
sleep(5)
elseif directionInput == "north" then
redstone.setBundledOutput("back",colors.blue)
sleep(2)
redstone.setBundledOutput("back",0)
sleep(5)
redstone.setBundledOutput("back",colors.blue)
sleep(2)
redstone.setBundledOutput("back",0)
sleep(5)
elseif directionInput == "east" then
redstone.setBundledOutput("back",colors.purple)
sleep(2)
redstone.setBundledOutput("back",0)
sleep(5)
redstone.setBundledOutput("back",colors.purple)
sleep(2)
redstone.setBundledOutput("back",0)
sleep(5)
elseif directionInput == "south" then
redstone.setBundledOutput("back",colors.orange)
sleep(2)
redstone.setBundledOutput("back",0)
sleep(5)
redstone.setBundledOutput("back",colors.orange)
sleep(2)
redstone.setBundledOutput("back",0)
sleep(5)
elseif directionInput == "west" then
redstone.setBundledOutput("back",colors.yellow)
sleep(2)
redstone.setBundledOutput("back",0)
sleep(5)
redstone.setBundledOutput("back",colors.yellow)
sleep(2)
redstone.setBundledOutput("back",0)
sleep(5)
end
end
function moveQuarryBack()
--blue wire is north, signal 501
--purple wire is east, signal 502
--orange wire is south, signal 503
--yellow wire is west, signal 504
--white wire is up, signal 505
--red wire is down, signal 506
--green wire is block breakers, signal 507
if directionInput == "up" then
directionInput = "down"
elseif directionInput == "down" then
directionInput = "up"
elseif directionInput == "north" then
directionInput = "south"
elseif directionInput == "east" then
directionInput = "east"
elseif directionInput == "south" then
directionInput = "north"
elseif directionInput == "west" then
directionInput = "east"
end
end
function moveFirst()
while true do
term.clear()
term.setCursorPos(1,1)
current = counter + 1
if counter == blocks then
if backToStartInput == "no" then
print("Complete. Exiting now")
sleep(1)
counter = 0
break
else
print("Complete. Now moving back")
sleep(1)
counter = 0
break
end
break
else
print("Quarry currently in operation, please monitor it's movement and if it gets stuck then hold down 'Ctrl + T' while in this window")
print("")
print ("Direction: "..directionInput.." Blocks: "..blocks.."")
if backToStartInput == "yes" then
print("Moving back to original position: Yes")
end
print("")
print ("Quarry moved "..current.." blocks")
redstone.setBundledOutput("back",colors.green)
sleep(1)
redstone.setBundledOutput("back",0)
moveQuarry()
counter = counter +1
end
end
end
function moveSecond()
moveQuarryBack()
while true do
term.clear()
term.setCursorPos(1,1)
current = counter + 1
if counter == blocks then
print("Complete. Exiting now")
sleep(5)
break
else
print("Quarry currently moving back to it's original position, please monitor it's movement and if it gets stuck then hold down 'Ctrl + T' while in this window")
print("")
print ("Direction: "..directionInput.." Blocks: "..blocks.."")
print ("Quarry moved "..current.." blocks")
redstone.setBundledOutput("back",colors.green)
sleep(1)
redstone.setBundledOutput("back",0)
moveQuarry()
counter = counter +1
end
end
end
whatDirection()
howMany()
backToStart()
moveFirst()
if backToStartInput == "yes" then
moveSecond()
end
http://pastebin.com/nTFx8ajQ
However its using rs.setBundledOutput and I did not know how to edit the program itself to send a msg to specified turtle to tell it to emit redstone puls. So I being the monkey rigger tried to have one computer run the quarry program and send the signals though MFR rednet cable to another computer that was open to wireless and had directions to send msg to right computer depending on color of bundled cable signal it received. The program I pieced together for this broadcaster:
rednet.open("right")
while true do
if (colors.test (rs.getBundledInput("left"), colors.blue)) then
rednet.send(4, "pulse")
end
if (colors.test (rs.getBundledInput("left"), colors.orange)) then
rednet.send(5, "pulse")
end
if (colors.test (rs.getBundledInput("left"), colors.purple)) then
rednet.send(6, "pulse")
end
if (colors.test (rs.getBundledInput("left"), colors.yellow)) then
rednet.send(2, "pulse")
end
end
http://pastebin.com/j7a54102(however I'm having issues keeping this program looping indefinetely so it can always broadcast when it recieves a redstone pulse)
The turtles have this program running:
rednet.open("right")
while true do
id,message = rednet.receive()
if id == 3 then
if message == "pulse" then
rs.setOutput("front", true)
end
end
end
http://pastebin.com/UDjmKyRZand
Using this for thier Startup program:
sleep(1)
shell.run("wireless")
http://pastebin.com/KJU5mBtVI think the main problem right now is getting the broadcast computer to keep looping without getting the "Too long without yeilding"
Might be having an issue with the startup program on the frame computers.
Like I said before, I'm rather new to all this. Not sure what to make of it all but after messing around for some time I got a bit frustrated ;p
I saw another program on this forum that would save the blocks to move/direction in a file and would modify it every reboot. But I did not get that to work: Link Kept getting some 'nil' error.
Is this a viable way to do this? If so, how can I get this all to mesh together and work? Any input would be apprecieted. If you have a working program other than this I'd love to try to give it a go.
Thanks,
Arempi