Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local uInput = ("")
- local parameters = {}
- term.setBackgroundColor(colors.gray)
- shell.run("CadeOS/headerCadeOS.lua")
- -- Opening message
- function openingMessage()
- term.setTextColor(colors.orange)
- print("Choose a program to run:")
- end
- -- Main Menu
- function mainMenu()
- print()
- term.setTextColor(colors.orange)
- term.write("1. ")
- term.setTextColor(colors.red)
- term.write("Movement")
- print()
- term.setTextColor(colors.orange)
- term.write("2. ")
- term.setTextColor(colors.red)
- term.write("Rotate")
- print()
- term.setTextColor(colors.orange)
- term.write("3. ")
- term.setTextColor(colors.red)
- term.write("Mine (Manual Setup)")
- print()
- term.setTextColor(colors.orange)
- term.write("4. ")
- term.setTextColor(colors.red)
- term.write("Mine (Auto Setup)")
- end
- -- Main Menu User Input
- function userInput()
- print()
- print()
- term.setTextColor(colors.green)
- uInput = io.read()
- end
- -- User Input for cadeMine Program
- function manualMineMenu()
- print()
- term.setTextColor(colors.orange)
- print("Quarry length: ")
- term.setTextColor(colors.green)
- parameters[1] = io.read()
- print()
- term.setTextColor(colors.orange)
- print("Quarry width: ")
- term.setTextColor(colors.green)
- parameters[2] = io.read()
- print()
- term.setTextColor(colors.orange)
- print("Quarry height: ")
- term.setTextColor(colors.green)
- parameters[3] = io.read()
- end
- -- Movement Menu
- function movementMenu()
- print()
- term.setTextColor(colors.orange)
- term.write("1. ")
- term.setTextColor(colors.red)
- term.write("Forward (32 blocks)")
- print()
- term.setTextColor(colors.orange)
- term.write("2. ")
- term.setTextColor(colors.red)
- term.write("Backward (32 blocks)")
- print()
- term.setTextColor(colors.orange)
- term.write("3. ")
- term.setTextColor(colors.red)
- term.write("Right (6 blocks)")
- print()
- term.setTextColor(colors.orange)
- term.write("4. ")
- term.setTextColor(colors.red)
- term.write("Left (6 blocks)")
- end
- -- Rotate Menu
- function rotateMenu()
- print()
- term.setTextColor(colors.orange)
- term.write("1. ")
- term.setTextColor(colors.red)
- term.write("Right")
- print()
- term.setTextColor(colors.orange)
- term.write("2. ")
- term.setTextColor(colors.red)
- term.write("Left")
- print()
- term.setTextColor(colors.orange)
- term.write("3. ")
- term.setTextColor(colors.red)
- term.write("Behind")
- end
- -- Invalid Response
- function invalidResponse()
- print()
- term.setTextColor(colors.green)
- term.write(uInput)
- term.setTextColor(colors.orange)
- term.write(" is not a valid command")
- print()
- print()
- end
- -- Command Sent
- function commandSent()
- term.setTextColor(colors.orange)
- term.write("Command Sent: ")
- term.setTextColor(colors.green)
- end
- -- Main Menu User Input Responses
- function uInputMainMenuResponse()
- if (uInput == "1") or (uInput == "move") or (uInput == "movement") or (uInput == "Movement") then
- movementMenu()
- uInput = ("")
- userInput()
- uInputMovementMenuResponse()
- shell.run("CadeOS/remote.lua")
- elseif (uInput == "2") or (uInput == "rotate") or (uInput == "Rotate") then
- rotateMenu()
- uInput = ("")
- userInput()
- uInputRotateMenuResponse()
- shell.run("CadeOS/remote.lua")
- elseif (uInput == "3") or (uInput == "Mine")then
- manualMineMenu()
- print()
- rednet.broadcast("cadeMine")
- rednet.broadcast(parameters[1])
- rednet.broadcast(parameters[2])
- rednet.broadcast(parameters[3])
- shell.run("CadeOS/remote.lua")
- elseif (uInput == "4") or (uInput == "Mine Auto") then
- rednet.broadcast("cadeMine2")
- commandSent()
- term.write("Auto Mine")
- elseif (uInput == "exit") then
- print("emergency stop")
- else
- invalidResponse()
- sleep(2)
- shell.run("CadeOS/remote.lua")
- end
- uInput = ""
- end
- -- Movement Menu User Input Responses
- function uInputMovementMenuResponse()
- print()
- if (uInput == "1") or (uInput == "move") or (uInput == "movement") or (uInput == "Movement") then
- rednet.broadcast("movement", "moveForward")
- commandSent()
- term.write("Move Forward")
- elseif (uInput == "2") or (uInput == "back") or (uInput == "Back") or (uInput == "backward") or (uInput == "Backward") then
- rednet.broadcast("movement", "moveBackward")
- commandSent()
- term.write("Move Backward")
- elseif (uInput == "3") or (uInput == "right") or (uInput == "Right") then
- rednet.broadcast("movement", "moveRight")
- commandSent()
- term.write("Move Right")
- elseif (uInput == "4") or (uInput == "left") or (uInput == "Left") then
- rednet.broadcast("movement", "moveLeft")
- commandSent()
- term.write("Move Left")
- elseif (uInput == "exit") then
- print("emergency stop")
- else
- invalidResponse()
- sleep(2)
- shell.run("CadeOS/remote.lua")
- end
- end
- -- Rotate Menu User Input Response
- function uInputRotateMenuResponse()
- print()
- if (uInput == "1") or (uInput == "right") or (uInput == "Right") then
- rednet.broadcast("rotate", "right")
- commandSent()
- term.write("Rotate Right")
- elseif (uInput == "2") or (uInput == "left") or (uInput == "Left") then
- rednet.broadcast("rotate", "left")
- commandSent()
- term.write("Rotate Left")
- elseif (uInput == "3") or (uInput == "Behind") or (uInput == "behind") or (uInput == "180") then
- rednet.broadcast("rotate", "behind")
- commandSent()
- term.write("Rotate Behind")
- elseif (uInput == "exit") then
- print("emergency stop")
- else
- invalidResponse()
- sleep(2)
- shell.run("CadeOS/remote.lua")
- end
- end
- -- Main Program
- openingMessage()
- mainMenu()
- userInput()
- uInputMainMenuResponse()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement