Additional Menu Windows

KinoCornell

Villager
Member
Joined
Mar 8, 2017
Messages
13
Reaction score
1
First Language
English
Primarily Uses
RMMV
I'm attempting to set up a menu using a flipped layout plugin from a very helpful YouTube tutorial video. The layout I'm using is in this very simple script here (I didn't create it):

/*:
* @plugindesc alt menu
* @author SumRndmDde
* @Help
*/

Scene_Menu.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
this.createCommandWindow();
this.createGoldWindow();
this.createStatusWindow();
/*
this._commandWindow
this._goldWindow
this._statusWindow
*/

this._statusWindow.x = 0;

this._commandWindow.x = this._statusWindow.width;

this._goldWindow.x = this._statusWindow.width;
this._goldWindow.y = this._commandWindow.height;

};

What I'm needing to do here is add a new window below the Command Window and above the Gold Window. That additional Window needs to have 3 lines of information:

1.) A dynamic string of text based on a value in one of my game variables.
2.) The display name of the current map.
3.) The current save file's playtime.

I know this probably seems super simple to most of you, but I am not very adept in JS. I've combed through several videos and posts trying to figure out how to do this myself (at least the second and third item to start with), but I cannot make it work.

The first item I'm not sure if I would have to do just a long series of "if..else" statements within the JS itself or if you can run a common event from the menu's JS to determine the string (to maybe streamline it?). But I have no idea how in the JS to reference an in-game variable and then display it as text.

Any help would be greatly appreciated. Thank you.
 

mogwai

1984
Veteran
Joined
Jun 10, 2014
Messages
876
Reaction score
586
First Language
English
Primarily Uses
RMMV
I just learned how to do this, tinkering around with that script you shown.

PHP:
Scene_Menu.prototype.create = function() {
    Scene_MenuBase.prototype.create.call(this);
    this.createCommandWindow();
    this.createGoldWindow();
    this.createStatusWindow();
   
    // begin custom window
    this._myCustomWindow = new Window_Help(4); // height is 4 lines
    this._myCustomWindow.x = 0;
    this._myCustomWindow.y = Graphics.boxHeight - this._myCustomWindow.height - this._goldWindow.height;
    this._myCustomWindow.width = this._goldWindow.width;
    this._myCustomWindow.visible = true;
    this._myCustomWindow.setText(
       "Attribute:"+
       "\n" +
       [
           "Message 0", // notice these messages
           "Message 1",
           "Message 2",
           "Message 3"
       ][
           $gameVariables.value(19) // notice this game variable
       ] +
       "\n" +
       $dataMapInfos[$gameMap._mapId].name +
       // $dataMap.displayName + // or maybe you want display name?
       "\n" +
       $gameSystem.playtimeText()
    );
    this.addWindow(this._myCustomWindow);
};
 

KinoCornell

Villager
Member
Joined
Mar 8, 2017
Messages
13
Reaction score
1
First Language
English
Primarily Uses
RMMV
Oh awesome! Thank you so much! One thing I'm trying to figure out, and I just tried throwing in some "if..else" statements but I can't get it to show up...

This is specific to the "Attribute" and "Message" part. I want this to show a rank based on how many in-game quests have been completed (stored in a specific variable).

I will ultimately replace the word "Attribute" with the word "Rank".
Then, where "Message 0" is, I want it to recognize when $gameVariables.value(5) is less than 10 and output the phrase "Amateur Mercenary."
Then when $gameVariables.value(5) is greater than 9 and less than 20 I want it to output "Novice Mercenary."
So and and so forth for each different "Rank" I have planned at specific quest completion.

I tried to modify your code like this:

// begin custom window
this._myCustomWindow = new Window_Help(4); // height is 4 lines
this._myCustomWindow.x = 0;
this._myCustomWindow.y = Graphics.boxHeight - this._myCustomWindow.height -

this._goldWindow.height;
this._myCustomWindow.width = this._goldWindow.width;
this._myCustomWindow.visible = true;
this._myCustomWindow.setText(
"Rank:"+
"\n" +
[
$gameVariables.value(5) // notice this game variable
]
[
if $gameVariables.value(5) < 10
"Amateur Mercenary";
else if $gameVariables.value(5) > 9 & < 20
"Novice Mercenary";
end;
] +
"\n" +
$dataMapInfos[$gameMap._mapId].name +
// $dataMap.displayName + // or maybe you want display name?
"\n" +
$gameSystem.playtimeText()
);
this.addWindow(this._myCustomWindow);
};

But I didn't do something right, and the entire window won't show up when it's like that. How can I fix it?
 

mogwai

1984
Veteran
Joined
Jun 10, 2014
Messages
876
Reaction score
586
First Language
English
Primarily Uses
RMMV
Where everything greater than 20 is Rank 4 and so forth...
PHP:
var index = $gameVariables.value(5) < 5  ? 0 :
            $gameVariables.value(5) < 10 ? 1 :
            $gameVariables.value(5) < 15 ? 2 :
            $gameVariables.value(5) < 20 ? 3 : 4;
this._myCustomWindow.setText(
   "Rank:"+
   "\n" +
   [
      "Rank 0",
      "Rank 1",
      "Rank 2",
      "Rank 3",
      "Rank 4"
   ][index] +
   "\n" +
   $dataMapInfos[$gameMap._mapId].name +
   // $dataMap.displayName + // or maybe you want display name?
   "\n" +
   $gameSystem.playtimeText()
);
 

KinoCornell

Villager
Member
Joined
Mar 8, 2017
Messages
13
Reaction score
1
First Language
English
Primarily Uses
RMMV
So if I'm sticking it in the right place, the final result should look like this?:

Scene_Menu.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
this.createCommandWindow();
this.createGoldWindow();
this.createStatusWindow();

// begin custom window
this._myCustomWindow = new Window_Help(4); // height is 4 lines
this._myCustomWindow.x = 0;
this._myCustomWindow.y = Graphics.boxHeight - this._myCustomWindow.height - this._goldWindow.height;
this._myCustomWindow.width = this._goldWindow.width;
this._myCustomWindow.visible = true;
var index = $gameVariables.value(5) < 5 ? 0 :
$gameVariables.value(5) < 10 ? 1 :
$gameVariables.value(5) < 15 ? 2 :
$gameVariables.value(5) < 20 ? 3 : 4;
this._myCustomWindow.setText(
"Attribute:"+
"\n" +
[
"Rank 0",
"Rank 1",
"Rank 2",
"Rank 3",
"Rank 4"
][index] +
"\n" +
$dataMapInfos[$gameMap._mapId].name +
// $dataMap.displayName + // or maybe you want display name?
"\n" +
$gameSystem.playtimeText()
);

Correct? I put it in there like this but the window just doesn't appear.
 

mogwai

1984
Veteran
Joined
Jun 10, 2014
Messages
876
Reaction score
586
First Language
English
Primarily Uses
RMMV
If that is the whole plugin, it has an unexpected end of input error.
It's missing addWindow and an END which in javascript is a curly brace }.
Code:
this.addWindow(this._myCustomWindow);
};
 

KinoCornell

Villager
Member
Joined
Mar 8, 2017
Messages
13
Reaction score
1
First Language
English
Primarily Uses
RMMV
That worked! I was able to get all of the different variable quantities and their corresponding output set up. I've tested it in-game and it all works perfectly! Thank you so much!!
 

mogwai

1984
Veteran
Joined
Jun 10, 2014
Messages
876
Reaction score
586
First Language
English
Primarily Uses
RMMV
Don't thank me. Thank @SumRndmDde
I only tinkered with that thing you posted.
 

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

Latest Threads

Latest Profile Posts

Brioche with a crème patissiere filling is so tasty!
A group of Game creators and others who trying to revive the Feel of Multiplayer and TOWN/ROLEPLAY games
Wow, lots of RPG Maker MV stuff on sale on Steam for 50%-75% off. Steam, why you not tell me?!
looking for help on top secret project
The nick "Toeuia" that I'm using comes from a, idk, you okay the chess game while chit chatting them. The first two are students. Then you know, finally, the champion, and then the champion's sensei. I played like this so many times until suddenly there's another chess master. Very naive but super smart. After he lost, he kinda advised me not to give up on chest. Because the next one was never seen beaten. Touya.

Forum statistics

Threads
99,380
Messages
964,643
Members
131,001
Latest member
funland
Top