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

[转载发布] Adjustable Command Window and Text Colors

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

    连续签到: 2 天

    [LV.7]常住居民III

    9072

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 2026-7-27 10:57:26 | 显示全部楼层 |阅读模式
    Hey everyone,

    thought I'd share a couple of minor plugins I wrote for my project. Really nothing special, but perhaps useful for some of you.

    The first one is my Adjustable Commands Window plugin. It allows you to customize certain aspects of the command window on your title screen.

    Not too many options at the moment, but I might add more.

    SBX_Adjustable_CommandWindow.js

    Spoiler/*: * @plugindesc Allows you to adjust various settings for the command window. * * @author ShawnBaxe * * @param Enable Exit Command * @desc Whether the "exit" command is to be shown (set to false for mobile and web!) * @default true * * @param Exit Command Text * @desc The text to be displayed for the "exit" command * @default Exit Game * * @param Text Offset * @desc X offset for command items * @default 0 * * @param Text Align * @desc Valid values are left, right or center * @default left * * @param Text Color * @desc Adjust the text color here... * @default #ffffff * * @param Window Type * @desc Valid values are default, dim or hidden * @default default * * @help This plugin allows you to customize certains aspects of the command window (title screen). * You can show/hide the 'exit' command and customize its text for example. * * Besides that you can: * - Set an offset for the command window text * - Set an alignment for the text * - Adjust the text color (e.g. #ff5531) * - Set the window to either hidden (only text is being rendered), dimmed or default (normal visibility) * * Nothing fancy really, but it gives you some freedom of choice. */// Parameter collection --------------------------------------------------------var parameters = PluginManager.parameters('SBX_Adjustable_CommandWindow');// Adjustable parameters -------------------------------------------------------// Exit command-relatedvar showExitCommand     = String(parameters['Enable Exit Command'] || 'true');var exitCmdText         = String(parameters['Exit Command Text'] || 'Exit Game');// Text placementvar textAlignment       = String(parameters['Text Align'] || 'left');var textOffset          = Number(parameters['Text Offset'] || 0);// Text colorvar textColor           = String(parameters['Text Color'] || '#ffffff');// Window stylevar windowType          = String(parameters['Window Type'] || 'default');//==============================================================================// makeCommandList()//==============================================================================// Add commands to the title menu window (command window).//==============================================================================Window_TitleCommand.prototype.makeCommandList = function() {    this.addCommand(TextManager.newGame,   'newGame');    this.addCommand(TextManager.continue_, 'continue', this.isContinueEnabled());    this.addCommand(TextManager.options,   'options');    if(showExitCommand == 'true')    {           this.addCommand(exitCmdText, 'exitGame');    }};//==============================================================================// createCommandWindow()//==============================================================================// Create and show the command window//==============================================================================Scene_Title.prototype.createCommandWindow = function() {    this._commandWindow = new Window_TitleCommand();    this._commandWindow.setHandler('newGame',  this.commandNewGame.bind(this));    this._commandWindow.setHandler('continue', this.commandContinue.bind(this));    this._commandWindow.setHandler('options',  this.commandOptions.bind(this));    if(showExitCommand == 'true')    {        this._commandWindow.setHandler('exitGame', this.commandExitGame.bind(this));    }    // Set display mode/window style    switch(windowType)    {        case 'default':            this._commandWindow.setBackgroundType(0);            break;        case 'dim':            this._commandWindow.setBackgroundType(1);            break;        case 'hidden':            this._commandWindow.opacity = 0;            this._commandWindow.hideBackgroundDimmer();            break;    }    this.addWindow(this._commandWindow);};//==============================================================================// commandExitGame()//==============================================================================// COMMAND://                 Exit the game//==============================================================================Scene_Title.prototype.commandExitGame = function() {        this._commandWindow.close();        this.fadeOutAll();        SceneManager.exit();};//==============================================================================// drawItem()//==============================================================================// Draws a command window item//==============================================================================Window_Command.prototype.drawItem = function(index) {    var rect = this.itemRectForText(index);    var align = this.itemTextAlign();    this.changeTextColor(textColor);    this.changePaintOpacity(this.isCommandEnabled(index));    this.drawText(this.commandName(index), rect.x + textOffset, rect.y, rect.width, align);    this.resetTextColor();};//==============================================================================// itemTextAlign()//==============================================================================// Returns requested text alignment (left, right or center)//==============================================================================Window_Command.prototype.itemTextAlign = function() {    return textAlignment;};



    Example Screenshot:







    The second one allows you to change some text colors (for example for your stats). Again...nothing super cool, but maybe useful.

    SBX_Adjustable_TextColors.js

    Spoiler/*: * @plugindesc Allows you to adjust text colors. * * @author ShawnBaxe * * @param Stats Color * @desc Changes the color of stat values inside the menu (ATK, DEF, ...) * @default #88fa6a * * @param Experience Label Color * @desc * @default #79dcfd * * @param Level Label Color * @desc * @default #88fa6a * * @param HP Label Color * @desc * @default #f7ffa1 * * @param MP Label Color * @desc * @default #f7ffa1 * * @param TP Label Color * @desc * @default #f7ffa1 * * @param Equip Stat Color * @desc * @default #f7ffa1 * * @param Right Arrow Color * @desc * @default #f7ffa1 * * @param Equip Slot Color * @desc * @default #ffbb51 * * @param MP Cost Color * @desc * @default #f7ffa1 * * @param TP Cost Color * @desc * @default #f7ffa1 * * @param Stat Gain Color * @desc * @default #88fa6a * * @param Stat Loss Color * @desc * @default #ff5151 * * @param Stat NoChange Color * @desc * @default #ffffff * * @help Customize text colors to your liking. Most text blocks * are covered - at least those you find in the menu. */// Parameter collection --------------------------------------------------------var parameters = PluginManager.parameters('SBX_Adjustable_TextColors');// Adjustable parameters -------------------------------------------------------var parameterColor      = String(parameters['Stats Color']          || '#88fa6a');var expInfoColor        = String(parameters['Experience Label Color']|| '#79dcfd');var levelColor          = String(parameters['Level Label Color']    || '#88fa6a');var hpLabelColor        = String(parameters['HP Label Color']       || '#f7ffa1');var mpLabelColor        = String(parameters['MP Label Color']       || '#f7ffa1');var tpLabelColor        = String(parameters['TP Label Color']       || '#f7ffa1');var equipParamColor     = String(parameters['Equip Stat Color']     || '#f7ffa1');var rightArrowColor     = String(parameters['Right Arrow Color']    || '#f7ffa1');var equipSlotColor      = String(parameters['Equip Slot Color']     || '#ffbb51');var mpCostColor         = String(parameters['MP Cost Color']        || '#f7ffa1');var tpCostColor         = String(parameters['TP Cost Color']        || '#f7ffa1');var statGainColor       = String(parameters['Stat Gain Color']      || '#88fa6a');var statLossColor       = String(parameters['Stat Loss Color']      || '#ff5151');var statNoChangeColor   = String(parameters['Stat NoChange Color']  || '#ffffff');//==============================================================================// Level text//==============================================================================Window_Base.prototype.drawActorLevel = function(actor, x, y) {    this.changeTextColor(levelColor);    this.drawText(TextManager.levelA, x, y, 48);    this.resetTextColor();    this.drawText(actor.level, x + 84, y, 36, 'right');};//==============================================================================// drawActorHp()//==============================================================================// Draws HP-related stuff (gauge, label, etc.)//==============================================================================Window_Base.prototype.drawActorHp = function(actor, x, y, width) {    width = width || 186;    var color1 = this.hpGaugeColor1();    var color2 = this.hpGaugeColor2();    this.drawGauge(x, y, width, actor.hpRate(), color1, color2);    this.changeTextColor(hpLabelColor);    this.drawText(TextManager.hpA, x, y, 44);    this.drawCurrentAndMax(actor.hp, actor.mhp, x, y, width,                           this.hpColor(actor), this.normalColor());};//==============================================================================// drawActorMp()//==============================================================================// Draws MP-related stuff (gauge, label, etc.)//==============================================================================Window_Base.prototype.drawActorMp = function(actor, x, y, width) {    width = width || 186;    var color1 = this.mpGaugeColor1();    var color2 = this.mpGaugeColor2();    this.drawGauge(x, y, width, actor.mpRate(), color1, color2);    this.changeTextColor(mpLabelColor);    this.drawText(TextManager.mpA, x, y, 44);    this.drawCurrentAndMax(actor.mp, actor.mmp, x, y, width,                           this.mpColor(actor), this.normalColor());};//==============================================================================// drawActorTp()//==============================================================================// Draws TP-related stuff (gauge, label, etc.)//==============================================================================Window_Base.prototype.drawActorTp = function(actor, x, y, width) {    width = width || 96;    var color1 = this.tpGaugeColor1();    var color2 = this.tpGaugeColor2();    this.drawGauge(x, y, width, actor.tpRate(), color1, color2);    this.changeTextColor(tpLabelColor);    this.drawText(TextManager.tpA, x, y, 44);    this.changeTextColor(this.tpColor(actor));    this.drawText(actor.tp, x + width - 64, y, 64, 'right');};//==============================================================================// drawParameters()//==============================================================================// Draws Parameter values (ATK, DEF, etc.)//==============================================================================Window_Status.prototype.drawParameters = function(x, y) {    var lineHeight = this.lineHeight();    for (var i = 0; i < 6; i++) {        var paramId = i + 2;        var y2 = y + lineHeight * i;        this.changeTextColor(parameterColor);        this.drawText(TextManager.param(paramId), x, y2, 160);        this.resetTextColor();        this.drawText(this._actor.param(paramId), x + 160, y2, 60, 'right');    }};//==============================================================================// drawParamName()//==============================================================================// Draws parameter names (ATK, DEF, etc.)//==============================================================================Window_EquipStatus.prototype.drawParamName = function(x, y, paramId) {    this.changeTextColor(equipParamColor);    this.drawText(TextManager.param(paramId), x, y, 120);};//==============================================================================// drawRightArrow()//==============================================================================// Draws right arrow as used for parameter comparisons (equip)//==============================================================================Window_EquipStatus.prototype.drawRightArrow = function(x, y) {    this.changeTextColor(rightArrowColor);    this.drawText('\u2192', x, y, 32, 'center');};//==============================================================================// drawNewParam()//==============================================================================// Draws new parameter values (equip)//==============================================================================Window_EquipStatus.prototype.drawNewParam = function(x, y, paramId) {    var newValue = this._tempActor.param(paramId);    var diffvalue = newValue - this._actor.param(paramId);    if(diffvalue < 0)    {        this.changeTextColor(statLossColor);    }    else if(diffvalue == 0)    {        this.changeTextColor(statNoChangeColor);    }    else    {        this.changeTextColor(statGainColor);    }    //this.changeTextColor(this.paramchangeTextColor(diffvalue));    this.drawText(newValue, x, y, 48, 'right');};//==============================================================================// drawItem()//==============================================================================// Draws slot and item names for the equipment menu//==============================================================================Window_EquipSlot.prototype.drawItem = function(index) {    if (this._actor) {        var rect = this.itemRectForText(index);        this.changeTextColor(equipSlotColor);        this.changePaintOpacity(this.isEnabled(index));        this.drawText(this.slotName(index), rect.x, rect.y, 138, this.lineHeight());        this.drawItemName(this._actor.equips()[index], rect.x + 138, rect.y);        this.changePaintOpacity(true);    }};//==============================================================================// drawExpInfo()//==============================================================================// Draws Experience-related stuff//==============================================================================Window_Status.prototype.drawExpInfo = function(x, y) {    var lineHeight = this.lineHeight();    var expTotal = TextManager.expTotal.format(TextManager.exp);    var expNext = TextManager.expNext.format(TextManager.level);    var value1 = this._actor.currentExp();    var value2 = this._actor.nextRequiredExp();    if (this._actor.isMaxLevel()) {        value1 = '-------';        value2 = '-------';    }    this.changeTextColor(expInfoColor);    this.drawText(expTotal, x, y + lineHeight * 0, 270);    this.drawText(expNext, x, y + lineHeight * 2, 270);    this.resetTextColor();    this.drawText(value1, x, y + lineHeight * 1, 270, 'right');    this.drawText(value2, x, y + lineHeight * 3, 270, 'right');};



    Example Screenshot:







    Since I haven't done any scripting for any RPG Maker so far (and I even don't use JS that much...I'm a C++ guy), I'm sure my scripts aren't particularly good in style, efficiency and so forth, but they do work.

    Hope you like this stuff. Feedback is always appreciated  



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

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-22 06:58 , Processed in 0.145455 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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