Advertisement
LazerAio

startup

Mar 6th, 2022
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.49 KB | None | 0 0
  1. args = {...}
  2. SpeakerSide = "left"
  3. if fs.exists("beep.dfpwm") then
  4. shell.run("speaker play beep.dfpwm")
  5. end
  6. term.setTextColor(colors.blue)
  7. term.setBackgroundColor(colors.cyan)
  8. term.clear()
  9. if #args == 0 then
  10. print("RUN execcutes? [F/B/I]")
  11. while true do
  12. RunMethod = read()
  13. RunMethod = string.upper(RunMethod)
  14. if RunMethod == "F" or RunMethod == "B" or RunMethod == "I" or RunMethod == "" then
  15. if RunMethod == "" then
  16. RunMethod = "I"
  17. end
  18. break
  19. else
  20. print("[F/B/I]")
  21. end
  22. end
  23. end
  24. if #args == 0 then
  25. print("Use emulator exceptions? [Y]")
  26. Exceptions = read()
  27. term.clear()
  28. if Exceptions == "y" or Exceptions == "Y" or Exceptions == "" then
  29. Exceptions = true
  30. else
  31. Exceptions = false
  32. end
  33. else
  34. if args[2] == "y" then
  35. Exceptions = true
  36. end
  37. end
  38. function RUN(AutoMode,COMMAND)
  39. local beepable = false
  40. if fs.exists("beep.dfpwm") and AutoMode == false then
  41. shell.run("speaker play beep.dfpwm")
  42. term.clear()
  43. term.setCursorPos(1,1)
  44. beepable = true
  45. end
  46. if AutoMode == false then
  47. print((fs.getCapacity(".")/1000).." kb capacity")
  48. print((fs.getFreeSpace(".")/100).." hb avaible")
  49. term.setCursorPos(1,3)
  50. else
  51. term.setCursorPos(1,1)
  52. end
  53. local PL = {}
  54. while true do
  55. sleep(0)
  56. print("READY")
  57. if AutoMode == false then
  58. OgCOMMAND = read()
  59. COMMAND = OgCOMMAND
  60. else
  61. print(COMMAND)
  62. sleep(1)
  63. end
  64. if string.upper(COMMAND) == "LIST" then
  65. for i=1,#PL do
  66. print(PL[i])
  67. end
  68. elseif string.upper(COMMAND) == "SHELL" then
  69. break
  70. elseif string.upper(COMMAND) == "LOAD" then
  71. print("Name? ")
  72. shell.run("disk/"..read())
  73. elseif string.upper(COMMAND) == "CLEAR" then
  74. term.clear()
  75. term.setCursorPos(1,1)
  76. elseif string.upper(COMMAND) == "RUN" then
  77. print("SLOW? [Y]")
  78. Slow = read()
  79. if Slow == "y" or Slow == "Y" then
  80. Slow = true
  81. else
  82. Slow = false
  83. end
  84. for i=1,#PL do
  85. if RunMethod == "B" then
  86. RunMethod = "bg "
  87. elseif RunMethod == "F" then
  88. RunMethod = "fg "
  89. else
  90. RunMethod = ""
  91. end
  92. if Exceptions then
  93. shell.run("startup",PL[i],"y")
  94. else
  95. shell.run("startup",PL[i],"n")
  96. end
  97.  
  98. if Slow then
  99. sleep(1)
  100. end
  101. i = i + 1
  102. end
  103. elseif string.upper(COMMAND) == "DEL" then
  104. PL = {}
  105. else
  106.  
  107.  
  108. temp = string.sub(COMMAND, 1, 3)
  109. temp2 = 3
  110. if tonumber(temp) == nil then
  111. temp = string.sub(COMMAND, 1, 2)
  112. temp2 = 2
  113. --if tonumber(temp) == nil then
  114. --temp = string.sub(COMMMAND, 1, 1)
  115. --temp2 = 1
  116. --end
  117. end
  118. if tonumber(temp) == nil then
  119. if Exceptions then
  120. shell.run(OgCOMMAND)
  121. else
  122. print("BAD SYNTAX")
  123. end
  124. else
  125. RESULT = string.sub(COMMAND, (temp2 + 1), string.len(COMMAND))
  126. PL[tonumber(temp)] = RESULT
  127. end
  128. end
  129. if AutoMode then
  130. break
  131. end
  132. end
  133. end
  134. if #args == 0 then
  135. RUN(false,nil)
  136. else
  137. RUN(true,args[1])
  138. end
  139.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement