Digital Religion

Dark Devil
Veteran
Joined
Jan 10, 2013
Messages
111
Reaction score
36
First Language
English
Primarily Uses
RMMV
Ok This is driving me insane.

I have a parameter set like so.
Code:
 * @param Status Window Opacity
 * @desc Enter window transparancy.
 * @default 0
 *
I then have this code referencing it.
Code:
this._statusWindow.opacity = parameters['Status Window Opacity'];

Now when i run my project with the the parameter set in place I get the error.
Undefined is not a function...

But if I just manual put in
Code:
this._statusWindow.opacity = 0;
Then run the game. It works just fine.

I am at a loss. The error refers to this in the console.
Code:
SceneManager.catchException = function(e) {
    if (e instanceof Error) {
        Graphics.printError(e.name, e.message);
        console.error(e.stack); <------ Stops right here
    } else {
        Graphics.printError('UnknownError', e);
    }
    AudioManager.stopAll();
    this.stop();
};

Any help would be appreciated. Thank you in advanced. I am still learning JS.
 

Sarlecc

Veteran
Veteran
Joined
Sep 16, 2012
Messages
453
Reaction score
211
First Language
English
Primarily Uses
RMMV
You need to first get the parameters from the PluginManager like so:
Code:
var parameters = PluginManager.parameters("myPlugin");
Then since you want a number you need to convert it to one using parseInt for example:
Code:
var aNumber = parseInt(parameters.myNumber || 0, 10);
Notice that I am basically saying that if myNumber does not exist use 0 instead using 10 as the base.
Now you can assign aNumber where you need it.
 

Digital Religion

Dark Devil
Veteran
Joined
Jan 10, 2013
Messages
111
Reaction score
36
First Language
English
Primarily Uses
RMMV
Hmm that's not working for some reason either. but maybe I'm not inputing it. right here is the whole script.
Plus the need to be able to put any number in there. the values equal 0 to 255.

i added the
Code:
    var StatusOpacity = parseInt(parameters.myNumber || 0, 10);
and then
Code:
 this._statusWindow.opacity = StatusOpacity;

but it doesn't do anything. :/

Here is the whole script
Code:
/*:
 * @plugindesc RPGMV UI Creator - Menu CORE
 * @author Digital Religion  
 *
 * 
 * --- Command Window Parameters ---
 *
 * @param --- Command Window ---
 * @default Settings for Command Window
 *
 * @param Command Window X Position
 * @desc Enter the X Cord you want your Command window to be. Value is in px.
 * @default 0
 *
 * @param Command Window Y Position
 * @desc Enter the Y Cord you want your Command window to be. Value is in px.
 * @default 0
 *
 * @param Command Window Width
 * @desc Enter the Width you want your Command window to be. Value is in px.
 * @default 240
 *
 * @param Command Window Height
 * @desc Enter the Height you want your Command window to be. Value is in px.
 * @default 325
 *
 * @param Command Window Rows
 * @desc Enter how many rows the Command window should have.
 * @default 1
 *
 * @param Command Window Cols
 * @desc Enter how many Columns the Command window should have.
 * @default 1
 *
 * @param --- Gold Window ---
 * @default Settings for Gold Window
 *
 * @param Gold Window X Position
 * @desc Enter the X Cord you want your Gold window to be. Value is in px.
 * @default 0
 *
 * @param Gold Window Y Position
 * @desc Enter the Y Cord you want your Gold window to be. Value is in px.
 * @default 559
 *
 * @param Gold Window Width
 * @desc Enter the Width you want your Gold window to be. Value is in px.
 * @default 240
 *
 * @param Gold Window Height
 * @desc Enter the Height you want your Gold window to be. Value is in px.
 * @default 65
 *
 * @param Gold Window Rows
 * @desc Enter how many rows the Gold window should have.
 * @default 1
 *
 * @param Gold Window Cols
 * @desc Enter how many Columns the Gold window should have.
 * @default 1
 *
 *
 * @param --- Status Window ---
 * @default Settings for Gold Window
 *
 * @param Status Window X Position
 * @desc Enter the X Cord you want your Status window to be. Value is in px.
 * @default 240
 *
 * @param Status Window Y Position
 * @desc Enter the Y Cord you want your Status window to be. Value is in px.
 * @default 0
 *
 * @param Status Window Width
 * @desc Enter the Width you want your Status window to be. Value is in px.
 * @default 576
 *
 * @param Status Window Height
 * @desc Enter the Height you want your Status window to be. Value is in px.
 * @default 625
 *
 * @param Status Window Rows
 * @desc Enter how many rows the Status window should have.
 * @default 4
 *
 * @param Status Window Cols
 * @desc Enter how many Columns the Status window should have.
 * @default 1
 *
 * @param Status Window Trans
 * @desc Enter how many Columns the Status window should have.
 * @default 1
 *
 */
(function () {
    //Create Background
    Scene_MenuBase.prototype.createBackground = function() {
        this._backgroundSprite = new Sprite();
        this._backgroundSprite.bitmap = ImageManager.loadPicture('dcbg');
        this.addChild(this._backgroundSprite);
    };
   
    //Initialize Plugin
    var parameters = PluginManager.parameters('UIC-MainMenus-Alpha');
    var StatusOpacity = parseInt(parameters.myNumber || 0, 10);
   
    //Overwrite Scene_Menu
    var _Scene_Menu_Create = Scene_Menu.prototype.create;
    Scene_Menu.prototype.create = function () {
        _Scene_Menu_Create.call(this);
        //Command Window Position  
        this._commandWindow.x = parameters['Command Window X Position'];
        this._commandWindow.y = parameters['Command Window Y Position'];
       
        //Gold Window Position  
        this._goldWindow.x = parameters['Gold Window X Position'];
        this._goldWindow.y = parameters['Gold Window Y Position'];
       
        //Status Window Position
        this._statusWindow.x = parameters['Status Window X Position'];
        this._statusWindow.y = parameters['Status Window Y Position'];
        this._statusWindow.opacity = StatusOpacity;
   
    };  
   
       
    //Size and Layout of Command Menu
    Window_MenuCommand.prototype.windowWidth = function () { return parameters['Command Window Width']; };
    Window_MenuCommand.prototype.windowHeight = function () { return parameters['Command Window Height']; };
    Window_MenuCommand.prototype.numVisibleRows = function () { return parameters['Command Window Rows']; };
    Window_MenuCommand.prototype.maxCols = function () { return parameters['Command Window Cols']; };
       
    //Size and Layout of Gold Window
    Window_Gold.prototype.windowWidth = function () { return parameters['Gold Window Width']; };
    Window_Gold.prototype.windowHeight = function () { return parameters['Gold Window Height']; };
    Window_Gold.prototype.numVisibleRows = function () { return parameters['Gold Window Rows']; };
    Window_Gold.prototype.maxCols = function () { return parameters['Gold Window Cols']; };

    //Size and Layout of Gold Window
    Window_MenuStatus.prototype.windowWidth = function () { return parameters['Status Window Width']; };
    Window_MenuStatus.prototype.windowHeight = function () { return parameters['Status Window Height']; };
    Window_MenuStatus.prototype.numVisibleRows = function () { return parameters['Status Window Rows']; };
    Window_MenuStatus.prototype.maxCols = function () { return parameters['Status Window Cols']; };
   
})();

But if i remove those two lines everything works fine again.
 

Digital Religion

Dark Devil
Veteran
Joined
Jan 10, 2013
Messages
111
Reaction score
36
First Language
English
Primarily Uses
RMMV
AHHHH I see what I did wrong. I wasnt using myNumber as the Parameter. I get it.
 

Digital Religion

Dark Devil
Veteran
Joined
Jan 10, 2013
Messages
111
Reaction score
36
First Language
English
Primarily Uses
RMMV
but now its more like a switch then being able to add any number, :/
 

Digital Religion

Dark Devil
Veteran
Joined
Jan 10, 2013
Messages
111
Reaction score
36
First Language
English
Primarily Uses
RMMV
Nope actually that didnt work at all. Now if it was on StatusWindow.x = then it works fine but when i put it on opacity i get the same undefinded function error.

here is the current code.
Code:
/*:
 * @plugindesc RPGMV UI Creator - Menu CORE
 * @author Digital Religion   
 *
 * --- Command Window Parameters ---
 *
 * @param --- Command Window ---
 * @default Settings for Command Window
 *
 * @param Command Window X Position
 * @desc Enter the X Cord you want your Command window to be. Value is in px.
 * @default 0
 *
 * @param Command Window Y Position
 * @desc Enter the Y Cord you want your Command window to be. Value is in px.
 * @default 0
 *
 * @param Command Window Width
 * @desc Enter the Width you want your Command window to be. Value is in px.
 * @default 240
 *
 * @param Command Window Height
 * @desc Enter the Height you want your Command window to be. Value is in px.
 * @default 325
 *
 * @param Command Window Rows
 * @desc Enter how many rows the Command window should have.
 * @default 1
 *
 * @param Command Window Cols
 * @desc Enter how many Columns the Command window should have.
 * @default 1
 *
 * @param --- Gold Window ---
 * @default Settings for Gold Window
 *
 * @param Gold Window X Position
 * @desc Enter the X Cord you want your Gold window to be. Value is in px.
 * @default 0
 *
 * @param Gold Window Y Position
 * @desc Enter the Y Cord you want your Gold window to be. Value is in px.
 * @default 559
 *
 * @param Gold Window Width
 * @desc Enter the Width you want your Gold window to be. Value is in px.
 * @default 240
 *
 * @param Gold Window Height
 * @desc Enter the Height you want your Gold window to be. Value is in px.
 * @default 65
 *
 * @param Gold Window Rows
 * @desc Enter how many rows the Gold window should have.
 * @default 1
 *
 * @param Gold Window Cols
 * @desc Enter how many Columns the Gold window should have.
 * @default 1
 *
 *
 * @param --- Status Window ---
 * @default Settings for Gold Window
 *
 * @param Status Window X Position
 * @desc Enter the X Cord you want your Status window to be. Value is in px.
 * @default 240
 *
 * @param Status Window Y Position
 * @desc Enter the Y Cord you want your Status window to be. Value is in px.
 * @default 0
 *
 * @param Status Window Width
 * @desc Enter the Width you want your Status window to be. Value is in px.
 * @default 576
 *
 * @param Status Window Height
 * @desc Enter the Height you want your Status window to be. Value is in px.
 * @default 625
 *
 * @param Status Window Rows
 * @desc Enter how many rows the Status window should have.
 * @default 4
 *
 * @param Status Window Cols
 * @desc Enter how many Columns the Status window should have.
 * @default 1
 *
 * @param myNumber
 * @desc Enter how many Columns the Status window should have.
 * @default 0
 *
 */
(function () {
    //Create Background
    Scene_MenuBase.prototype.createBackground = function() {
        this._backgroundSprite = new Sprite();
        this._backgroundSprite.bitmap = ImageManager.loadPicture('dcbg');
        this.addChild(this._backgroundSprite);
    };
    
    //Initialize Plugin
    var parameters = PluginManager.parameters('UIC-MainMenus-Alpha');
    var StatusOpacity = parseInt(parameters.myNumber || 0, 255);
    
    //Overwrite Scene_Menu
    var _Scene_Menu_Create = Scene_Menu.prototype.create;
    Scene_Menu.prototype.create = function () {
        _Scene_Menu_Create.call(this);
        //Command Window Position   
        this._commandWindow.x = parameters['Command Window X Position'];
        this._commandWindow.y = parameters['Command Window Y Position'];
        
        //Gold Window Position   
        this._goldWindow.x = parameters['Gold Window X Position'];
        this._goldWindow.y = parameters['Gold Window Y Position'];
        
        //Status Window Position
        this._statusWindow.x = parameters['Status Window X Position'];
        this._statusWindow.y = parameters['Status Window Y Position'];
        this._statusWindow.opacity  = parameters['myNumber'];
    };   
        
    //Size and Layout of Command Menu
    Window_MenuCommand.prototype.windowWidth = function () { return parameters['Command Window Width']; };
    Window_MenuCommand.prototype.windowHeight = function () { return parameters['Command Window Height']; };
    Window_MenuCommand.prototype.numVisibleRows = function () { return parameters['Command Window Rows']; };
    Window_MenuCommand.prototype.maxCols = function () { return parameters['Command Window Cols']; };
        
    //Size and Layout of Gold Window
    Window_Gold.prototype.windowWidth = function () { return parameters['Gold Window Width']; };
    Window_Gold.prototype.windowHeight = function () { return parameters['Gold Window Height']; };
    Window_Gold.prototype.numVisibleRows = function () { return parameters['Gold Window Rows']; };
    Window_Gold.prototype.maxCols = function () { return parameters['Gold Window Cols']; };

    //Size and Layout of Gold Window
    Window_MenuStatus.prototype.windowWidth = function () { return parameters['Status Window Width']; };
    Window_MenuStatus.prototype.windowHeight = function () { return parameters['Status Window Height']; };
    Window_MenuStatus.prototype.numVisibleRows = function () { return parameters['Status Window Rows']; };
    Window_MenuStatus.prototype.maxCols = function () { return parameters['Status Window Cols']; };
    
})();
 

Sarlecc

Veteran
Veteran
Joined
Sep 16, 2012
Messages
453
Reaction score
211
First Language
English
Primarily Uses
RMMV
Note that the parameters.myNumber was just an example variable. In your case since you use spaces in your parameter names you need to use the bracket notation or parameters["Status Window Opacity"]. I also noticed you did not have Status Window Opacity listed as a parameter in your script. So a complete example would be:
Code:
/*:
* @param Status Window Opacity
* @desc Opacity of the status window
* @default 0
*/
(function () {
var parameters = PluginManager.parameters('UIC-MainMenus-Alpha');
var StatusOpacity = parseInt(parameters["Status Window Opacity"] || 0, 10);

 // do some stuff
     Scene_MenuBase.prototype.setOpacity = function () {
         if (StatusOpacity >= 0 || StatusOpacity <= 255) {
             this._statusWindow.opacity = StatusOpacity;
         } else {
             this._statusWindow.opacity = 0;
         }
     }
})()
 
Last edited:

Digital Religion

Dark Devil
Veteran
Joined
Jan 10, 2013
Messages
111
Reaction score
36
First Language
English
Primarily Uses
RMMV
That is actually what it was named before i just called it myNumber to quickly test it out your snippet.
But the if statement is still seems a bit much. May if I simplify the question a bit.

I just need it to input what ever number they input in the plugin manager to be input into that parameter.

And every way i do it. whether I use a variable or just a direct @param Command Window Opacity and parameters['Command Window Opacity'] or even try doing it with a variable. So basically no matter what input has been getting put in there it wont excpet it. but it I manually type it in and remove the paramater it works fine.
 

Digital Religion

Dark Devil
Veteran
Joined
Jan 10, 2013
Messages
111
Reaction score
36
First Language
English
Primarily Uses
RMMV
it just seems no matter what parameter is set in there it just wont use it. Still get the undefinded is not a function.
Basically
this._statusWindow.opacity = 0; <--- any number here works. the value equals the opacity level. but only if i hand code it.
this._statusWindow.opacity = parameters['Status Window Opacity']; <-- any param i put here wont work


Code:
/*:
 * @plugindesc RPGMV UI Creator - Menu CORE
 * @author Digital Religion   
 *
 * --- Command Window Parameters ---
 *
 * @param --- Command Window ---
 * @default Settings for Command Window
 *
 * @param Command Window X Position
 * @desc Enter the X Cord you want your Command window to be. Value is in px.
 * @default 0
 *
 * @param Command Window Y Position
 * @desc Enter the Y Cord you want your Command window to be. Value is in px.
 * @default 0
 *
 * @param Command Window Width
 * @desc Enter the Width you want your Command window to be. Value is in px.
 * @default 240
 *
 * @param Command Window Height
 * @desc Enter the Height you want your Command window to be. Value is in px.
 * @default 325
 *
 * @param Command Window Rows
 * @desc Enter how many rows the Command window should have.
 * @default 1
 *
 * @param Command Window Cols
 * @desc Enter how many Columns the Command window should have.
 * @default 1
 *
 * @param --- Gold Window ---
 * @default Settings for Gold Window
 *
 * @param Gold Window X Position
 * @desc Enter the X Cord you want your Gold window to be. Value is in px.
 * @default 0
 *
 * @param Gold Window Y Position
 * @desc Enter the Y Cord you want your Gold window to be. Value is in px.
 * @default 559
 *
 * @param Gold Window Width
 * @desc Enter the Width you want your Gold window to be. Value is in px.
 * @default 240
 *
 * @param Gold Window Height
 * @desc Enter the Height you want your Gold window to be. Value is in px.
 * @default 65
 *
 * @param Gold Window Rows
 * @desc Enter how many rows the Gold window should have.
 * @default 1
 *
 * @param Gold Window Cols
 * @desc Enter how many Columns the Gold window should have.
 * @default 1
 *
 *
 * @param --- Status Window ---
 * @default Settings for Gold Window
 *
 * @param Status Window X Position
 * @desc Enter the X Cord you want your Status window to be. Value is in px.
 * @default 240
 *
 * @param Status Window Y Position
 * @desc Enter the Y Cord you want your Status window to be. Value is in px.
 * @default 0
 *
 * @param Status Window Width
 * @desc Enter the Width you want your Status window to be. Value is in px.
 * @default 576
 *
 * @param Status Window Height
 * @desc Enter the Height you want your Status window to be. Value is in px.
 * @default 625
 *
 * @param Status Window Rows
 * @desc Enter how many rows the Status window should have.
 * @default 4
 *
 * @param Status Window Cols
 * @desc Enter how many Columns the Status window should have.
 * @default 1
 *
* @param Status Window Opacity
* @desc Opacity of the status window
* @default 0
 *
 */
(function () {
    //Create Background
    Scene_MenuBase.prototype.createBackground = function() {
        this._backgroundSprite = new Sprite();
        this._backgroundSprite.bitmap = ImageManager.loadPicture('dcbg');
        this.addChild(this._backgroundSprite);
    };
    
    //Initialize Plugin
    var parameters = PluginManager.parameters('UIC-MainMenus-Alpha');
    var StatusOpacity = parseInt(parameters["Status Window Opacity"] || 0, 10);
    Scene_MenuBase.prototype.setOpacity = function () {
         if (StatusOpacity >= 0 || StatusOpacity <= 255) {
             this._statusWindow.opacity = StatusOpacity;
         } else {
             this._statusWindow.opacity = 0;
         }
     }
    //Overwrite Scene_Menu
    var _Scene_Menu_Create = Scene_Menu.prototype.create;
    Scene_Menu.prototype.create = function () {
        _Scene_Menu_Create.call(this);
        //Command Window Position   
        this._commandWindow.x = parameters['Command Window X Position'];
        this._commandWindow.y = parameters['Command Window Y Position'];
        
        //Gold Window Position   
        this._goldWindow.x = parameters['Gold Window X Position'];
        this._goldWindow.y = parameters['Gold Window Y Position'];
        
        //Status Window Position
        this._statusWindow.x = parameters['Status Window X Position'];
        this._statusWindow.y = parameters['Status Window Y Position'];
 
    };   
        
    //Size and Layout of Command Menu
    Window_MenuCommand.prototype.windowWidth = function () { return parameters['Command Window Width']; };
    Window_MenuCommand.prototype.windowHeight = function () { return parameters['Command Window Height']; };
    Window_MenuCommand.prototype.numVisibleRows = function () { return parameters['Command Window Rows']; };
    Window_MenuCommand.prototype.maxCols = function () { return parameters['Command Window Cols']; };
        
    //Size and Layout of Gold Window
    Window_Gold.prototype.windowWidth = function () { return parameters['Gold Window Width']; };
    Window_Gold.prototype.windowHeight = function () { return parameters['Gold Window Height']; };
    Window_Gold.prototype.numVisibleRows = function () { return parameters['Gold Window Rows']; };
    Window_Gold.prototype.maxCols = function () { return parameters['Gold Window Cols']; };

    //Size and Layout of Gold Window
    Window_MenuStatus.prototype.windowWidth = function () { return parameters['Status Window Width']; };
    Window_MenuStatus.prototype.windowHeight = function () { return parameters['Status Window Height']; };
    Window_MenuStatus.prototype.numVisibleRows = function () { return parameters['Status Window Rows']; };
    Window_MenuStatus.prototype.maxCols = function () { return parameters['Status Window Cols']; };
    
})();
 

Sarlecc

Veteran
Veteran
Joined
Sep 16, 2012
Messages
453
Reaction score
211
First Language
English
Primarily Uses
RMMV
Sorry misread one of your functions the function that I posted should be:
Code:
Scene_Menu.prototype.setOpacity = function () {
    if (StatusOpacity >= 0 && StatusOpacity <= 255) {
        this._statusWindow.opacity = StatusOpacity;
    } else {
        this._statusWindow.opacity = 0;
    }
}
Anyway tested it and I don't receive any errors. And the status window changes opacity according to what the parameter is. If you continue having errors then something must not be set up right or you might be having a plugin conflict.

Edit: Also you need to call the above function inside the Scene_Menu.prototype.create function by using this.setOpacity(). Otherwise no changes will be made.
 
Last edited:

Kino

EIS Game Dev
Veteran
Joined
Nov 27, 2015
Messages
562
Reaction score
814
First Language
English
Primarily Uses
RMMV
Just a hint, but if you keep having undefined errors and you don't think it's your plugin, try play testing or refreshing the plugin in the PluginManager.

Also I would do
Code:
Number(parameters['Status Window Opacity']);
Should convert it to a number before the game think it's a string, and make sure that there's no unnecessary spaces on the line for @param Status Window Opacity <--.
 

Digital Religion

Dark Devil
Veteran
Joined
Jan 10, 2013
Messages
111
Reaction score
36
First Language
English
Primarily Uses
RMMV
There should be no if statement as the function does require one.... it just needs to be a number value. any number. they just need to go to be able to go to the plugin manage and type a number and what ever number they type will go into
this._statusWindow.opacity = parameters['Status Window Opacity]; but i cant seem to put a variable after this._statusWindow.opacity of any kind.

And that is the thing . That is exactly how it was set up and it just doenst work. it works for every other variable on the page done in the exact same way. but not there.
 

Digital Religion

Dark Devil
Veteran
Joined
Jan 10, 2013
Messages
111
Reaction score
36
First Language
English
Primarily Uses
RMMV
Just a hint, but if you keep having undefined errors and you don't think it's your plugin, try play testing or refreshing the plugin in the PluginManager.

Also I would do
Code:
Number(parameters['Status Window Opacity']);
Should convert it to a number before the game think it's a string, and make sure that there's no unnecessary spaces on the line for @param Status Window Opacity <--.
This seems like its closer to the right path.

But what I simply dont understand is why i can do
this._statusWindow.y = parameters['Status Window Y Position']; <-- input any number in the param and it accepts it.
But not this.
this._statusWindow.opacity = parameters['Status Window Opacity']; <-- I put any number into the param here. i get undefined error. Its just supposed to be putting what i tell it to there right. why why if i hard a code a 142 it works but if i use a parameter to have a user input 142 it doesn't work. it makes now sense. :/ if i had hair it would be falling out. :p
 

Sarlecc

Veteran
Veteran
Joined
Sep 16, 2012
Messages
453
Reaction score
211
First Language
English
Primarily Uses
RMMV
The reason I used an if statement is typically opacity values should not be less than 0 and not greater than 255. As for why it is not working: do you have additional plugins in the project? Does it work if it is the only plugin turned on?

Here is what worked for me:
Code:
/*:
 * @plugindesc RPGMV UI Creator - Menu CORE
 * @author Digital Religion
 *
 * --- Command Window Parameters ---
 *
 * @param --- Command Window ---
 * @default Settings for Command Window
 *
 * @param Command Window X Position
 * @desc Enter the X Cord you want your Command window to be. Value is in px.
 * @default 0
 *
 * @param Command Window Y Position
 * @desc Enter the Y Cord you want your Command window to be. Value is in px.
 * @default 0
 *
 * @param Command Window Width
 * @desc Enter the Width you want your Command window to be. Value is in px.
 * @default 240
 *
 * @param Command Window Height
 * @desc Enter the Height you want your Command window to be. Value is in px.
 * @default 325
 *
 * @param Command Window Rows
 * @desc Enter how many rows the Command window should have.
 * @default 1
 *
 * @param Command Window Cols
 * @desc Enter how many Columns the Command window should have.
 * @default 1
 *
 * @param --- Gold Window ---
 * @default Settings for Gold Window
 *
 * @param Gold Window X Position
 * @desc Enter the X Cord you want your Gold window to be. Value is in px.
 * @default 0
 *
 * @param Gold Window Y Position
 * @desc Enter the Y Cord you want your Gold window to be. Value is in px.
 * @default 559
 *
 * @param Gold Window Width
 * @desc Enter the Width you want your Gold window to be. Value is in px.
 * @default 240
 *
 * @param Gold Window Height
 * @desc Enter the Height you want your Gold window to be. Value is in px.
 * @default 65
 *
 * @param Gold Window Rows
 * @desc Enter how many rows the Gold window should have.
 * @default 1
 *
 * @param Gold Window Cols
 * @desc Enter how many Columns the Gold window should have.
 * @default 1
 *
 *
 * @param --- Status Window ---
 * @default Settings for Gold Window
 *
 * @param Status Window X Position
 * @desc Enter the X Cord you want your Status window to be. Value is in px.
 * @default 240
 *
 * @param Status Window Y Position
 * @desc Enter the Y Cord you want your Status window to be. Value is in px.
 * @default 0
 *
 * @param Status Window Width
 * @desc Enter the Width you want your Status window to be. Value is in px.
 * @default 576
 *
 * @param Status Window Height
 * @desc Enter the Height you want your Status window to be. Value is in px.
 * @default 625
 *
 * @param Status Window Rows
 * @desc Enter how many rows the Status window should have.
 * @default 4
 *
 * @param Status Window Cols
 * @desc Enter how many Columns the Status window should have.
 * @default 1
 *
* @param Status Window Opacity
* @desc Opacity of the status window
* @default 0
 *
 */
(function () {
    //Create Background
 
    Scene_MenuBase.prototype.createBackground = function() {
        this._backgroundSprite = new Sprite();
        this._backgroundSprite.bitmap = ImageManager.loadPicture('dcbg');
        this.addChild(this._backgroundSprite);
    };
 
    //Initialize Plugin
    var parameters = PluginManager.parameters('UIC-MainMenus-Alpha');
    var StatusOpacity = parseInt(parameters["Status Window Opacity"] || 0, 10);
 
    //Overwrite Scene_Menu
    var _Scene_Menu_Create = Scene_Menu.prototype.create;
    Scene_Menu.prototype.create = function () {
        _Scene_Menu_Create.call(this);
        //Command Window Position
        this._commandWindow.x = parameters['Command Window X Position'];
        this._commandWindow.y = parameters['Command Window Y Position'];
     
        //Gold Window Position
        this._goldWindow.x = parameters['Gold Window X Position'];
        this._goldWindow.y = parameters['Gold Window Y Position'];
     
        //Status Window Position
        this._statusWindow.x = parameters['Status Window X Position'];
        this._statusWindow.y = parameters['Status Window Y Position'];
     
        this.setOpacity();
 
    };
 
    Scene_Menu.prototype.setOpacity = function () {
         if (StatusOpacity >= 0 && StatusOpacity <= 255) {
             this._statusWindow.opacity = StatusOpacity;
         } else {
             this._statusWindow.opacity = 0;
         }
         console.log(this._statusWindow.opacity);
     }
     
    //Size and Layout of Command Menu
    Window_MenuCommand.prototype.windowWidth = function () { return parameters['Command Window Width']; };
    Window_MenuCommand.prototype.windowHeight = function () { return parameters['Command Window Height']; };
    Window_MenuCommand.prototype.numVisibleRows = function () { return parameters['Command Window Rows']; };
    Window_MenuCommand.prototype.maxCols = function () { return parameters['Command Window Cols']; };
     
    //Size and Layout of Gold Window
    Window_Gold.prototype.windowWidth = function () { return parameters['Gold Window Width']; };
    Window_Gold.prototype.windowHeight = function () { return parameters['Gold Window Height']; };
    Window_Gold.prototype.numVisibleRows = function () { return parameters['Gold Window Rows']; };
    Window_Gold.prototype.maxCols = function () { return parameters['Gold Window Cols']; };

    //Size and Layout of Gold Window
    Window_MenuStatus.prototype.windowWidth = function () { return parameters['Status Window Width']; };
    Window_MenuStatus.prototype.windowHeight = function () { return parameters['Status Window Height']; };
    Window_MenuStatus.prototype.numVisibleRows = function () { return parameters['Status Window Rows']; };
    Window_MenuStatus.prototype.maxCols = function () { return parameters['Status Window Cols']; };
 
})();

@Kino I prefer using parseInt over Number for a few reasons in some cases of user error and reduces some of the work for rounding removing unwanted floats:
Code:
Number("5.8")
//5.8
parseInt("5.8", 10)
//5
 
Last edited:

Kino

EIS Game Dev
Veteran
Joined
Nov 27, 2015
Messages
562
Reaction score
814
First Language
English
Primarily Uses
RMMV
Yea I use parseInt sometimes too; in this case it's a lot better since they're working with opacity. Also, might be another plugin conflicting with your code. If this problem persists restarting MV or looking over your params is important. Extra whitespace can ruin things.

Also if it's such a problem, do this:
Code:
console.log (parameters)
And look at the defined parameters.
 

Sarlecc

Veteran
Veteran
Joined
Sep 16, 2012
Messages
453
Reaction score
211
First Language
English
Primarily Uses
RMMV
Man I really wasn't thinking well yesterday had an or (||) in that if statement when it should have been and (&&). Updated my above post.
If you don't want to show all the parameters you can use:
Code:
console.log(parameters["Status Window Opacity"]) //or whatever parameter you want to check.
This should log either undefined or the value of the parameter.
 

Digital Religion

Dark Devil
Veteran
Joined
Jan 10, 2013
Messages
111
Reaction score
36
First Language
English
Primarily Uses
RMMV
Yeah I was super tired as well when I was posting last night. lol So its all good. I didn't even really see what the if statement was doing till I looked back at it today. But yeah weird. The first time I put it in my plug in manager it still didn't work. I even created a new game and dropped it in and it still didn't work. I used steam to verify the integrity of the software. It add some random file. Now its working fine.

So maybe the problem wasn't even the code at all.
Well the inital problem was definitely the code, but why it wasn't working for me may have been a different issue.

Anywho...
Thank you guys both for your help. I've been doing a bit more research on both your methods and its starting to click a bit more for me.

What I still don't get is why the first param below works and the latter does not.

Why wasn't I able to use the same method as :

Code:
 * @param Status Window Y Position
 * @desc Enter the Y Cord you want your Status window to be. Value is in px.
 * @default 0

this._statusWindow.y = parameters['Status Window Y Position'];

for

Code:
* @param Status Window Opacity
* @desc Opacity of the status window
* @default 0
*

this._statusWindow.opacity = parameters['Status Window Opacity'];
 

Digital Religion

Dark Devil
Veteran
Joined
Jan 10, 2013
Messages
111
Reaction score
36
First Language
English
Primarily Uses
RMMV
Yea I use parseInt sometimes too; in this case it's a lot better since they're working with opacity. Also, might be another plugin conflicting with your code. If this problem persists restarting MV or looking over your params is important. Extra whitespace can ruin things.

Also if it's such a problem, do this:
Code:
console.log (parameters)
And look at the defined parameters.

You know, your right. And as a web developer I really should have been using the console. :p I keep forgetting about F8. Isn't there a way to have the console open automatically natively, or will i have to write a script for this too. I need to run it though a linter too. For when it starts become a bigger project.
 

Sarlecc

Veteran
Veteran
Joined
Sep 16, 2012
Messages
453
Reaction score
211
First Language
English
Primarily Uses
RMMV
Just an extra note that all parameters are strings until you convert them to the type of data that you are expecting.
So:
Code:
* @param Status Window Y Position
* @desc Enter the Y Cord you want your Status window to be. Value is in px.
* @Default 0

this._statusWindow.y = parameters['Status Window Y Position'];
This is setting this._statusWindow.y to a string not a number. You might have the parameter set to 5 for example in the plugin manager but when it sets it to this._statusWindow.y it will be set as "5".
 

Digital Religion

Dark Devil
Veteran
Joined
Jan 10, 2013
Messages
111
Reaction score
36
First Language
English
Primarily Uses
RMMV
Ohhh. I get it. And that right there make the most complete sense. ok. So it has to be converted into an integer. Cause the param is a string. Thank you.
 

Latest Threads

Latest Posts

Latest Profile Posts

I genuinely like the default MZ actor sprites, and the character creator. I think I will draw new headshots for them, but part of me doesn't want to replace the default sprites. But should I? I want to eventually release my game.
Someday, I hope they make a game where 95% of the animation budget went to turning valves and opening door animations, leaving every other animation looking like a CDI zelda cutscene.
programming at 12 years old: "I love how it works!"
programming at 18: "I love that it works."
programming at 25: "I love why it works."
programming at 30: "I love when it works."
programming at 50: "How did this work?"
Why can't I insert picture in this profile post? Only insert image -> by URL. No option to upload from my pc?
Trying out a new Battle Ui.
BattleUI.png

Forum statistics

Threads
129,758
Messages
1,204,889
Members
170,849
Latest member
YujiHero
Top