MudkipTheEpic

FakeConsole 1.4 (Advanced computers only)

Dec 16th, 2012 (edited)
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.71 KB | None | 0 0
  1.  --Written by MudkipTheEpic
  2.  --If you would like to include this in your OS, that's fine, just keep these lines and credit        --me.
  3.  
  4. local oldPull = os.pullEvent --[Backup of os.pullEvent]
  5. os.pullEvent = os.pullEventRaw --[Ctrl-T prevention]
  6.  
  7. historyTable = {}
  8.  
  9. detect = shell.getRunningProgram()
  10. if detect ~= "fakeconsole" then
  11. print("File: 'fakeconsole' is not running. Please install with the installation disk.")
  12. sleep(2)
  13. term.clear()
  14. term.setCursorPos(1,1)
  15. os.pullEvent = oldPull
  16. os.reboot()
  17. else
  18. end
  19.  
  20. if fs.isDir("configfc") == false then
  21. fs.makeDir("configfc")
  22. end
  23.  
  24. if fs.exists("configfc/password") == false then
  25. a = fs.open("configfc/password", "w")
  26. a.writeLine("fakeexit")
  27. a.close()
  28. else
  29. end
  30.  
  31. b = fs.open("configfc/password", "r")
  32. local exit = b.readLine()
  33. b.close()
  34.  
  35.  
  36. term.clear()
  37. term.setCursorPos(1,1) --[Clears screen]
  38.  
  39. term.setTextColor(16)
  40. print( os.version() )
  41. term.setTextColor(1) --[Imitates CraftOS]
  42. while true do --[Loop, prevents {Hold down enter to exit}]
  43. term.setTextColor(16)
  44. write("> ") --[Imitates CraftOS]
  45. term.setTextColor(1)
  46.  
  47. readLine = read(nil, historyTable) --[Adds Up/Downarrow function! Thank GravityScore for this!
  48.   table.insert(historyTable, readLine)
  49.  
  50. if readLine == exit then
  51. term.setTextColor(2^math.random(1,14))
  52. print("Exiting FakeConsole...") --[Exit FakeConsole]
  53. sleep(2)
  54. os.pullEvent = oldPull --[Restore os.pullEvent]
  55. term.clear()
  56. term.setCursorPos(1,1) --[Clears screen]
  57. break --[Ends loop]
  58. elseif readLine ~= ("") then --[If the input isn't blank or the exit code then,]
  59. term.setTextColor(16384)
  60. print("No such program") --[Imitates No Program error]
  61. term.setTextColor(1)
  62. else
  63. end --[Keep looping if input is blank]
  64. end --[End program]
Add Comment
Please, Sign In to add comment