- Joined
- Oct 16, 2018
- Messages
- 178
- Reaction score
- 168
- First Language
- English
- Primarily Uses
- RMMV
ozu_File 1.2
by ozubon
Introduction
Using Node.js' file system module can be a hassle. Getting it to work both in playtest and after deployment seems to be something people are having trouble it. This aims to give some easy to use functions as tools for manipulating the game folder's files using Node.js – both for people who've tried implementing the .fs module and failed and for anyone with basic script call knowledge who wants to play with files.
Does not work on mobile!
Features
This plugin allows you to do things with your game files and folders from within the game itself.
Terms of use
You don't have to credit me but I'd appreciate it!
For commercial use, you gotta credit me!
Plugin
Right-click link -> Save As
Credit
ozubon
Kino for this guide
by ozubon
Introduction
Using Node.js' file system module can be a hassle. Getting it to work both in playtest and after deployment seems to be something people are having trouble it. This aims to give some easy to use functions as tools for manipulating the game folder's files using Node.js – both for people who've tried implementing the .fs module and failed and for anyone with basic script call knowledge who wants to play with files.
Does not work on mobile!
Features
This plugin allows you to do things with your game files and folders from within the game itself.
- file.exist will check whether a file exists or not
- file.write will write or overwrite a file with the text you enter
- file.append will add text to an already existing file
- file.read will read a file and output its contents as text
- file.rename will rename a file to the filename you enter
- file.erase will permanently delete a file
file.exist
Checks if a file in your game folder exists or not.
Intended for the conditional branch script box.
"" for path means the main game folder, "" for file checks if folder exists
These all return TRUE:
This returns FALSE unless it exists:
Screenshot example:
Checks if a file in your game folder exists or not.
Intended for the conditional branch script box.
Code:
file.exist("path", "file.type")
These all return TRUE:
Code:
file.exist("", "index.html")
file.exist("data", "")
file.exist("img/system", "Window.png")
This returns FALSE unless it exists:
Code:
file.exist("asdf/gh", "jkl.txt")
Screenshot example:
file.write
Writes a new file with the desired data.
Intended for script calls.
"" for path means the main game folder, the rest is required.
Some examples:
Screenshot example:

Writes a new file with the desired data.
Intended for script calls.
Code:
file.write("path", "file.type", "stuff")
Some examples:
Code:
file.write("", "tanoshindekudasai.txt", "Arigato gozaimasu")
Code:
file.write("data", "test.json", "Can it write to JSON?")
Screenshot example:

file.append
Same as file.write but writes to the end of an existing file instead of overwriting it.
Intended for script calls.
"" for path means the main game folder, the rest is required.
Some examples:
Screenshot example:

Same as file.write but writes to the end of an existing file instead of overwriting it.
Intended for script calls.
Code:
file.append("path", "file.type", "new stuff")
Some examples:
Code:
file.append("", "tanoshindekudasai.txt", "!!!")
Code:
file.append("data", "test.json", " Yes.")
Screenshot example:

file.read
Reads a file and outputs a string of what's in it.
Intended for conditional branches and setting variables.
"" for path means the main game folder, the rest is required.
This will return TRUE in a conditional branch (if tanoshindekudasai.txt is exactly "Arigato gozaimasu!!!"):
Using Control Variables, set a variable to
and the variable will be set to "Arigato gozaimasu!!!" or whatever tanoshindekudasai.txt contains.
Screenshot example:

Reads a file and outputs a string of what's in it.
Intended for conditional branches and setting variables.
Code:
file.read("path", "file.type")
This will return TRUE in a conditional branch (if tanoshindekudasai.txt is exactly "Arigato gozaimasu!!!"):
Code:
file.read("", "tanoshindekudasai.txt") === "Arigato gozaimasu!!!"
Using Control Variables, set a variable to
Code:
file.read("", "tanoshindekudasai.txt")
Screenshot example:

file.rename
Renames a file, careful not to rename important files.
Intended for script calls.
"" for path means the main game folder, the rest is required.
Some examples:
Screenshot example:

Renames a file, careful not to rename important files.
Intended for script calls.
Code:
file.rename("path", "file.type" "new name.type")
Some examples:
Code:
file.rename("", "tanoshindekudasai.txt", "ieie.txt")
Code:
file.rename("data", "test.json", "johnromero.json")
Screenshot example:

file.erase
Do not use this one unless you know what you're doing!
Permanently deletes a file, be VERY careful not to erase important files.
Intended for script calls.
"" for path means the main game folder, the rest is required.
Some examples:
Screenshot example:

Do not use this one unless you know what you're doing!
Permanently deletes a file, be VERY careful not to erase important files.
Intended for script calls.
Code:
file.erase("path", "file.type")
Some examples:
Code:
file.erase("", "ieie.txt")
Code:
file.erase("data", "johnromero.json")
Screenshot example:

Terms of use
You don't have to credit me but I'd appreciate it!
For commercial use, you gotta credit me!
Plugin
Right-click link -> Save As
Credit
ozubon
Kino for this guide
Attachments
-
30.6 KB Views: 503
Last edited:





