Guest User

Untitled

a guest
Jun 22nd, 2017
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. #==============================================================================
  2. # ■ Meow Face Text File Output
  3. #------------------------------------------------------------------------------
  4. # Create .txt files using the preset data in Settings
  5. #==============================================================================
  6. # How to Use:
  7. # [1] Put this script below Material and above Main
  8. # [2] Set up the datas in Settings Area below
  9. #
  10. # Script Call:
  11. # txt_save("variable", "filename")
  12. #
  13. # eg. txt_save("DOC1", "Filename.txt")
  14. # will output DOC1 datas in settings to Filename.txt file
  15. #
  16. # open_file ("filename")
  17. #
  18. # eg. open_file ("Filename.txt")
  19. # will open Filename.txt file using its default program
  20. #
  21. #==============================================================================
  22. module MeowFaceDoc # Do not Remove!
  23. #==============================================================================
  24. # Settings Area
  25. #==============================================================================
  26. #------------------------------------------------------------------------------
  27. # The folder you want the files to be created
  28. #------------------------------------------------------------------------------
  29. FOLDER = '.\Ending_Extra'
  30. #------------------------------------------------------------------------------
  31. # This is where you add your text documents
  32. # Add as many new @DOCX as you like (where X = the document number)
  33. # You can use "\n" to start a new line, or simply enter a new line below (see example below)
  34. #------------------------------------------------------------------------------
  35. @DOC1 = "
  36. =============
  37. Title of Doc
  38. =============
  39. Line 1
  40. Line 2
  41. Line 3
  42. Line 4
  43. Line 5"
  44.  
  45. @DOC2 = "Line 1\nLine 2\nLine 3\nLine 4"
  46.  
  47. @DOC3 = "Happy Kitty dancing in the hall
  48. Angry Mole rushing down the hole"
  49.  
  50. #==============================================================================
  51. # End of Settings Area
  52. # Edit Anything Pass This Line at Your Own Risk!
  53. #==============================================================================
  54. end
  55. class Game_Interpreter
  56. def txt_save(data, filename)
  57. @text = MeowFaceDoc.instance_variable_get("@#{data}")
  58. Dir::mkdir(MeowFaceDoc::FOLDER) if !Dir.exists?(MeowFaceDoc::FOLDER)
  59. @file = File.join(MeowFaceDoc::FOLDER,filename)
  60. if !File.exist?(@file)
  61. @CreateFile = File.open(@file, 'w')
  62. @CreateFile.puts(@text)
  63. @CreateFile.close
  64. @text.clear
  65. end
  66. end
  67. def open_file (filename)
  68. @file = File.join(MeowFaceDoc::FOLDER,filename)
  69. system %{cmd /c "start #{@file}"} if File.exist?(@file)
  70. end
  71. end
Advertisement
Add Comment
Please, Sign In to add comment