[FIXED] this.clearCommandList is not a function

Status
Not open for further replies.

Beebanew

Villager
Member
Joined
Dec 16, 2017
Messages
7
Reaction score
0
First Language
Portuguese
Primarily Uses
RMMV
I'm trying to create a window in a new scene but it is throwing an error when calling HorzCommand (Window_Command)'s initialize.

The error log
Code:
Window_Command.prototype.initialize@file:///C:/Users/kawthar/Desktop/Forge/js/rpg_windows.js:1300:5
Window_HorzCommand.prototype.initialize@file:///C:/Users/kawthar/Desktop/Forge/js/rpg_windows.js:1454:5
Window_ForgeCommand.prototype.initialize@file:///C:/Users/kawthar/Desktop/Forge/js/plugins/Forge.js:111:2
Window_ForgeCommand@file:///C:/Users/kawthar/Desktop/Forge/js/plugins/Forge.js:101:2
Scene_Forge.prototype.createForgeCommandWindow@file:///C:/Users/kawthar/Desktop/Forge/js/plugins/Forge.js:72:23
Scene_Forge.prototype.create@file:///C:/Users/kawthar/Desktop/Forge/js/plugins/Forge.js:65:2
SceneManager.changeScene@file:///C:/Users/kawthar/Desktop/Forge/js/rpg_managers.js:2005:13
SceneManager.updateMain@file:///C:/Users/kawthar/Desktop/Forge/js/rpg_managers.js:1982:13
SceneManager.update@file:///C:/Users/kawthar/Desktop/Forge/js/rpg_managers.js:1907:9
My window's class
Code:
function Window_ForgeCommand() {
	this.initialize.apply(this, arguments);
}

Window_ForgeCommand.prototype = Object.create(Window_HorzCommand.prototype);
Window_ForgeCommand.prototype.constructor = Window_ForgeCommand;

Window_ForgeCommand.prototype.initialize = (width, cantForge, cantDismantle) => {	
	this.windowWidth = width;
	this.cantForge = cantForge;
	this.cantDismantle = cantDismantle;
	Window_HorzCommand.prototype.initialize.call(this, 0, 0);
}

Window_ForgeCommand.prototype.windowWidth = () => this.windowWidth ;
Window_ForgeCommand.prototype.maxCols = () => 3;
Window_ForgeCommand.prototype.makeCommandList = () => {
	this.addCommand(Forge.forgeWindowName, 'forge', !this.cantForge);
	this.addCommand(Forge.dismantleWindowName, 'dismantle', !this.cantDismantle);
	this.addCommand(TextManager.cancel, 'cancel');
}
I'm new to scripting in RPGMMV, sorry if it's a dumb problem.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,063
Reaction score
10,364
First Language
Czech
Primarily Uses
RMMV
It would be much more convenient to see the full error log, because from what you sent I can't see the exception that got fired.

edit: Nevermind, the title says it. Nevertheless, the error looks weird, have you done something to the horzcommand window itself or command window?
 

Beebanew

Villager
Member
Joined
Dec 16, 2017
Messages
7
Reaction score
0
First Language
Portuguese
Primarily Uses
RMMV
It would be much more convenient to see the full error log, because from what you sent I can't see the exception that got fired.

edit: Nevermind, the title says it. Nevertheless, the error looks weird, have you done something to the horzcommand window itself or command window?
Old answer:
As the title says, the error is that this.clearCommandList isn't a function.



// Edit
And, yes, it is there in rpg_windows.js


Didn't see your edit.
I didn't change anything in HorzCommand nor Window_Command.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,063
Reaction score
10,364
First Language
Czech
Primarily Uses
RMMV
Ouch, microsoft edge!
Is there a specofic reason behind the fact that there's that invalid state error? What if you launch it in the default exe?
 

Beebanew

Villager
Member
Joined
Dec 16, 2017
Messages
7
Reaction score
0
First Language
Portuguese
Primarily Uses
RMMV
Ouch, microsoft edge!
Is there a specofic reason behind the fact that there's that invalid state error? What if you launch it in the default exe?
I'm running it with Firefox.
About the invalid state error, I don't know too. Even with every plugin disabled it is still there.
And I get the same error running from inside the engine, I prefer running in the browser 'cause of documentation access. Personal workflow I'd say.

// Edit:
The state error is thrown when the game starts so I guessed it was "normal" or at least nothing that I need to worry about.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,063
Reaction score
10,364
First Language
Czech
Primarily Uses
RMMV
What if you launch it from the normal exe (or normally through rpg maker)? Does it work?
 

Beebanew

Villager
Member
Joined
Dec 16, 2017
Messages
7
Reaction score
0
First Language
Portuguese
Primarily Uses
RMMV
What if you launch it from the normal exe (or normally through rpg maker)? Does it work?
Nope, exactly same error, including the invalid state error.

// Edit
Printing the Window_Command class I can see the clearCommandList function

Any clues?
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,063
Reaction score
10,364
First Language
Czech
Primarily Uses
RMMV
Looks like something is interfering with the way default horzcommand works.
What if you just define the function manually imside your window via copy pasting?
 

Beebanew

Villager
Member
Joined
Dec 16, 2017
Messages
7
Reaction score
0
First Language
Portuguese
Primarily Uses
RMMV
Looks like something is interfering with the way default horzcommand works.
What if you just define the function manually imside your window via copy pasting?
Nope.
Tried defining the clearCommandList function both for the Window_Command and for my window's class and through the console, neither worked.
Can you test my code there to see if it's something with the base RMMV's files?
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,063
Reaction score
10,364
First Language
Czech
Primarily Uses
RMMV
I am currently en route to a 12 hours long work shift. That means about 13 hours until I can look. But if it doesn't get solved by then, I will see
 

Beebanew

Villager
Member
Joined
Dec 16, 2017
Messages
7
Reaction score
0
First Language
Portuguese
Primarily Uses
RMMV
I am currently en route to a 12 hours long work shift. That means about 13 hours until I can look. But if it doesn't get solved by then, I will see
Sure, thank you o/
 

Beebanew

Villager
Member
Joined
Dec 16, 2017
Messages
7
Reaction score
0
First Language
Portuguese
Primarily Uses
RMMV
FIXED.
To be honest it was a really dumb problem, I was just tilted.
You can't use arrow functions for those object functions because arrow function doesn't have it's own this.
Anyway, thank you @Poryg.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,063
Reaction score
10,364
First Language
Czech
Primarily Uses
RMMV
Haha, didn't know :D

Anyway, now that we know, you can always rewrite it to proper ES6 class syntax :p
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
6,491
Reaction score
4,404
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

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

Latest Threads

Latest Profile Posts

Managed to find a way to hang a bed cover over my window. So no more being toasted alive in the afternoon!:kaoswt2:
So, uh, has anyone tried buying any resources from KokoroReflections? Because I've been looking for a 'buy' button on the site for like 10 minutes now and can't find one.
Any also thought it's too cringy to put the word "and you" in your credit as a special thanks?
Cause that's what I thought...
Everyone in the US right now: Please stay safe.
Symphony Celestia: Prophecy of the Falling Stars RPG Maker music pack WIP. Symphony Celestia is a new series that focuses on symphonic and orchestrated music to tell a story. Each story will include compositions that make up that story from beginning to end. Themes include: Battles, adventures, character themes, etc. Below is a video preview to the first story.

Forum statistics

Threads
97,980
Messages
948,320
Members
129,243
Latest member
SoloJou
Top