Advertisement
NekoTiki

Untitled

Oct 1st, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fs.makeDir("start")
  2.  
  3. function createdir()
  4. term.clear()
  5. term.setCursorPos(1, 1)
  6.  
  7. print("Entrez le nom du programme a lancer au demarrage :")
  8. prog = read()
  9. local exist = fs.exists(prog)
  10. if exist == true then
  11.  
  12. else
  13. createdir()
  14. end
  15. end
  16.  
  17. if fs.exists('start/config') == false then
  18. createdir()
  19. local file = fs.open("start/config", "w")
  20. file.writeLine(prog)
  21. file.close()
  22. os.reboot()
  23. else
  24. --Lecture fichier
  25. local file = fs.open("start/config","r")
  26. ProgramName = file.readLine()
  27. file.close()
  28. end
  29.  
  30. crashcount = 0
  31.  
  32. function crash()
  33. term.setTextColor(colors.yellow)
  34. write("Le programme a crash: ")
  35. term.setTextColor(colors.red)
  36. write(crashcount)
  37. term.setTextColor(colors.yellow)
  38. print(" fois.")
  39. end
  40.  
  41. while true do
  42. term.clear()
  43. term.setCursorPos(1,1)
  44. crash()
  45. term.setTextColor(colors.green)
  46. print("Lancement du Programme ...")
  47. shell.run(ProgramName)
  48. crashcount = crashcount + 1
  49. sleep(2)
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement