"Uncaught Error: Header is wrong"

Verdelite

Wannabe Developer
Veteran
Joined
May 22, 2016
Messages
138
Reaction score
1,022
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
682
Reaction score
598
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,022
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
682
Reaction score
598
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,022
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
682
Reaction score
598
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.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,981
Members
137,563
Latest member
cexojow
Top