My custom plugin error: x is not defined

Aura_Gamer

Villager
Member
Joined
Jun 24, 2018
Messages
18
Reaction score
2
First Language
English
Primarily Uses
RMMV
Hey! I'm new to this forum, I was making my own js plugin for making a custom title screen. Everything was going fine but I don't know where but I got this message:- Reference error: x is not defined :(
Steps to reproduce the problem:
1.
Create a blank project.
2. Create some splash screen with RPG maker splash screen plugin // I don't think it's necessary 0_0
3. Install my plugin.

AuraCustomT.js:
/*:
*
* @plugindesc This plugin is used to create custom title screen.
*
* @author Syed Shaazib Tanvir
*
* @Help Personal use plugin only. No help commands needed.
*/

(function () {

var sceneTitle_create = Scene_Title.prototype.create;

//predefined function
Scene_Title.prototype.create = function() {
sceneTitle_create.call(this);
this.createTitleFogs();
this.createTitleBtn();
};

//custom functions
Scene_Title.prototype.createTitleFogs = function(){x
this.titleFog1 = new TilingSprite();
this.titleFog1.move(0, 5, Graphics.width, Graphics.height);
this.titleFog1.bitmap = ImageManager.loadTitle2('Fog1');
this.addChild(this.titleFog1);

this.titleText = new TilingSprite();
this.titleText.move(-700, -400, Graphics.width, Graphics.height);
this.titleText.bitmap = ImageManager.loadTitle2('Title');
this.addChild(this.titleText);
}

Scene_Title.prototype.createTitleBtn = function(){
this.newGameBtn = new Sprite_Button();
this.newGameBtn.x = 1300;
this.newGameBtn.y = 540;
this.addChild(this.newGameBtn);
this.continueBtn = new Sprite_Button();
this.continueBtn.x = 0;
this.continueBtn.y = 640;
this.addChild(this.continueBtn);
this.optionsBtn = new Sprite_Button();
this.optionsBtn.x = 0;
this.optionsBtn.y = 740;
this.addChild(this.optionsBtn);
this.exitBtn = new Sprite_Button();
this.exitBtn.x = 0;
this.exitBtn.y = 840;
this.addChild(this.exitBtn);
}

Scene_Title.prototype.setActiveBtn = function() {
if(this._commandWindow._index === 0){
this.newGameBtn.bitmap = ImageManager.loadTitle2('newGame_1');
}
}

//predefined functions
Scene_Title.prototype.start = function() {
Scene_Base.prototype.start.call(this);
SceneManager.clearStack();
this.centerSprite(this._backSprite1);
//this.centerSprite(this._backSprite2);
this.playTitleMusic();
this.startFadeIn(this.fadeSpeed(), false);
};

Scene_Title.prototype.createBackground = function() {
this._backSprite1 = new Sprite(ImageManager.loadTitle1($dataSystem.title1Name));
this._backSprite2 = new Sprite(ImageManager.loadTitle2($dataSystem.title2Name));
this.addChild(this._backSprite1);
this.addChild(this._backSprite2);
};

Scene_Title.prototype.createCommandWindow = function() {
this._commandWindow = new Window_TitleCommand();
this._commandWindow.x = Graphics.boxWidth;
this._commandWindow.y = Graphics.boxHeight;
this._commandWindow.setHandler('newGame', this.commandNewGame.bind(this));
this._commandWindow.setHandler('continue', this.commandContinue.bind(this));
this._commandWindow.setHandler('options', this.commandOptions.bind(this));
this.addWindow(this._commandWindow);
};

var sceneTitle_update = Scene_Title.prototype.update;
Scene_Title.prototype.update = function() {
sceneTitle_update.call(this);
//this.scrollFogs();
this.setActiveBtn();
};

/*Scene_Title.prototype.scrollFogs = function(){
this.titleFog1.origin.x += 1;
}*/
}) ();

Please help me guys! :(
THANKIES IN ADVANCE, LOL I SPELLED IT LIKE THAT INTENTIONALLY
 

Attachments

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,627
Reaction score
1,066
First Language
English
Primarily Uses
RMMV
Press F8 when it crashes and it will tell you exactly where the error is coming from.


I didn't test it, but you have put an "x" here, so I guess this is where the error is coming from.
Code:
//custom functions
Scene_Title.prototype.createTitleFogs = function(){x
this.titleFog1 = new TilingSprite();
this.titleFog1.move(0, 5, Graphics.width, Graphics.height);
this.titleFog1.bitmap = ImageManager.loadTitle2('Fog1');
this.addChild(this.titleFog1);
Next time, if you can post your code inside CODE tags, it will help people reading it :D
 

Aura_Gamer

Villager
Member
Joined
Jun 24, 2018
Messages
18
Reaction score
2
First Language
English
Primarily Uses
RMMV
Thanks! I didn't even knew that F8 shortcut. You're right! I wrote that x by mistake..
Thanks again! RPG Maker rocks (you too)..
 

Aura_Gamer

Villager
Member
Joined
Jun 24, 2018
Messages
18
Reaction score
2
First Language
English
Primarily Uses
RMMV
Hey! I know I should create another thread but I believe this thread should solve my problem.
In the same script no error but somewhat behaving wrong.
AuraCustomT.js(updated):
Code:
/*:
 *
 * @plugindesc This plugin is used to create custom title screen.
 *
 * @author Syed Shaazib Tanvir
 *
 * @help Personal use plugin only. No help commands needed.
 */

 (function () {

    var sceneTitle_create = Scene_Title.prototype.create;

    //predefined function
    Scene_Title.prototype.create = function() {
        sceneTitle_create.call(this);
        this.createTitleFogs();
        this.createTitleBtn();
    };

    //custom functions
    Scene_Title.prototype.createTitleFogs = function(){
        this.titleFog1 = new TilingSprite();
        this.titleFog1.move(0, 0, Graphics.width, Graphics.height);
        this.titleFog1.bitmap = ImageManager.loadTitle2('Fog1');
        this.addChild(this.titleFog1);

        this.titleText = new TilingSprite();
        this.titleText.move(-700, -400, Graphics.width, Graphics.height);
        this.titleText.bitmap = ImageManager.loadTitle2('Title');
        this.addChild(this.titleText);
    }

    Scene_Title.prototype.createTitleBtn = function(){
        this.newGameBtn = new Sprite_Button();
        this.newGameBtn.x = 1300;
        this.newGameBtn.y = 540;
        this.addChild(this.newGameBtn);
        this.continueBtn = new Sprite_Button();
        this.continueBtn.x = 1320;
        this.continueBtn.y = 640;
        this.addChild(this.continueBtn);
        this.optionsBtn = new Sprite_Button();
        this.optionsBtn.x = 1290;
        this.optionsBtn.y = 740;
        this.addChild(this.optionsBtn);
        this.exitBtn = new Sprite_Button();
        this.exitBtn.x = 1300;
        this.exitBtn.y = 840;
        this.addChild(this.exitBtn);
    }

    Scene_Title.prototype.setActiveBtn = function() {
        if(this._commandWindow._index === 0){ // if newgame select
            this.newGameBtn.bitmap = ImageManager.loadTitle2('newGame_2');
            if(DataManager.isAnySavefileExists()){
                this.continueBtn.bitmap = ImageManager.loadTitle2('continue_2');
            } else{
                this.continueBtn.bitmap = ImageManager.loadTitle2('continue_1');
            }
            this.optionsBtn.bitmap = ImageManager.loadTitle2('options_1');
        }

        if(this._commandWindow._index === 1){// if continue selected
            this.newGameBtn.bitmap = ImageManager.loadTitle2('newGame_1');
            if(DataManager.isAnySavefileExists()){
                this.continueBtn.bitmap = ImageManager.loadTitle2('continue_3');
            } else{
                this.continueBtn.bitmap = ImageManager.loadTitle2('continue_1');
            }
            if(this._commandWindow._index === 2) {// options selected
                this.newGameBtn.bitmap = ImageManager.loadTitle2('newGame_1');
                if(DataManager.isAnySavefileExists()){
                    this.continueBtn.bitmap = ImageManager.loadTitle2('continue_2');
                } else{
                    this.continueBtn.bitmap = ImageManager.loadTitle2('continue_1');
                }
                this.optionsBtn.bitmap = ImageManager.loadTitle2('options_2');
            }
        }
    }

    //predefined functions
    Scene_Title.prototype.start = function() {
        Scene_Base.prototype.start.call(this);
        SceneManager.clearStack();
        this.centerSprite(this._backSprite1);
        //this.centerSprite(this._backSprite2);
        this.playTitleMusic();
        this.startFadeIn(this.fadeSpeed(), false);
    };

    Scene_Title.prototype.createBackground = function() {
        this._backSprite1 = new Sprite(ImageManager.loadTitle1($dataSystem.title1Name));
        this._backSprite2 = new Sprite(ImageManager.loadTitle2($dataSystem.title2Name));
        this.addChild(this._backSprite1);
        this.addChild(this._backSprite2);
    };

    Scene_Title.prototype.createCommandWindow = function() {
        this._commandWindow = new Window_TitleCommand();
        this._commandWindow.x = Graphics.boxWidth;
        this._commandWindow.y = Graphics.boxHeight;
        this._commandWindow.setHandler('newGame',  this.commandNewGame.bind(this));
        this._commandWindow.setHandler('continue', this.commandContinue.bind(this));
        this._commandWindow.setHandler('options',  this.commandOptions.bind(this));
        this.addWindow(this._commandWindow);
    };
 
    var sceneTitle_update = Scene_Title.prototype.update;
    Scene_Title.prototype.update = function() {
        sceneTitle_update.call(this);
        //this.scrollFogs();
        this.setActiveBtn();
    };

    /*Scene_Title.prototype.scrollFogs = function(){
        this.titleFog1.origin.x += 1;
    }*/
 }) ();
sprite_1 is deselected sprite _2 is selected and in continue _1 is no save file _2 is save file exists _3 is selected with save file

Here my new game button works fine but the others show no difference.
I can't judge why...
:rsad: Please help!!
Thanks in advance! I wrote it like that intentionally again :guffaw:!
 
Last edited:

Aura_Gamer

Villager
Member
Joined
Jun 24, 2018
Messages
18
Reaction score
2
First Language
English
Primarily Uses
RMMV
I found out!
It was a silly mistake.......... :rhappy:
My options was under another block....
 

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

Latest Threads

Latest Posts

Latest Profile Posts

i watched the sonic movie it was pretty good i hope they make a sequel
tomorrow I'ma go on a cruise for the first time ever... lets hope I'll survive the experience!
Omg! 8 years in this forum :o
Ksi
Streaming the last of the RMN Valentiny event games so feel free to drop on by and watch me cry (whether that's from laughter, rage or sheer pain, who knows?)
Today I went to sleep without setting an alarm, so I could sleep more than 2 hours. I woke up after 2 hours.

Forum statistics

Threads
94,306
Messages
919,812
Members
124,056
Latest member
ZidaneX
Top