设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 69|回复: 1
打印 上一主题 下一主题

[有事请教] 请问mz有办法用文本命令来输入名称框吗

[复制链接]

Lv2.观梦者

梦石
0
星屑
265
在线时间
23 小时
注册时间
2024-1-14
帖子
13
跳转到指定楼层
1
发表于 昨天 19:24 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 daguaidao 于 2024-10-25 00:50 编辑

类似于直接在每段对话前输入一段命令来显示对应的说话者,而不用单独再去改名称框

Lv3.寻梦者

梦石
0
星屑
2568
在线时间
431 小时
注册时间
2020-8-20
帖子
73
2
发表于 半小时前 | 只看该作者
1.有使用头像可以用AutoNamePopup.js
设定后读取头像自动输入名称

2.读取文本(name:x)输入名称
RUBY 代码复制
  1. (() => {
  2. const parameters = PluginManager.parameters(document.currentScript.src.split('/').pop().replace(/\.js$/, ""));
  3. const templateBase = parameters['template'] || "%1";
  4. const exclusionList = JSON.parse(parameters['exclusionList'] || "[]").map(cc => new RegExp(cc, "i"));
  5. const template = parameters['startNewLine'] === "true" ? `${templateBase}\n` : templateBase;
  6. const _Game_Message_prototype_add = Game_Message.prototype.add;
  7. Game_Message.prototype.add = function(text) {
  8. text = text.replace(/\(name:(\d+)\)/gi, (match, p1) => {
  9. return String($gameVariables.value(Number(p1)));
  10. });
  11.  
  12. text = Window_Message.prototype.convertEscapeCharacters.call(this, text);
  13. _Game_Message_prototype_add.call(this, text);
  14. };
  15.  
  16. const _Game_Interpreter_command101 = Game_Interpreter.prototype.command101;
  17. Game_Interpreter.prototype.command101 = function() {
  18. const params = this.currentCommand().parameters;
  19. const nextParams = this._list[this._index + 1]?.parameters;
  20.  
  21. if (nextParams) {
  22. const extractedName = nextParams[0].match(/\(name:(.+?)\)/)?.[1] || "";
  23. if (extractedName) {
  24. params[4] = template.replace('%1', extractedName);
  25. nextParams[0] = nextParams[0].replace(/\(name:.+?\)/gi, "").trim();
  26. }
  27. }
  28.  
  29. return _Game_Interpreter_command101.call(this, params);
  30. };
  31.  
  32. const _Window_Base_convertEscapeCharacters = Window_Base.prototype.convertEscapeCharacters;
  33. Window_Base.prototype.convertEscapeCharacters = function(text) {
  34. text = _Window_Base_convertEscapeCharacters.call(this, text).replace(/\(name:(.+?)\)/gi, (_, p1) => {
  35. const actor = $dataActors.find(actor => actor && actor.name === p1);
  36. return actor ? actor.name : p1;
  37. }).trim();
  38.  
  39. return text;
  40. };
  41. })();
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-10-25 14:29

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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