扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 140|回复: 0

[转载发布] 视觉小说 自动消息

[复制链接]
累计送礼:
0 个
累计收礼:
0 个
  • TA的每日心情
    开心
    昨天 17:34
  • 签到天数: 112 天

    连续签到: 2 天

    [LV.6]常住居民II

    2332

    主题

    398

    回帖

    1万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    6
    卡币
    10541
    OK点
    16
    推广点
    0
    同能卷
    0
    积分
    13299

    灌水之王

    发表于 2024-2-14 23:47:38 | 显示全部楼层 |阅读模式
    AltMenuScreen.js

    //=============================================================================
    // RPG Maker MZ - AutoMessage
    //=============================================================================

    /*:
    * @target MZ
    * @plugindesc 自动消息。
    * @author 雪あすか
    * @url https://twitter.com/askyq
    *
    *
    * @help 它是一个自动读消息的插件。
    *
    * [如何使用]
    *当指定编号的开关为 ON 时
    *自动读消息。
    *如果遇到选择项,就停在那里。
    *
    *
    * 【利用規約】
    * WTFPL
    *
    * 【更新履歴】
    * 1.0 初版公開
    *
    *
    * @param SwitchId
    * @text 开关号码
    * @desc 仅当指定编号的开关为 ON 时,才会自动发送消息。
    * @type switch
    * @default 0
    *
    * @param WaitMilliseconds
    * @text 读取间隔毫秒
    * @desc 指定等待的时间(以毫秒为单位)。 如果变量编号具有非零值,则忽略此设置。
    * @type number
    * @default 2500
    *
    * @param WaitMillisecondsVariableId
    * @text 读取间隔毫秒-变量编号
    * @desc 指定存储读取间隔(毫秒)的变量的编号。 这在值不是 0 时有效。
    * @type variable
    * @default 0
    */

    (() => {
      const PLUGIN_NAME = 'AutoMessage';
      const params = PluginManager.parameters(PLUGIN_NAME);

      const switchId = parseInt(params.SwitchId);
      const waitMilliseconds = parseInt(params.WaitMilliseconds);
      const waitMillisecondsVariableId = parseInt(params.WaitMillisecondsVariableId);

      let isTimerFilled = false;
      let timerId = 0;

      const Window_Message_isTriggered = Window_Message.prototype.isTriggered;
      Window_Message.prototype.isTriggered = function() {
        const _isTimerFilled = isTimerFilled;
        isTimerFilled = false;
        return (
            Window_Message_isTriggered.call(this) ||
            _isTimerFilled
        );
      };

      const Window_Message_startPause = Window_Message.prototype.startPause;
      Window_Message.prototype.startPause = function() {
        Window_Message_startPause.call(this);
       
        if (switchId) {
          if ($gameSwitches.value(switchId)) {
            let time = waitMilliseconds;
            if (waitMillisecondsVariableId) {
              time = $gameVariables.value(waitMillisecondsVariableId);
            }
            timerId = setTimeout(function() {
              isTimerFilled = true;
              timerId = 0;
            }, time);
          }
        }
      };

      const Window_Message_startMessage = Window_Message.prototype.startMessage;
      Window_Message.prototype.startMessage = function() {
        if (timerId) {
          clearTimeout(timerId);
          timerId = 0;
        }

        Window_Message_startMessage.call(this);
      };
    })();
                本帖来自P1论坛作者xuhao1996,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=490493  若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

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

    本版积分规则

    关闭

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2025-3-13 08:12 , Processed in 0.114222 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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