[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,125
Reaction score
10,639
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,125
Reaction score
10,639
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,125
Reaction score
10,639
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,125
Reaction score
10,639
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,125
Reaction score
10,639
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,125
Reaction score
10,639
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
7,842
Reaction score
5,225
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

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,083
Members
137,583
Latest member
write2dgray
Top