设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 100|回复: 0

[转载发布] ozu_File – Create and manipulate files from within the game itself!

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    7524

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    29055
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    37473

    灌水之王

    发表于 4 小时前 | 显示全部楼层 |阅读模式
    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.

    • 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
    How to use
    Spoiler: file.exist
    file.exist
    Checks if a file in your game folder exists or not.
    Intended for the conditional branch script box.
                    Code:       
    1. file.exist("path", "file.type")
    复制代码

    "" for path means the main game folder, "" for file checks if folder exists

    These all return TRUE:
                    Code:       
    1. file.exist("", "index.html")
    2. file.exist("data", "")
    3. file.exist("img/system", "Window.png")
    复制代码



    This returns FALSE unless it exists:
                    Code:       
    1. file.exist("asdf/gh", "jkl.txt")
    复制代码



    Screenshot example:
    Spoiler: file.write
    file.write
    Writes a new file with the desired data.
    Intended for script calls.
                    Code:       
    1. file.write("path", "file.type", "stuff")
    复制代码

    "" for path means the main game folder, the rest is required.

    Some examples:
                    Code:       
    1. file.write("", "tanoshindekudasai.txt", "Arigato gozaimasu")
    复制代码

                    Code:       
    1. file.write("data", "test.json", "Can it write to JSON?")
    复制代码



    Screenshot example:


    Spoiler: file.append
    file.append
    Same as file.write but writes to the end of an existing file instead of overwriting it.
    Intended for script calls.
                    Code:       
    1. file.append("path", "file.type", "new stuff")
    复制代码

    "" for path means the main game folder, the rest is required.

    Some examples:
                    Code:       
    1. file.append("", "tanoshindekudasai.txt", "!!!")
    复制代码

                    Code:       
    1. file.append("data", "test.json", " Yes.")
    复制代码



    Screenshot example:


    Spoiler: file.read
    file.read
    Reads a file and outputs a string of what's in it.
    Intended for conditional branches and setting variables.
                    Code:       
    1. file.read("path", "file.type")
    复制代码

    "" 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!!!"):
                    Code:       
    1. file.read("", "tanoshindekudasai.txt") === "Arigato gozaimasu!!!"
    复制代码



    Using Control Variables, set a variable to
                    Code:       
    1. file.read("", "tanoshindekudasai.txt")
    复制代码

    and the variable will be set to "Arigato gozaimasu!!!" or whatever tanoshindekudasai.txt contains.


    Screenshot example:
    Spoiler: file.rename
    file.rename
    Renames a file, careful not to rename important files.
    Intended for script calls.
                    Code:       
    1. file.rename("path", "file.type" "new name.type")
    复制代码

    "" for path means the main game folder, the rest is required.

    Some examples:
                    Code:       
    1. file.rename("", "tanoshindekudasai.txt", "ieie.txt")
    复制代码

                    Code:       
    1. file.rename("data", "test.json", "johnromero.json")
    复制代码



    Screenshot example:


    Spoiler: file.erase
    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.
                    Code:       
    1. file.erase("path", "file.type")
    复制代码

    "" for path means the main game folder, the rest is required.

    Some examples:
                    Code:       
    1. file.erase("", "ieie.txt")
    复制代码

                    Code:       
    1. 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
    https://raw.githubusercontent.com/ozubon/tidbits/master/ozu_File.js
    Right-click link -> Save As

    Credit
    ozubon
    Kino for this guide


    本贴来自国际rpgmaker官方论坛作者:ozubon处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/ozu_file-create-and-manipulate-files-from-within-the-game-itself.120076/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-7-30 19:35 , Processed in 0.073202 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表