33 posts
Posted 17 September 2012 - 09:33 PM
Im trying to make a program that allows you to make a user, which writes it to a floppy disk in any drive around the computer. Is there any way to make the program detect a disk drive with a floppy in it and a program on it named "Users", thus allowing it to write to that program and disk.eject("driveSide")? I hope that made sense.
1604 posts
Posted 17 September 2012 - 09:54 PM
You can loop through all the sides and check if there's a disk drive, and if there's one use it:
local driveSide
for _, side in ipairs(rs.getSides()) do
if peripheral.isPresent(side) and peripheral.getType(side) == "drive" then
driveSide = side
break
end
end
if driveSide then
-- do stuff with the disk drive
else
error("No disk drive found.")
end
33 posts
Posted 17 September 2012 - 09:57 PM
Thank you so much this worked perfect!
1 posts
Location
Turkey
Posted 22 September 2013 - 05:34 PM
Or you can do;
event, side = os.pullEvent("side")
print"Waiting for audio disk..."
if event ~= nil then
print"Audio Disk Detected!"
print"Playing Disk..."
disk.playAudio(side)
end
8543 posts
Posted 22 September 2013 - 08:01 PM
If you're going to bring a topic back from the dead, at least reply with some code that actually works.
Locked.