Write more word in the choice box text

Lolilord

Villager
Member
Joined
Feb 8, 2019
Messages
7
Reaction score
0
First Language
French
Primarily Uses
RMMV
Hello everybody!

This is my first post and i am pretty new to Rpg maker.

I was looking for a plugin that could allowed me to have longer message in the choice box text.
I tryed the one from yanfly.moe and it is already cool but the problem is that each line is a choice so when you scroll down to change choices it goes line by line and not paragraph by paragraph.

I was looking for something that can allowed me to write more than one line and 7 or 8 word per choice.

Thank you in advance and have a great day!
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,842
Reaction score
5,225
First Language
Dutch
Primarily Uses
RMXP

I've moved this thread to Plugin Requests. Please be sure to post your threads in the correct forum next time. Thank you.

 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,492
Reaction score
408
First Language
German
Primarily Uses
RMMV
You could use Eventcommand Textbox directly infront of Eventcommand show Choices,
thatway both is shown on the Screen at the same Time. I know its not what you asked for, but maybe it helps.
 

Lolilord

Villager
Member
Joined
Feb 8, 2019
Messages
7
Reaction score
0
First Language
French
Primarily Uses
RMMV
Hi!
Yes for now i am using this and it is helpful but it's true that i think it would be nicer to have the full text when you choose.

But thank you for your advise and for taking the time to answer =).
 

Magnus0808

Software Developer
Veteran
Joined
Feb 2, 2019
Messages
147
Reaction score
166
First Language
Danish
Primarily Uses
RMMV
I made a plugin for you. I used way more time than I thought I would on this to be honest.
This lets you add a linebreak "\n" to a choice. By doing this you can have more than one line per choice :)

If you have any questions feel free to ask :)

EDIT: I fixed some bugs I found
EDIT: I fixed some more bugs!!

Code:
//=============================================================================
// MultiLineChoices.js
//=============================================================================

/*:
 * @plugindesc This plugin lets the user add line breaks to choices. Making
 * him/her able to have multi-line choices.
 * has left on his/her turn.
 * @author Magnus0808
 *
 * @help Insert \n to add a new line break in a choice.
 */
(function() {
    
    Window_ChoiceList.prototype.update = function() {
        Window_Selectable.prototype.update.call(this);
    };
    
    Window_ChoiceList.prototype.processEscapeCharacter = function(code, textState) {
        switch (code) {
            case 'N':
                this.processNewLine(textState);
                break;
            case 'C':
                this.changeTextColor(this.textColor(this.obtainEscapeParam(textState)));
                break;
            case 'I':
                this.processDrawIcon(this.obtainEscapeParam(textState), textState);
                break;
            case '{':
                this.makeFontBigger();
                break;
            case '}':
                this.makeFontSmaller();
                break;
        }
    };
    
    Window_ChoiceList.prototype.topIndex = function () {
        var index = 0;
        var y = this.itemHeight() * this.calcLines(0);
        while(this._scrollY >= y) {
            var lines = this.calcLines(index);
            if(lines > 0) {
                y += this.itemHeight() * lines;
                index++;
            } else {
                break;
            }
        }
        return index;
    }
    
    Window_ChoiceList.prototype.lineStart = function (index) {
        return Math.floor(this.calcRectY(index) / this.itemHeight())
    }
    
    Window_ChoiceList.prototype.drawAllItems = function() {
        var topIndex = this.topIndex();
        var index = topIndex;
        var totalLines = this.lineStart(index) - this.topRow();
        while(totalLines < this.maxPageItems()){
            var lines = this.calcLines(index);
            if(lines > 0) {
                if (index < this.maxItems()) {
                    this.drawItem(index);
                }
                totalLines += lines;
                index++;
            } else {
                break;
            }
        }

    };
    
    Window_ChoiceList.prototype.maxRows = function() {
        return this.calcTotalLines();
    };

    Window_ChoiceList.prototype.contentsHeight = function() {
        return this.height - this.standardPadding() * 2;
    };
    
    Window_ChoiceList.prototype.maxChoiceWidth = function() {
        var maxWidth = 96;
        var choices = $gameMessage.choices();
        for (var i = 0; i < choices.length; i++) {
            var lines = choices[i].split(/\\n/);
            for(var j = 0; j < lines.length; j++) {
                var choiceWidth = this.textWidthEx(lines[j]) + this.textPadding() * 2;
                if (maxWidth < choiceWidth) {
                    maxWidth = choiceWidth;
                }
            }
        }
        return maxWidth;
    };
    
    Window_ChoiceList.prototype.isCursorVisible = function() {
        var row = this.row();
        var upperRow = this.upperRow();
        return (row >= this.topRow() && row <= this.bottomRow()) || (upperRow >= this.topRow() && upperRow <= this.bottomRow());
    };
    
    Window_ChoiceList.prototype.ensureCursorVisible = function() {
        var row = this.row();
        var upperRow = this.upperRow();
        if (row < this.topRow()) {
            this.setTopRow(row);
        } else if (upperRow > this.bottomRow()) {
            this.setBottomRow(upperRow);
        }
    };
    
    Window_ChoiceList.prototype.row = function() {
        var row = 0;
        for (var i = 0; i < this.index(); i++){
            row += this.calcLines(i);
        }
        return row;
    };
    
    Window_ChoiceList.prototype.upperRow = function() {
        var row = this.row();
        return row + this.calcLines(this.index()) - 1;
    }
    
    Window_ChoiceList.prototype.numVisibleRows = function() {
        var messageY = this._messageWindow.y;
        var messageHeight = this._messageWindow.height;
        var centerY = Graphics.boxHeight / 2;
        var choices = $gameMessage.choices();
        var numLines = this.calcTotalLines();
        var maxLines = 8;
        if (messageY < centerY && messageY + messageHeight > centerY) {
            maxLines = 4;
        }
        if (numLines > maxLines) {
            numLines = maxLines;
        }
        return numLines;
    };
    
    Window_ChoiceList.prototype.calcTotalLines = function () {
        var numLines = 0;
        for (var i = 0; i < $gameMessage.choices().length; i++) {
            numLines += this.calcLines(i);
        }
        return numLines;
    }
    
    Window_ChoiceList.prototype.calcLines = function (index) {
        var choices = $gameMessage.choices();
        if(choices[index]) {
            return choices[index].split(/\\n/).length;           
        } else {
            return 0;
        }
    }

    Window_ChoiceList.prototype.calcRectY = function(index) {
        if($gameMessage.choices().length == 0) return 0;
        var y = 0;
        for (var i = 0; i < index; i++){
            y += this.itemHeight() * this.calcLines(i);
        }
        return y;
    }
    
    
    Window_ChoiceList.prototype.itemRect = function(index) {
        var rect = new Rectangle();
        var maxCols = this.maxCols();
        rect.width = this.itemWidth();
        if($gameMessage.choices().length != 0){
            rect.height = this.itemHeight() * this.calcLines(index);
        } else {
            rect.height = this.itemHeight();
        }
        rect.x = index % maxCols * (rect.width + this.spacing()) - this._scrollX;
        rect.y = this.calcRectY(index) - this._scrollY;
        return rect;
    };
    

})();
 

Attachments

Last edited:

Lolilord

Villager
Member
Joined
Feb 8, 2019
Messages
7
Reaction score
0
First Language
French
Primarily Uses
RMMV
Hi!
Wow thank you very much that's really really cool =) !

Also I am sorry but because I am pretty new I am not sure on what to do here.
Why should I copy and paste and where should I put it?

And for the \n I should put It in the middle of the message to break it into two line right ?

Thanks you again =)!
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,492
Reaction score
408
First Language
German
Primarily Uses
RMMV
Tutorial about plugins:

For the \n position....just test all 3 possible Positions and find out by testing.
I dont know and thats how i would do it. My Guess would be at the end of Textline1.
 

Lolilord

Villager
Member
Joined
Feb 8, 2019
Messages
7
Reaction score
0
First Language
French
Primarily Uses
RMMV
Thank you very much!
I will try that tomorow and i will late you know!
Thanks again =).
 

Lolilord

Villager
Member
Joined
Feb 8, 2019
Messages
7
Reaction score
0
First Language
French
Primarily Uses
RMMV
I tried and it worked!
Magnus great work thanks!
I am just strarting my firt game and i don't know where it 's going to go but in case of i want to sell it can i use your plugin for commercial
purpose?
If yes do you have a website or something? like that i can put a link on the credit?

Thank you for Both of you!!
 

Magnus0808

Software Developer
Veteran
Joined
Feb 2, 2019
Messages
147
Reaction score
166
First Language
Danish
Primarily Uses
RMMV
Hi, I discovered a major bug in the plugin that occurred when scrolling. That made some choices not appear and such. I have fixed the bug and edited my original response with the changes.

Yes you are free to use the plugin for commercial purpose for your game. You can just credit me by name, Magnus0808. I do not have a website as I am just writing plugins for random people for fun at the moment. If I ever do get a website I'll let you know :)
 

Lolilord

Villager
Member
Joined
Feb 8, 2019
Messages
7
Reaction score
0
First Language
French
Primarily Uses
RMMV
Ok thank you for fixing the bug i just tried for two sentence so i have not seen it!

Thanks for your help again!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,867
Messages
1,017,061
Members
137,575
Latest member
akekaphol101
Top