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,647
Reaction score
15,742
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 Profile Posts

I might try the mechanical bull at the fair on Friday... for one of the challenges, if you stay on for two minutes, you win $200. I might give that a try and see if I win--I'm pretty good at holding on to things.
Remaking a more streamlined version of my Remote Move map skill in MZ, just one switch and one variable to handle everything. If you seen the Move skill in Golden Sun before, moving far away items with your mind is pretty cool

MZtestRemoteMove.gif
I don't want to brag or anything but I was entertaining a woman the other night. I told her jokes while she bandaged my foot.
Okay so, I'm using this script, right? And it works. If you press :Y a menu should come up allowing you to choose an item to use. Nothing happens. You press :A to open the event options menu and choose "Use an Item"? The item selection menu appears. I have no idea how I set this up or why it works the way it does. Absolutely bizarre.
A woman gave me her number without me even asking for it. Then she left because she had other patients to see.

Forum statistics

Threads
118,733
Messages
1,118,325
Members
155,886
Latest member
deadman22
Top