Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Gonor

Script to change a file's name?

Recommended Posts

Hello there,

 

I'm looking for an RGSS2 script with which I can change a file's name during the game.

It's not entirely neccessary but it would make one of my planned plot twists much much easier. :alright:

 

Thx.

Gonor

Share this post


Link to post
Share on other sites

from the help document... Help -> Contents -> RGSS Reference Manual -> Standard Library -> Built-in Classes -> Object -> IO -> File

 

File.rename(from, to)

 

Renames file, moving it to a different directory as required. If a file already exists at the destination, it is overwritten.

 

Returns 0 when file movement is successful; when it fails, throws an Errno::EXXX exception.

 

 

It's already built in. The root folder is your game folder, so if your file is in the game folder...

 

File.rename("myfile.txt", "renamed.txt")

 

If it's in the Data folder, for example...

 

File.rename("Data\\myfile.txt", "Data\\renamed.txt")

Edited by brewmeister

Share this post


Link to post
Share on other sites

Great!

That's exactly what I was looking for.

 

Thanks a lot.

 

Edit: It just came to my mind, that I would have to adapt the script so it will check for the game's progress, so the file is renamed properly when loading. Ah, well... I guess I'll have to try and write a little more than just a script call. :P

Edited by Gonor

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...