I see there is a SceneManager.onError and so on, but whats the easiest way in a custom plugin to cause the system to crash and print out a custom error?
Easiest way to throw a game breaking error?
Javascript/Plugin Supportthrow "My Custom Error";
No, that gets spit to the console.
The method I posed is one rpg maker uses to actually stop everything and print the error to the screen. That's what I want
The method I posed is one rpg maker uses to actually stop everything and print the error to the screen. That's what I want
This stops everything an prints "My Custom Error" to the sceen.
This is not what I've experienced. When I do throw "bla" it only shows in the console, no game stoppage
throw "Test";
I usually use
Code:
throw new Error("...");
Some one please explain this then:
[IMG]http://i.imgur.com/Bv9Opo0.png[/IMG]
Why isn't the game crashing? the console shows the error ...
[IMG]http://i.imgur.com/Bv9Opo0.png[/IMG]
Why isn't the game crashing? the console shows the error ...
Where are you writing this?
Can you please paste the whole code?
I think the code you write get executed before the errorHandler is initialized.
EDIT:
Please try this:
var Scene_Map_Init = Scene_Map.prototype.initialize; Scene_Map.prototype.initialize = function () { Scene_Map_Init.call(this); throw "Error"; };This Code get executed in a context where the errorHandler is initialized and now the game stops and you see the error.
Can you please paste the whole code?
I think the code you write get executed before the errorHandler is initialized.
EDIT:
Please try this:
var Scene_Map_Init = Scene_Map.prototype.initialize; Scene_Map.prototype.initialize = function () { Scene_Map_Init.call(this); throw "Error"; };This Code get executed in a context where the errorHandler is initialized and now the game stops and you see the error.
That was the whole code.
See my last post (Edit).
So I pasted the code you tried, nothing, nothing in the console. Nothing at all the game runs fine ... the code you have is all the code I have in my file. Theres nothing else. Oh wait, I see: You have to actually hit enter on new game
Where are you pasted the code?
See the above post again.
Try this:
Code:
(function () { var Scene_Map_Init = Scene_Map.prototype.initialize; Scene_Map.prototype.initialize = function () { Scene_Map_Init.call(this); throw "Error"; };}());
How would you make this into a wrapper function to be called where ever you need it to be called?
(function() {var Game_Interpreter_PluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { Game_Interpreter_PluginCommand.call(this, command, args); if (command === "BlaBla") { throw "Blabla"; } };}());Now create a event with a Plugin Command: "BlaBla"
Random question: How do you create a event with a command of blabla - in your example ?
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.
at OP's request
at OP's request
Original thread: https://forums.rpgmakerweb.com/threads/easiest-way-to-throw-a-game-breaking-error.47153/