Guest User

HackOS

a guest
May 20th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.77 KB | None | 0 0
  1. print("Welcome to HackOS.")
  2. while true do
  3.   print("Please input a command.")
  4.   input = read()
  5.   if input:lower() == "help" then
  6.     print("Hello. I am HackOS. I am a system that is")
  7.     print("designed to help you out in this world.")
  8.     print("I am NOT a replica of HAL9000, I am not")
  9.     print("sentient and won't try to kill you. In fact,")
  10.     print("I try to help you out with tips you ignore.")
  11.     print("So, press any key to clear and move on.")
  12.     print("Also: Type cmds to see the full list.")
  13.     os.pullEvent("char")
  14.   end
  15.   if input:lower() == "cmds" then
  16.     print("Commands are:")
  17.     print("cmds -- Shows this list")
  18.     print("help -- Shows the system helplist")
  19.     print("exit -- Shuts down the system")
  20.     os.pullEvent("char")
  21.   end
  22.   if input:lower() == "exit" then
  23.     shell.run("shutdown")
  24.   end
  25.   if input:lower() == "edit" then
  26.     print("Input passkey:")
  27.     P = read("*")
  28.     if P == "No" then
  29.       print("Access granted.")
  30.       sleep(2)
  31.       shell.run("edit HackOS")
  32.     else
  33.       print("Access denied.")
  34.       sleep(2)
  35.     end
  36.   end
  37.   if input:lower() == "tips" then
  38.     print("Checking database...")
  39.     if fs.exists("disk/") then
  40.       print("Downloading tip...")
  41.       D = fs.open("disk/tip","r")
  42.       Tr = D:readAll()
  43.       D.close()
  44.       T = fs.open("tips","w")
  45.       T:write(Tr)
  46.       T.close()
  47.       W = true
  48.     end
  49.     if fs.exists("tips") then
  50.       if W == true then
  51.         print("Reading new tip...")
  52.       else
  53.         print("No new tips at this time. Reading old tip...")
  54.       end
  55.       E = fs.open("tips","r")
  56.       print(E:readAll())
  57.       E.close()
  58.     else
  59.       print("There are no tips at this time.")
  60.     end
  61.     os.pullEvent("char")
  62.   end
  63.   term.clear()
  64.   term.setCursorPos(1,1)
  65. end
Add Comment
Please, Sign In to add comment