"Uncaught Error: Header is wrong"

Verdelite

Wannabe Developer
Veteran
Joined
May 22, 2016
Messages
138
Reaction score
1,023
First Language
German
Primarily Uses
RMMV
Hey there,
players have been reporting the "Uncaught Error: Header is wrong" message when playing my game.
I'm pretty sure that it's caused by the loading screen plugin (based on RED_RandomLoadingScreen) that I've almost completely rewritten into spaghetti, so please bear with my terrible code.
So far I've been unable to reproduce the error as it seems to happen randomly ;_;

Description of the plugin:
I wanted to adjust the plugin to be able to permanently adjust the range of the loading screens used, so instead of giving a range, I adjusted it to accept an array of numbers.
Because I wanted to add unlockable screens over the course of the game, I added a second array (filled with only 0 or 1) where the array index corresponds to the loading screen number and the 0/1 decides whether the screen had been unlocked yet.

Code:
/*:
 * @param ID of loading images
 * @desc ID of loading images, seperate with ','
 * @default 0
 *
 * @param Max number of images
 * @desc number of screens (minus locked ones)
 * @default 0
 *
 * @help
 * ================================================================================
 * COMMANDS:
 * setLoadingScreen # #
 * ~~~Allows you to manually set the loading screen range, f.e. 1 1 2 3 4 6
 *
 * setScreen screenID 1|0
 * ~~~Choose to lock or unlock the version of the loading screen. 0 to lock, 1 to unlock
 * setScreen 2 1
 * to unlock loading screen 2
 *
 * ================================================================================
 */

(function() {
    
    var parameters = PluginManager.parameters('RED_RandomLoadingScreen');
    var screens = parameters['ID of loading images'].split(/\s*,\s*/).filter(function(value) { return !!value; }); //array for loading screens available
    var maxscreens = Number(parameters['Max number of images']);
    var screenSwitches = []; //array for choosing locked/unlocked version

    var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
    Game_Interpreter.prototype.pluginCommand = function(command, args)
    {
        _Game_Interpreter_pluginCommand.call(this, command, args);
        if (command.toLowerCase() === 'setloadingscreen') //fill array with the numbers specified
        {
            screens = [];
            for(var i = 0; i < args.length; i++){
                screens.push(Number(args[i]));
            }
        }
        if (command.toLowerCase() === 'setscreen'){ // sets array field of the screen id to 0 or 1
            screenSwitches[args[0]] = (Number(args[1]));
        }
    };
    
    var startLoading_leftovers = Graphics.startLoading;
    Graphics.startLoading = function() {
        do{
            var liran = Math.randomInt(screens.length);
            var newlimg = 'img/system/Loading.png';
            var picid = Number(screens[liran]);
            if(picid <= maxscreens && (screenSwitches[picid] === 1)){
                screens[liran]+=maxscreens;
                screens[liran]=screens[liran]%(maxscreens*2+1); //errorhandling
                }
            } while(Number(screens[liran])>(maxscreens*2)); //error handling
        newlimg = 'img/system/Loading' + Number(screens[liran]) + '.png';
        Graphics.setLoadingImage(newlimg);
        startLoading_leftovers.call(this);
    };
    
}) ();

I also have common events set up that run after loading the game and closing the menu in order to constantly refresh the loading screen range.

I am suspecting that the error is likely from an erronous input/plugin command but since I don't know what the error means, I can't pinpoint the mistake :(

I am completely at a loss here, so any help would be much appreciated!
 

waynee95

Inactive
Veteran
Joined
Jul 2, 2016
Messages
684
Reaction score
605
First Language
German
Primarily Uses
RMMV
Do you have the full error log from the console?

By just looking at that code, I cannot see any major issues tho.
 

Verdelite

Wannabe Developer
Veteran
Joined
May 22, 2016
Messages
138
Reaction score
1,023
First Language
German
Primarily Uses
RMMV
@waynee95 Unfortunately not, because I've been unable to reproduce it even though I've played through my game multiple times and it happend to my players after deployment ;_;

I'll delete my save files and retry again...
 

waynee95

Inactive
Veteran
Joined
Jul 2, 2016
Messages
684
Reaction score
605
First Language
German
Primarily Uses
RMMV
@Verdelite
Can someelse who got that error before, reproduce it?
Did you just deploy the project the default way or did you use Enigma Box etc?
 

Verdelite

Wannabe Developer
Veteran
Joined
May 22, 2016
Messages
138
Reaction score
1,023
First Language
German
Primarily Uses
RMMV
@waynee95 The people that have reported it all said it seemed to happen randomly. Yep, I did indeed use Enigma Box for encryption.
 

waynee95

Inactive
Veteran
Joined
Jul 2, 2016
Messages
684
Reaction score
605
First Language
German
Primarily Uses
RMMV
The problem is that I never seen that error and the MV error display is just not enough.
You could enable the use of the console in a deployed project, so when someone gets that error, we could get more information.
Just comment this part out. This function can be found in rpg_managers.
PHP:
SceneManager.onKeyDown = function(event) {
    if (!event.ctrlKey && !event.altKey) {
        switch (event.keyCode) {
        case 116:   // F5
            if (Utils.isNwjs()) {
                location.reload();
            }
            break;
        case 119:   // F8
            if (Utils.isNwjs()/* && Utils.isOptionValid('test')*/) { <- that part
                require('nw.gui').Window.get().showDevTools();
            }
            break;
        }
    }
};

Or maybe someone else has an idea.
 

Latest Threads

Latest Profile Posts


And the beginning of a nearly complete grid system dawns.

I want to add a thin pixel border around the entire region. Like across all blue highlights that connect and red attack highlights that connect.
Ami
--- Remake ---

Hero: Hey,look! Some Artist will Remake us to 3D!
M.Knight: Really? Then i hope they make me so Cool & Handsome
Heroine: I hope they make me Cute & Sexy,too
(6 Months Later,The 3D Model Are Revealed With Unexpected Yet Horrible Model)
Hero: (Spit The Water)
M.Knight: What the Hell?!
Heroine: I'm Dissapointed...
my battle system is REALLY coming together. I can already see strategies between 2 of my party members forming lol. helps that battles are 2 at a time. but the combo of these two is really fun.
@taarna23's status just made me realise I haven't had any scam calls since that guy who hung up on me before he even began reading his script. How quiet it's been ... they were pretty much the only people who ever called!

Forum statistics

Threads
107,779
Messages
1,032,122
Members
139,930
Latest member
sokul2
Top