查看: 2341|回复: 3

[有事请教] 如何不用插件,只用脚本显示一大篇书页的内容?

[复制链接]
梦石
0
星屑
5274
在线时间
733 小时
注册时间
2013-1-18
回帖
525
发表于 2022-12-26 11:07:03 | 显示全部楼层 |阅读模式

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

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

×
普通对话框只能显示几排内容,我想显示一大篇内容,比如打开一封信这样的效果,请问该怎么做呢?
梦石
0
星屑
10274
在线时间
1919 小时
注册时间
2020-1-2
回帖
1043
发表于 2022-12-26 12:06:09 | 显示全部楼层
滚动文字不就好了
B站没人气的夏目漠漠,直播间:5378938实用插件教程点击红字传送
回复

使用道具 举报

梦石
2
星屑
8479
在线时间
463 小时
注册时间
2021-12-4
回帖
486

MZ评测员

发表于 2022-12-26 12:53:47 | 显示全部楼层
试试这个官方插件,可以把多行文字视为一张图片显示呢。
  1. //=============================================================================
  2. // RPG Maker MV - Text Picture
  3. //=============================================================================

  4. /*:
  5. * @target MV
  6. * @plugindesc Displays text as a picture.
  7. * @author Yoji Ojima
  8. *
  9. * @help TextPicture.js
  10. *
  11. * This plugin provides a command to show text as a picture.
  12. *
  13. * Use it in the following procedure.
  14. *   1. Call the plugin command "Set Text Picture".
  15. *   2. Execute "Show Picture" without specifying an image.
  16. *
  17. * @command set
  18. * @text Set Text Picture
  19. * @desc Sets text to display as a picture.
  20. *       After this, execute "Show Picture" without specifying an image.
  21. *
  22. * @arg text
  23. * @type multiline_string
  24. * @text Text
  25. * @desc Text to display as a picture.
  26. *       Control characters are allowed.
  27. */

  28. (() => {
  29.     const pluginName = "TextPicture";
  30.     let textPictureText = "";

  31.     PluginManager.registerCommand(pluginName, "set", args => {
  32.         textPictureText = String(args.text);
  33.     });

  34.     const _Game_Picture_show = Game_Picture.prototype.show;
  35.     Game_Picture.prototype.show = function() {
  36.         _Game_Picture_show.apply(this, arguments);
  37.         if (this._name === "" && textPictureText) {
  38.             this.mzkp_text = textPictureText;
  39.             this.mzkp_textChanged = true;
  40.             textPictureText = "";
  41.         }
  42.     };

  43.     const _Sprite_Picture_destroy = Sprite_Picture.prototype.destroy;
  44.     Sprite_Picture.prototype.destroy = function() {
  45.         destroyTextPictureBitmap(this.bitmap);
  46.         _Sprite_Picture_destroy.apply(this, arguments);
  47.     };

  48.     const _Sprite_Picture_updateBitmap = Sprite_Picture.prototype.updateBitmap;
  49.     Sprite_Picture.prototype.updateBitmap = function() {
  50.         _Sprite_Picture_updateBitmap.apply(this, arguments);
  51.         if (this.visible && this._pictureName === "") {
  52.             const picture = this.picture();
  53.             const text = picture ? picture.mzkp_text || "" : "";
  54.             const textChanged = picture && picture.mzkp_textChanged;
  55.             if (this.mzkp_text !== text || textChanged) {
  56.                 this.mzkp_text = text;
  57.                 destroyTextPictureBitmap(this.bitmap);
  58.                 this.bitmap = createTextPictureBitmap(text);
  59.                 picture.mzkp_textChanged = false;
  60.             }
  61.         } else {
  62.             this.mzkp_text = "";
  63.         }
  64.     };

  65.     function createTextPictureBitmap(text) {
  66.         const tempWindow = new Window_Base(new Rectangle());
  67.         const size = tempWindow.textSizeEx(text);
  68.         tempWindow.padding = 0;
  69.         tempWindow.move(0, 0, size.width, size.height);
  70.         tempWindow.createContents();
  71.         tempWindow.drawTextEx(text, 0, 0, 0);
  72.         const bitmap = tempWindow.contents;
  73.         tempWindow.contents = null;
  74.         tempWindow.destroy();
  75.         bitmap.mzkp_isTextPicture = true;
  76.         return bitmap;
  77.     }

  78.     function destroyTextPictureBitmap(bitmap) {
  79.         if (bitmap && bitmap.mzkp_isTextPicture) {
  80.             bitmap.destroy();
  81.         }
  82.     }
  83. })();
复制代码
回复

使用道具 举报

梦石
0
星屑
5274
在线时间
733 小时
注册时间
2013-1-18
回帖
525
 楼主| 发表于 2022-12-26 13:12:51 | 显示全部楼层
本帖最后由 nhycs01 于 2022-12-26 13:15 编辑
小秋橙 发表于 2022-12-26 12:53
试试这个官方插件,可以把多行文字视为一张图片显示呢。
//============================================= ...


感谢指点,但是这个插件是不是有问题,我新建了一个新工程去试验,也出不来效果,按下F8也有提示错误。

事件里我是这样写的:

插件指令:Set Text Picture
显示图片:图像设置为“无”
显示对话框文字
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部