Advertisement
Guest User

cmd_handler

a guest
Sep 17th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.37 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. term.clear()
  3. term.setCursorPos(1, 1)
  4. term.setTextColor(colors.green)
  5. term.write("BOS v3.1 CLI-Based")
  6. term.setCursorPos(1, 3)
  7. term.setTextColor(colors.white)
  8. cmd = read()
  9. if cmd == "license" then
  10.     shell.run("license")
  11. elseif cmd == "bosChat" then
  12.     term.clear()
  13.     term.setCursorPos(1, 1)
  14.     term.write("Write your username:")
  15.     term.setCursorPos(1, 2)
  16.     user = read()
  17.     shell.run("chat", "join", "bosChat", user)
  18.     shell.run("cmd_handler")
  19. elseif cmd == "paint" then
  20.     term.clear()
  21.     term.setCursorPos(1, 1)
  22.     term.write("Write your filename (you can include a path):")
  23.     term.setCursorPos(1, 2)
  24.     file = read()
  25.     shell.run("paint", file)
  26.     shell.run("cmd_handler")
  27. elseif cmd == "help" then
  28.     term.clear()
  29.     term.setCursorPos(1, 1)
  30.     term.setTextColor(colors.blue)
  31.     term.write("BOS Command Directory:")
  32.     term.setTextColor(colors.white)
  33.     term.setCursorPos(1, 3)
  34.     term.write("help - Shows a directory of every command")
  35.     term.setCursorPos(1, 4)
  36.     term.write("paint - Opens a GUI where you are able to paint")
  37.     term.setCursorPos(1, 5)
  38.     term.write("report - Sends a report to a server of a glitch, user, etc.")
  39.     term.setCursorPos(1, 6)
  40.     term.write("ink - Opens Ink, a word processor by Oversimplifier (forum)")
  41.     term.setCursorPos(1, 7)
  42.     term.write("bosChat - Connects to BOS public chat.")
  43.     term.setCursorPos(1, 8)
  44.     term.write("bosSupport - Connects to BOS public support channel.")
  45.     term.setCursorPos(1, 9)
  46.     term.write("re - Reboots the Computer.")
  47.     term.setCursorPos(1, 10)
  48.     term.write("ls - What can we say about it? The same as Linux ls command.")
  49.     term.setCursorPos(1, 11)
  50.     term.write("sd - Shuts down the computer.")
  51.     term.setCursorPos(1, 19)
  52.     term.write("Press any key to continue...")
  53.     os.pullEvent("key")
  54.     shell.run("cmd_handler")
  55. elseif cmd == "report" then
  56.     term.clear()
  57.     term.setCursorPos(1, 1)
  58.     term.write("Location of the modem? (top, bottom, front, back, left, right)")
  59.     location = read()
  60.     rednet.open(location)
  61.     term.clear()
  62.     term.setCursorPos(1, 1)
  63.     term.write("Write down your report:")
  64.     report = read()
  65.     rednet.broadcast("R" + report)
  66. elseif cmd == "ink" then
  67.         if fs.exists("/ink") then
  68.             shell.run("ink")
  69.             shell.run("cmd_handler")
  70.         else
  71.             shell.run("pastebin", "get", "JxzXPv03", "ink")
  72.             shell.run("ink")
  73.             shell.run("cmd_handler")
  74.         end
  75. elseif cmd == "bosSupport" then
  76.     id = os.getComputerID
  77.     shell.run("chat", "join", "bosSupport", "Computer" + id)
  78.     shell.run("cmd_handler")
  79. elseif cmd == "re" then
  80.     os.reboot()
  81. elseif cmd == "ls" then
  82.     shell.run("ls")
  83.     term.setCursorPos(1, 19)
  84.     term.write("Press any key to continue...")
  85.     os.pullEvent("key")
  86.     shell.run("cmd_handler")
  87. elseif cmd == "sd" then
  88.     os.shutdown()
  89. elseif cmd == "luaide" then
  90.     shell.run("luaide")
  91.     shell.run("cmd_handler")
  92. elseif cmd == "lua" then
  93.   shell.run("lua")
  94.   shell.run("cmd_handler")
  95. else
  96.     term.clear()
  97.     term.setCursorPos(1, 1)
  98.     term.setTextColor(colors.red)
  99.     term.write("Whoops! Command not found.")
  100.     term.setCursorPos(1, 3)
  101.     term.setTextColor(colors.white)
  102.     term.write("Press any key to continue...")
  103.     os.pullEvent("key")
  104.     shell.run("cmd_handler")
  105. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement