KinoCornell

171st Street Games
Member
Joined
Mar 8, 2017
Messages
17
Reaction score
2
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
875
Reaction score
594
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

171st Street Games
Member
Joined
Mar 8, 2017
Messages
17
Reaction score
2
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
875
Reaction score
594
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

171st Street Games
Member
Joined
Mar 8, 2017
Messages
17
Reaction score
2
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
875
Reaction score
594
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

171st Street Games
Member
Joined
Mar 8, 2017
Messages
17
Reaction score
2
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
875
Reaction score
594
First Language
English
Primarily Uses
RMMV
Don't thank me. Thank @SumRndmDde
I only tinkered with that thing you posted.
 

Latest Threads

Latest Posts

Latest Profile Posts

Starting work on some stuff for the community. Hopefully it will be fun, and useful to somebody.
Searching what to play in my dead times, the nostalgia hit me hard and ended downloading the Patapon trilogy, hope I can avenge my child self and beating all the games hahaha
Finished the frontier and...I apologize to anyone who saw the trailer I posted and actually tried it. Technical marvel, crazy disjointed fetish story hidden inside a cheap milsim skin that has no idea what it's trying to be except sanctimonious and failing at even that. As much as I hate fallout 4's story, even it was better. I guess there just won't be another non-parody fallout after all.
Anyone else having trouble posting in the forum? I have no reply box in posts or in messages. This is the only place I can type. @Archeia?

Forum statistics

Threads
107,763
Messages
1,031,986
Members
139,911
Latest member
Katara
Top