Unhiding/Creating .txt files after an event

● ARCHIVED · READ-ONLY
Started by Naetio 20 posts View original ↗
  1. Hello to everyone. I'm only new to this community so I apologize in advance if I make a mistake with the post or something.

    I've been new to the RPG making community, and I wanted to ask something. 

    How does the script work to either unhide or create a .txt file after a certain event on the game?

    For example, like let's say- Irisu Syndrome, in which after some endings, some .txt files appear on the game folder itself.

    Is it possible using RPG Maker VX Ace? 

    Sorry, I'm just a beginner in terms of scripting haha. 

    I thank you in advance to those who can help me. 
  2. I've moved this thread to RGSS3 Script Requests. Please be sure to post your threads in the correct forum next time. Thank you.

    Not sure how this made its way into (or got approved in) RGSS3 Scripts - that's where you posts scripts you've written and are sharing.

    You can use the File class to create files in the game's folder, and probably to change the settings on files as well (change them from hidden to not hidden).  You would run into problems if the player had the game installed in a folder Windows uses though - like Program Files, as you run into the windows permissions issues.
  3. Sorry. I'll keep that in mind! 

    A dumb question though... How can I use the File Class, and where is it so that I can try to change the settings? 

    I'm really new to making games, I know this is complicated but this is a thing that I can do to make my game interesting... 
  4. I am not sure why the game need to hide some files and make the visible after end game unless it's informations/tutorials for end game+ contents.

    So that game probably just create those files after end game as global save to enable new features in game/replay.

    There's a topic about global save files right here on script request not long ago,

    you might be able to find the script/scripts you need there: 

    http://forums.rpgmakerweb.com/index.php?/topic/44521-variable-that-transcends-individual-saves/
  5. My game has a lot of endings, leaving it to not cover the past of the main character. It's like you'll be running into a lot of endings, and that's just it, actually.

    I wanted to make that notes factor to have it like, to explain the past. Because one ending actually explains something. 

    I think I see some scripts that might come in handy, but I don't know how to use them. (Dumb person here, lol) 
  6. I'm moving this to Script Support, as it's probably a better place.

    Post links to the scripts and we'll be able to let you know if they're suitable, and how to use them.  Also check Andar's Guide to Using Scripts - it's written especially for new users, and you'll find the link in my signature.
  7. Use this code in a script call :

    Code:
    File.open("Filename.txt", 'w'){|f|  f.write("Whatever you want to write in a first line")  f.write("If this text is in the same line use \n to make the new row appear")  f.write("Make sure that your game directory isn't write-protected, otherwise you would need to run the game as administrator")}
  8. It's not working? Or it's just me? 

    I renamed Filename.txt and the others, but I don't know what to put in the last two stuff.
  9. 1) What do you mean by last two stuff?

    2) First try with Filename.txt unrenamed, and then rename them.

    3) Make sure that that script call is called.

    4) At the end of the file block (before the } but after { ) add f.close
  10. 1.) This part: f.write("If this text is in the same line use \n to make the new row appear")

      f.write("Make sure that your game directory isn't write-protected, otherwise you would need to run the game as administrator")
    }

    It still doesn't appear even if I put the f.close thingy. Then I don't get that last line... 

    3.) Script call is on the event, and the third option there- right? If I'm not mistaken. 

    What do you mean by "script call is called"?

    I'm so sorry if I have a lot of questions. 
  11. 1) The script call is called if an event is executed that has that script call in it.

    2) Write-protected directory means that if you set "Filename.txt" to "C:/Windows/System32/story.txt" it will throw an error, since C:/Windows/System32 is write-protected.

    And if you use custom installers that put game into C:\Program Files (x86)\YourGame then it will also throw an error (Errno::EACESS I think)

    3) If you have text that looks like

    Line

    New line

    New line

    Then you can do this

    f.write("Line\nNew line\nNew line")4) Or try this :

    Code:
    file = open('Filename.txt', 'w')file.write("Text")file.close
  12. Apparently, I tried stuff and now this happened..

    Script 'Game_Interpreter' line 4111: Syntax Error occured

    unexpected $undefined

    f.write (location of the folder)

    One question again, does that just works on a certain folder? Like, when the game is installed unto another computer, it won't happen? 
  13. Apparently you are only looking for a way to output file and doesn't require a load method.

    If that's the case, KockaAdmiralac's method should work.

    In your event's script call box, do this:

    @text = "Line 1Line 2Line 3Line 4"If one event script box is filled and you need to add more informations.. do this on a new box below:

    @text + = "Line 5Line 6Line 7"And on the final script call box, do this:

    @folder = '.\Extra'Dir::mkdir(@folder) if !Dir.exists?(@folder)@CreateFile = File.open(@folder+'\Filename.txt', 'w')@CreateFile.puts(@text)@CreateFile.close

    Extra is the folder you want the file to be placed inside the game folder.

    Filename.txt can be renamed to any names you like. This way you can make as many .txt informations files as you like.
  14. Thank you, thank you! That really helped! 
  15. You're welcome! Edited the format a bit in that post so you can add your own folders to hold those txt files.
  16. I would just like to ask. I tried the first box, and I've succeeded. But I don't know what's wrong with the second box, whenever I use @text + =,

    It always shows an error saying, something with the '='.

    Let me explain a little... 

    In my text, I had " and ", meaning it's like a dialogue. At first, I thought it was wrong so I erased that part, then I got it wrong again. 

    Then I tried deleting all of the @text + = stuff, then it worked. But then, I tried it with some paragraph, and it didn't work again. 

    Please help, lol. 
  17. hmm.. well, for simple management.

    I'll just make that into a script i think.

    in the "Settings Area"

    add your documents there as:

    @DOC1 = "your text here"

    @DOC2 = "your text here"

    To create a file,

    In the event, use this script call:

    txt_save("variable", "filename")eg. 

    txt_save("DOC1", "Filename.txt")and you should get a file named "Filename.txt" with the contents in @DOC1

    To open a .txt file using its default program (eg, notepad/word)

    Use this script call:

    open_file ("filename")eg

    open_file ("Filename.txt")and the file should be opened in its default program (notepad/word)

    ▼Get the Script Here:▼

    http://forums.rpgmakerweb.com/index.php?/topic/45024-txt-files-builderopener/
  18. I'm sorry, where do you mean by the settings area? 

    I mean where can I find it? 
  19. I thank you~ You've helped me so much~