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

[转载发布] Support module for scripters

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

    连续签到: 2 天

    [LV.7]常住居民III

    9071

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 2026-8-1 09:02:52 | 显示全部楼层 |阅读模式
    Universal Module

    v1.2.6, by Holy87


    Features

    Provides more functionalities for scripters (and it is used in a lot of my scripts), let's see what you can do:

    System communication

    You can obtain the screen resolution, Pictures/My Documents/Music/Video/Desktop folders, Windows user account name, Windows version and language, and changing the game window's width and height.

    Internet

    You can downlaod files and get response with async methods: you don't have to check when the download is terminated, just set the method that will be automatically called when the file will be downloaded.

    You can also open the system default browser to a specific URL!

    Universal data that not depends on savegames

    You can store variables and switches that not depend on savegame, but are universal: for example, if I want unlock an "Extra" option in the title screen when the player completes the game. You can do that with this!

    String options and crypting

    You can encode/decode a string in ROT13 or Base64, and also get a random string if you want.

    Other functionalities

    Version class: You can create a version class with major, minor, build and revision informations (like 1.0.15.3). You can also compare versions and, obviously, set a game version creating a version.ini file in the project root.

    println method: like p and print methods, but automatically adds a newline in the console.

    How to Use

    Place the script under Mateirals and above Main.

    Code Examples:

    How to get system Informations

    print Win.username #=> "Francesco"print Win.version #=> 10.0print Win.getFolderPath
    dskt) #=> "C:/Users/Francesco/Desktop"print Win.resolution #=> [1024,730]. Note that it's not all the display resolution, but only the part#of the screen not covered by the taskbar, so you know how big you can resize the game window.Internet and HTTP

    Async method are easy-to-use, but by default are avaiable only in the Scene and Window class. You can make it avaiable in other classes including the Async_Downlads module (see in the script)

    Let see how they work. For example, I want to download automatically a new picture for the title screen. What I've to do is:

    class Scene_Title < Scene_Base  def download_new_title    download_async("http://myhost.com/title_wallpaper.jpg", method
    title_downloaded), "Graphics/Pictures/")  end   def title_downloaded #launched automatically when the download is completed    @sprite2.bitmap = Cache.picture("title_wallpaper.jpg")  endendHow to open the browser to a web page:

    Browser.open("www.google.com")Using universal data

    The universal data (variables and objects) are stored in the Game_Settings.rvdata2 in the project's root. Let's see how to use them. You can use the $game_settings instance.

    $game_settings[:game_completed] = trueThe data will be automatically saved when the value changes, so I can read the data using the same methodology

    unlock_extra if $game_settings[:game_completed]String encoding

    The Base64 codification is useful for making secure communication between client and server.

    print Base64.encode("Hello World") #=> "sgvsbg8gv29ybgq="Using Base64.decode method you can return to the normal string.

    Version Class

    You can make a game version (to show in the title screen or for use in other scripts) just creating a version.ini file in the project's root, and writing inside a number with one or more digits, like

    1.2.50.3where

    1 is the major release, 2 the minor release, 50 the build and 3 the revision.

    You can call the game version from script using

    print $game_system.game_version #=> "1.0" by default, if no version.ini file is createdThis method returns a Version object file, that has the major, minor, build and revision public attributes, but with the .to_f method returns a formatted string.

    You can create a new version object by using

    new_version = Version.new("1.3.5.0")The versions are also comparable, then you can do this

    if new_version > $game_system.game_version  print "A new update is avaiable"endThere's much more described in the script documentation.

    Download

    You can download the script from GitHub.

    Blog's page

    FAQ

    Q: Is this script for everyone?

    A: A lot of my script require this module, then you have to copy and paste in your project. You can also use this script for your scripts, but it requires scripting skills.

    Q: Can I use this script for my commercial project?

    A: Yes, you can. all my scripts are distributed under CC-BY license. You just have to credit me.


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

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-17 21:14 , Processed in 0.135229 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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