Posted 15 November 2012 - 06:15 PM
It is a simple program that should be placed to disk in "disk/startup" directory.
It does two things - copies contents of "install" directory on floppy to root directory of computer/turtle, and sets label to whatever is in "disk/label", incrementing numeral inside. So, if you have "T-1000" in "label", then first nameless turtle you place near it will have label "T-1000", second "T-1001", etc, and all will have same programs installed.
Computers with labels will keep label and programs even after picking up, but will no longer stack.
Pastebin: http://pastebin.com/VuQuMF0V
Code:
Btw, if you want to remove label to many computers (turtles) and don't want to type "label clear" by hand for each, you can use a floppy with "os.setComputerLabel()" indisk/startup
It does two things - copies contents of "install" directory on floppy to root directory of computer/turtle, and sets label to whatever is in "disk/label", incrementing numeral inside. So, if you have "T-1000" in "label", then first nameless turtle you place near it will have label "T-1000", second "T-1001", etc, and all will have same programs installed.
Computers with labels will keep label and programs even after picking up, but will no longer stack.
Pastebin: http://pastebin.com/VuQuMF0V
Code:
if shell.getRunningProgram() == "disk/startup" then
print("Installing...")
if fs.isDir("disk/install") then
local files = fs.list("disk/install")
for _,file in ipairs( files ) do
print("disk/install/"..file.." -> "..file)
fs.delete(file)
fs.copy("disk/install/"..file,file)
end
else
print "No files to install. Put install files to directory 'disk/install'"
end
if not os.getComputerLabel("label") then
labelFile = fs.open("disk/label", "r")
if labelFile then
label = labelFile.readAll()
labelFile.close()
os.setComputerLabel(label)
label = string.gsub(label, '[0-9]+', function (x) return x+1 end)
labelFile = fs.open("disk/label", "w")
labelFile.write(label)
labelFile.close()
print("Set label to " .. label)
else
print "No label file. Put label to file 'disk/label'nIt should contain number, that will be incremented each time"
end
end
print("Done!")
else
print "Place a disk drive with floppy near computer and copy this program to disk/startup"
end
Btw, if you want to remove label to many computers (turtles) and don't want to type "label clear" by hand for each, you can use a floppy with "os.setComputerLabel()" indisk/startup