Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :COMPUTERCRAFT COBBLEGEN DISK CODE:
- :disk/startup:
- shell.run("clear")
- OS = string.sub(os.version(),1,1)
- print("CobbleGenInstaller for " .. os.version())
- print("Press enter to start program")
- read("")
- if OS == "C" then
- print("CraftOS detected")
- if fs.exists("turtleperc") then
- fs.delete("turtleperc")
- end
- if fs.exists("startup") then
- fs.delete("startup")
- end
- if fs.exists("help") then
- fs.delete("help")
- end
- if fs.exists("turtletotal") then
- fs.delete("turtletotal")
- end
- fs.copy("disk/craftos/total","turtletotal")
- fs.copy("disk/craftos/startup","startup")
- fs.copy("disk/craftos/perc","turtleperc")
- fs.copy("disk/craftos/help","help")
- print("Install complete. Remove disk and reboot.")
- print("Press enter to reboot")
- read("")
- os.reboot()
- end
- if OS == "T" then
- print("TurtleOS detected")
- if fs.exists("run") then
- fs.delete("run")
- end
- if fs.exists("startup") then
- fs.delete("startup")
- end
- if fs.exists("help") then
- fs.delete("help")
- end
- fs.copy("disk/turtleos/startup","startup")
- fs.copy("disk/turtleos/run","run")
- fs.copy("disk/turtleos/help","help")
- print("Install complete. Remove disk and press enter to reboot")
- read("")
- os.reboot()
- end
- :disk/turtleos/startup:
- shell.run("clear")
- print("TurtleOS: CobbleGen installed")
- print("Turtle ID: " .. os.computerID())
- if peripheral.getType("top") ~= "monitor" then
- print("Please attach a monitor above the turtle and press enter.")
- read("")
- os.reboot()
- end
- MonX, MonY = peripheral.call("top","getSize")
- if (MonX < 17) or (MonY < 11) then
- print("The recommended monitor size is 2x2 blocks")
- end
- if peripheral.getType("right") ~= "modem" then
- print("This software is only compatible with wireless mining turtles.")
- print("Shutting down in 10 seconds")
- sleep(10)
- os.shutdown()
- end
- print("")
- print("Programs available:")
- print("Run - Begin mining cobblestone from a generator.")
- print("Help - View information on setting up")
- :disk/turtleos/run/:
- SLOT = 1
- TOTAL = 1
- term.clear()
- term.setCursorPos(1,1)
- print("Enter Computer ID:")
- PC = tonumber(read())
- ID = os.computerID()
- rednet.open("right")
- top = peripheral.wrap("top")
- top.setTextScale(1)
- while true do
- while SLOT <= 9 do
- TOTAL = 0
- top.clear()
- top.setCursorPos(1,1)
- top.write("TURTLE " .. ID .. " STATUS:")
- for I = 1,9 do
- top.setCursorPos(1,(I + 1))
- top.write("Slot ")
- top.write(tostring(math.floor(I)))
- top.write(": ")
- if turtle.getItemCount(I) >= 64 then
- top.write("FULL")
- else
- top.write(tostring(math.floor(turtle.getItemCount(I))))
- end
- TOTAL = TOTAL + turtle.getItemCount(I)
- end
- top.setCursorPos(1,11)
- top.write("Total: ")
- top.write(tostring(math.floor(TOTAL)))
- rednet.send(PC,tostring(TOTAL))
- turtle.select(SLOT)
- if turtle.detect() then
- turtle.dig()
- end
- if turtle.getItemCount(SLOT) >= 64 then
- SLOT = SLOT + 1
- end
- end
- turtle.turnLeft()
- turtle.turnLeft()
- for O = 1,9 do
- turtle.select(O)
- turtle.drop()
- end
- turtle.turnRight()
- turtle.turnRight()
- SLOT = 1
- turtle.select(SLOT)
- end
- :disk/turtleos/help/:
- term.clear()
- term.setCursorPos(1,1)
- print("HELP:")
- print("Setup - Set up you turtle with the regenerating block in front, a 2x2 monitor above and a collection method behind. An easily accessible disk drive is a recommended option. This software only works with the Wireless Mining Turtle.")
- print("Rednet - Your turtle can link to a computer to share data, just install CobbleGen on the computer and enter the computer number when you run the turtle. If you wish the turtle to be standalone, just enter '0'.")
- print("Press enter to continue")
- read("")
- os.reboot()
- :disk/craftos/startup:
- shell.run("clear")
- print("CraftOS: CobbleGen TurtleBuddy Installed")
- print("Computer ID: " .. os.computerID())
- if peripheral.gettype("top") ~= "monitor" then
- print("Please attach a monitor above the computer and press enter.")
- read("")
- os.reboot()
- end
- if peripheral.getType("back") ~= "modem" then
- print("Please attach a modem behind the computer and press enter.")
- read("")
- os.reboot()
- end
- print("")
- print("Programs available:")
- print("TurtleTotal - Total blocks held by each turtle")
- print("TurtlePerc - % readings for each turtle")
- print("Help - View information on setting up")
- :disk/craftos/perc:
- perc = 0
- TURTLES = {}
- mon = peripheral.wrap("top")
- mon.clear()
- rednet.open("back")
- while true do
- print("Enter turtle IDs to add. Enter VIEW to see data")
- entry = read()
- if entry == "VIEW" then
- term.clear()
- break
- else
- TURTLES[(table.getn(TURTLES)) + 1] = tonumber(entry)
- term.clear()
- term.setCursorPos(1,1)
- term.write("Added: ")
- for O = 1,tablegetn(TURTLES) do
- term.write(TURTLES[O] .. ", ")
- end
- term.setCursorPos(1,2)
- end
- end
- term.setCursorPos(1,1)
- term.write("Viewing percentages for turtles ")
- for P = 1,table.getn(TURTLES) do
- term.write(TURTLES[P] .. ", ")
- end
- print("Hold Ctrl-T to terminate")
- while true do
- for I = 1,table.getn(TURTLES) do
- Q = 0
- repeat
- senderID, message, distance = rednet.receive(1)
- Q = Q + 1
- until (senderID == TURTLES [I]) or (Q == (5 * table.getn(TURTLES)))
- mon.setCursorPos(1,I)
- mon.clearLine()
- if Q == (5 * table.getn(TURTLES)) then
- mon.write("X")
- else
- perc = math.floor((math.floor(message) / 576) * 100)
- mon.write("Turtle " .. senderID .. ": " .. perc .. "%")
- end
- end
- end
- :disk/craftos/total:
- TURTLES = {}
- mon = peripheral.wrap("top")
- mon.clear()
- rednet.open("back")
- while true do
- print("Enter turtle IDs to add. Enter VIEW to see data")
- entry = read()
- if entry == "VIEW" then
- term.clear()
- break
- else
- TURTLES[(table.getn(TURTLES)) + 1] = tonumber(entry)
- term.clear()
- term.setCursorPos(1,1)
- term.write("Added: ")
- for O = 1,tablegetn(TURTLES) do
- term.write(TURTLES[O] .. ", ")
- end
- term.setCursorPos(1,2)
- end
- end
- term.setCursorPos(1,1)
- term.write("Viewing totals for turtles ")
- for P = 1,table.getn(TURTLES) do
- term.write(TURTLES[P] .. ", ")
- end
- print("Hold Ctrl-T to terminate")
- while true do
- for I = 1,table.getn(TURTLES) do
- Q = 0
- repeat
- senderID, message, distance = rednet.receive(1)
- Q = Q + 1
- until (senderID == TURTLES [I]) or (Q == (5 * table.getn(TURTLES)))
- mon.setCursorPos(1,I)
- mon.clearLine()
- if Q == (5 * table.getn(TURTLES)) then
- mon.write("X")
- else
- mon.write("Turtle " .. senderID .. ": " .. math.floor(message))
- end
- end
- end
- :disk/craftos/help:
- term.clear()
- term.setCursorPos(1,1)
- print("HELP:")
- print("After installing CobbleGen on CraftOS, you must use the same disk to install CobbleGen on TurtleOS. You may install it on as many different turtles as you like. When prompted after pressing 'Run' on the turtle menu, enter the ID of this computer (found on the menu) onto to turtle. It will then begin to mine cobblestone for you whilst relaying data back to this computer. To view the data choose an option and type in your turtle(s) ID.")
- print("Press enter to continue")
- read("")
- os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment