查看: 1222|回复: 1

[有事请教] 有没有独立的文本回放插件?

[复制链接]
梦石
0
星屑
10345
在线时间
1117 小时
注册时间
2015-2-10
回帖
164
发表于 2024-4-2 22:23:18 | 显示全部楼层 |阅读模式
悬赏100星屑已解决
如题,想要一个能在文本框中添加一个文本回放按钮的插件,点击后可以查看前几句文本。我知道有YEP的那个插件,但是那个插件需要一个前置的核心插件,而那个插件会和我用的一个根据角色名字改变字体颜色的插件冲突,装了那个核心插件会导致根据名字改变字体颜色的插件失效。所以有没有独立的一个文本回放的插件?

最佳答案

查看完整内容

上次在 https://rpg.blue/forum.php?mod=redirect&goto=findpost&ptid=493798&pid=2977660&fromuid=2731820 问我「渐变色+依名字变色」的也是这位楼主呢,不知道最后楼主是怎么解决那个问题的。关于文本回放我倒是在MV区 https://rpg.blue/forum.php?mod=redirect&goto=findpost&ptid=493739&pid=2977165&fromuid=2731820 回答过类似的问题,只不过对于MZ来说多了一个姓名框(下图右半部分的params[4])。 因此代码可以写成下面这 ...
梦石
2
星屑
8479
在线时间
463 小时
注册时间
2021-12-4
回帖
486

MZ评测员

发表于 2024-4-2 22:23:19 | 显示全部楼层
上次在 https://rpg.blue/forum.php?mod=r ... amp;fromuid=2731820 问我「渐变色+依名字变色」的也是这位楼主呢,不知道最后楼主是怎么解决那个问题的。关于文本回放我倒是在MV区 https://rpg.blue/forum.php?mod=r ... amp;fromuid=2731820 回答过类似的问题,只不过对于MZ来说多了一个姓名框(下图右半部分的params[4])。
截图.png
因此代码可以写成下面这样:
[pre lang="javascript" line="9788" file="backLog.js"]// Show Text
Game_Interpreter.prototype.command101 = function(params) {
    if ($gameMessage.isBusy()) {
        return false;
    }
    $gameMessage.setFaceImage(params[0], params[1]);
    $gameMessage.setBackground(params[2]);
    $gameMessage.setPositionType(params[3]);
    $gameMessage.setSpeakerName(params[4]);
    if ($gameTemp.backLog == null) $gameTemp.backLog = []; // 本行为新增内容,防止backLog数组不存在
    $gameTemp.backLog.unshift(params[4] + ':'); // 本行为新增内容,记录名字
    while (this.nextEventCode() === 401) {
        // Text data
        this._index++;
        $gameTemp.backLog.unshift(this.currentCommand().parameters[0]); // 本行为新增内容,记录正文
        $gameMessage.add(this.currentCommand().parameters[0]);
    }
    switch (this.nextEventCode()) {
        case 102: // Show Choices
            this._index++;
            this.setupChoices(this.currentCommand().parameters);
            break;
        case 103: // Input Number
            this._index++;
            this.setupNumInput(this.currentCommand().parameters);
            break;
        case 104: // Select Item
            this._index++;
            this.setupItemChoice(this.currentCommand().parameters);
            break;
    }
    this.setWaitMode("message");
    return true;
};[/pre]
然后楼主就可以在进行一些对话以后在F8控制台运行下面的代码查看到对话记录:
[pre lang="javascript" line="1"]if ($gameTemp.backLog != null) {
    let max = 5; // 最大回放条数,但若正文的某行以中文冒号结尾则会误判
    for (let i = $gameTemp.backLog.length; --i >= 0;) {
        let s = $gameTemp.backLog;
        if (s.endsWith(':') && --max < 0)
            break;
        console.log(s);
    }
}[/pre]
那么最后一步就是如何把这些记录在游戏中重现而不是通过console.log()打印到控制台,办法就比较多了,比如官方插件TextPicture什么的。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部