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

Redstone Copy Machine

Started by Etcetera, 29 March 2012 - 10:02 PM
Etcetera #1
Posted 30 March 2012 - 12:02 AM
Hello, I need a program that will receive a redstone signal and copies a selected program to a disk, and do this all over again, can you help me?
Advert #2
Posted 30 March 2012 - 12:10 AM
This is not a request forum; you might get a response, however, but I wouldn't count on it.
Etcetera #3
Posted 30 March 2012 - 12:13 AM
This is not a request forum; you might get a response, however, but I wouldn't count on it.

I know Advert, I know how to do the redstone code, I just need help with the program copy and paste part

P.S. FuzzyPurp told me to post it here
Advert #4
Posted 30 March 2012 - 12:17 AM
This is not a request forum; you might get a response, however, but I wouldn't count on it.

I know Advert, I know how to do the redstone code, I just need help with the program copy and paste part

P.S. FuzzyPurp told me to post it here

You'd have some more luck reading the stickies/announcements then :o/>/>
Luanub #5
Posted 30 March 2012 - 09:39 AM
Get some code going, once you're stuck and can't get it to work post it and we'll see what we can do to help. :o/>/>
Etcetera #6
Posted 30 March 2012 - 09:51 PM
Get some code going, once you're stuck and can't get it to work post it and we'll see what we can do to help. :o/>/>

That's the problem, I'm such a n00b with Lua, and couldn't make this program all by myself, even to save my life… :o/>/>
Etcetera #7
Posted 30 March 2012 - 10:04 PM
Ok, this was my third attempt at programming it myself…
I'm pretty sure I suck big time at Lua…


while true do
rs.setOutput("bottom", true )
sleep(1)
rs.setOutput("bottom", false )
fs.copy("Meh", "disk/")
end

"Meh" is just a test file
Dirkus7 #8
Posted 08 April 2012 - 08:39 PM
Try this:

while true do
os.pullEvent('redstone')
if rs.getInput('right') then –change right to whatever side you want
fs.copy('thisfile', 'disk/thatfile')
end
end

I didn't test this because i'm on my phone but i think it should work :P/>/>
Wolvan #9
Posted 09 April 2012 - 12:16 PM
Wait I create a modified Version of my mass disk burner

path1 = "disk"
program = ""
name = ""
lab = ""
nr = 0
width, height = term.getSize()
hw = math.ceil(width/2)
hh = math.ceil(height/2)
-- Initialize
shell.run("clear")
term.setCursorPos(hw - 9, 1)
print("+----------------+")
term.setCursorPos(hw - 9, 2)
print("|Mass-Disk-Burner|")
term.setCursorPos(hw - 9, 3)
print("|   By Wolvan	|")
term.setCursorPos(hw - 9, 4)
print("+----------------+")
print("")
print("Please enter the program you want to burn")
write("From: ")
program = read()
print("Please enter the file on the disk")
write("To: ")
name = read()
print("Please enter the label name")
write("Label: ")
lab = read()
shell.run("clear")
print("Waiting for redstone signal...")
print("Press [Q] to exit")
-- Waiting for disk/Burn disk
while true do
	event, p1 = os.pullEvent()
		if event == "redstone" then
		shell.run("clear")
		print("Disk found! Starting process")
		nr = (nr + 1)
		path1 = disk.getMountPath(p1)
		print("Deleting old versions...")
		fs.delete(path1.."/"..name)
		print("Burning Disk...")
		fs.copy(program, path1.."/"..name)
		print("Labeling disk...")
		disk.setLabel(p1, lab)
		print("Disk Nr."..nr.." burned")
		print("")
		print("Waiting for redstone signal...")
		print("Press [Q] to exit")
		disk.eject(p1)
		elseif event == "key" then
			if p1 == 16 then
			print("Stopping Mass-Disk-Burner by Wolvan - Modification forhammersamerton")
			sleep(2)
			os.reboot()
			end
		end
end