Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Programmer: totestots/noiro
- Purpose: An easy-to-use launcher with hotkeys and fast launching with auto-execution
- Enjoy!
- ]]
- --This is a name list that will be accessed to randomly assign a name to turtles
- local nameList = {
- "Bob George",
- "Turtlenator",
- "Tortoiminer",
- "Destroyer",
- "Tu Amiga",
- "Tu Amigo",
- "Cat Luvr",
- "Expensive Calculator",
- "Buttermilk",
- "Hopes and Dreams",
- "Elvis", "Lugia",
- "Pink Panther"
- }
- function nameTurtle()
- --Pulls a random name from namelist and names the turtle
- name = nameList[math.random(1,#nameList)]..tostring(math.random(1,100))
- os.setComputerLabel(name)
- end
- function render()
- --Builds and shows the screen
- term.clear()
- term.setCursorPos(1,1)
- print("\t\t"..os.getComputerLabel().." ready!")
- local sizeX, sizeY = term.getSize()
- --Makes a nice little separator
- for i=0,sizeX do
- term.write("=")
- end
- print("\nFuel: "..turtle.getFuelLevel().." / "..turtle.getFuelLimit())
- print("Quick Launch:")
- print("\t t - Mine Tree")
- print("\t r - Refuel all in Inv")
- print("\t b - [NOT IN YET] Build Stuff")
- print("\t ENTER - Exit Launcher\n")
- for i=0,sizeX do
- term.write("=")
- end
- term.setCursorPos(1,sizeY)
- term.write("InGame Time: "..textutils.formatTime(os.time(),false))
- term.setCursorPos(sizeX, sizeY)
- end
- function execute(programPath, ...)
- --Runs a program of the specified path
- term.clear()
- term.setCursorPos(1,1)
- shell.run(programPath, ...)
- reboot()
- end
- function run()
- --If you're going to pick him up and put him down a lot, should probs refresh this
- os.importAPI("api/move")
- turtle.setCoords(0,0,0,"north")
- render()
- end
- function launcher()
- --Launches based on what you press
- while true do
- key = getInput()
- term.clear()
- term.setCursorPos(1,1)
- if key == 28 then
- break
- elseif key == 20 then
- shell.run("programs/tree")
- elseif key == 22 then
- shell.run("update")
- os.reboot()
- elseif key == 19 then
- shell.run("programs/refuel")
- elseif key == 48 then
- shell.run("programs/build")
- end
- render()
- end
- end
- function getInput()
- --This will take the keys for the user's input and respond based on it
- local event, key = os.pullEvent("key")
- return key
- end
- --STARTUP - This is if running for the first time
- if not fs.exists("update") then
- local toDelete = shell.getRunningProgram()
- shell.run("pastebin","get","0Qx78iw0","update")
- shell.run("update")
- nameTurtle()
- fs.delete(toDelete)
- os.reboot()
- else
- os.loadAPI("api/move")
- turtle.setCoords(0,0,0,"north")
- render()
- launcher()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement