IndoorMinotaur

Villager
Member
Joined
Oct 10, 2020
Messages
9
Reaction score
1
First Language
English
Primarily Uses
RMMV
Hi! I need to write a text file to the player's "My Games" folder in documents (C:\Users\%userprofile%\Documents\My Games\GameFolder), and my knowledge on how to do this is very lacking.

The purpose of this is to allow integration with other games in the franchise that check for save files and unlock things between them. In order for this to work, it has to write a text file to a static folder with the player's user profile in it. Unfortunately, every bit of information on the subject of writing external text files has been relative to the game location and therefore not quite applicable.

I've looked at a few different plugins and resources and I can't quite find out how to do what I need. Any direction or advise would be appreciated.

Thanks!
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,646
Reaction score
15,730
First Language
English
Primarily Uses
RMMV

I've moved this thread to Plugin Requests. Thank you.



This sort of thing usually goes into %appdata%, not into Documents.

Unless your game creates a Documents\MyGames folder, you have no guarantee that it will even exist. I don't have one on Windows 10.
 

IndoorMinotaur

Villager
Member
Joined
Oct 10, 2020
Messages
9
Reaction score
1
First Language
English
Primarily Uses
RMMV
[move]Plugin Requests[/move]

This sort of thing usually goes into %appdata%, not into Documents.

Unless your game creates a Documents\MyGames folder, you have no guarantee that it will even exist. I don't have one on Windows 10.
The game that it needs to interface with creates the folder, but frankly the location is less important than it being a fixed location the other titles can point to when necessary.
 

rexie09

Villager
Member
Joined
Apr 4, 2021
Messages
28
Reaction score
10
First Language
English
Primarily Uses
RMMZ
Hello i dont know if you have found any fix yet but you could use

process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Preferences' : process.env.HOME + "/.local/share") and store the result in a variable and use that as the home location of the data.
this will always point to the same location depending on the os and with this you can make a folder and add whatever you need into it
 

IndoorMinotaur

Villager
Member
Joined
Oct 10, 2020
Messages
9
Reaction score
1
First Language
English
Primarily Uses
RMMV
Hello i dont know if you have found any fix yet but you could use

process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Preferences' : process.env.HOME + "/.local/share") and store the result in a variable and use that as the home location of the data.
this will always point to the same location depending on the os and with this you can make a folder and add whatever you need into it
Hi Rexie, I haven't yet found a solution so I'm grateful for the reply.

What you are describing sounds like it might be helpful, but the execution is a little over my head. I'm guessing darwin is the Mac OS version of win32, but how do I save this as a variable? Do you mean like an in-game variable?
 

rexie09

Villager
Member
Joined
Apr 4, 2021
Messages
28
Reaction score
10
First Language
English
Primarily Uses
RMMZ
Hi Rexie, I haven't yet found a solution so I'm grateful for the reply.

What you are describing sounds like it might be helpful, but the execution is a little over my head. I'm guessing darwin is the Mac OS version of win32, but how do I save this as a variable? Do you mean like an in-game variable?
I meant a variable in JS for example
JavaScript:
const location = process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Preferences' : process.env.HOME + "/.local/share");

//proceed with code to write to text file using location as the base directory

because assigning it to a game variable would be useless if all you need it for is saving stuff from the game in a localized location with a script
 

Latest Threads

Latest Posts

Latest Profile Posts

I have never felt so attacked by a tree before :LZSlol: it took 10++ hours to make but at least it looks pretty LOL

Untitled-1.png
now seems like the worst time for me to need a better computer with how much stuff is costing. that and I don't thing there's much else I can do to make MV run any better with what I have.
Sigh... to have some variety in this weather. More than just sun and rain and wind and thunder.
In the meantime, I've discovered that I'm slowly becoming fatigued from the many sleepless nights my neighbors cause. Or at least their dogs. Always barking at something.
I might need a day to just sleep and recharge.
After the initial success with one event, I set up four different events on the same map to detect who is in which slot in my current party, and fortunately it managed to work as intended, with the events changing image to match the party members even as I swapped their positions around in formation. This will be a great tool for immersive scene design.

Forum statistics

Threads
118,452
Messages
1,116,086
Members
155,428
Latest member
jlauza
Top