My script = undefined is not function ?? [SOLVED]

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,440
First Language
French
Primarily Uses
RMMV
Hi guys after 2 Hour search...


What the hell give me this error ??


I use a lot of consol log but the script seem ok ???


Script call are too mutch small so i put it inside plugin.


Is my first time i use plugin am not shure if all are ok for plugin use 


The plugin need to call 1 time


UNDEFNED IS NOT FUNCTION ???


SceneManager.catchExceptionrpg_managers.js:1683 and SceneManager.update


Do you have a trick to see what wrong ?

Code:
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
    // to be overridden by plugins
    console.log('start');
    _Game_Interpreter_pluginCommand.call(this, command, args);
    if (command === 'menuobj') {




        Pid = 100; // picture ID for clic, 100 + max 36 Max 200
        ItemtotalDB = 200; // Maximum item dans le DB rpgmaker
        Itemtotalposs = 0; // Nombre objet posseder
        Objetposseder = []; // creer une variable poru chaque item avec valeur
        i = 1; // représente page pour listi 
        Pagevar = $gameVariables.value(34);
        console.log(20);
        for (Listi = 1; Listi < ItemtotalDB; Listi++) {
            if ($gameParty.hasItem($dataItems[Listi]) == true) {
                Objetposseder[Listi] = Listi; //create variable based on DB Objetposseder1=2,Objetposseder2=2,Objetposseder3=3...
                Itemtotalposs++; //calcul global total objet poseder
                if (Itemtotalposs == 37 || Itemtotalposs == 73 || Itemtotalposs == 108) { //a chaque +1 que 36 Itemtotalposs = 1 nouvelle page
                    i++;
                    Listi[i] = Listi; // pour page 2,3,4..., on sait que on doi comment la list a cette endroit . 
                }
            }
        }

        console.log(32);
        if (Itemtotalposs == 0) {
            console.log('le joueur na pas objet');
        } // stop because no objet !!}
        else {
            //page1
            Xitem = 0; // X coor for the item + picturesize+ marge
            Yitem = 0; // Y coor for the item + picturesize+ marge
            InpicX = 46; // Initial X of menue item list
            InpicY = 186; // Initial Y of menue item list
            MargeX = 7; // Marge bettwenn 2 picture X 
            MargeY = 6; // Marge bettwenn 2 picture Y
            ISIZEX = 82; // X size of picture
            ISIZEY = 82; // X size of picture
            NBitempagemenu = 0;

            if (Pagevar == 1) {
                Listi = 1; // si sur page 1 , listi recommence le scan a 1
            } else {
                Listi = Listi[Pagevar]; // si sur page 2 ou autre , listi recommence le scan a Listi[Pagevar]...[pagevariable dans jeux]
            }

            console.log(54);
            for (; Listi < ItemtotalDB; Listi++) {
                if (Objetposseder[Listi] == Listi) {
                    //afficher objet
                    $gameScreen.showPicture(Pid, Listi, 0, InpicX + Xitem, InpicY + Yitem, 135, 135, 255, 0);
                    $gameScreen.movePicture(Pid, 1, InpicX + Xitem, InpicY + Yitem, 110, 110, 255, 0, 11);
                    console.log('Affiche image' + Pid + 'et listi est a ' + Listi);
                    $gameScreen.setPictureCallCommon(Pid, 21, 1); // si clique sur item renvoi vers event.commun
                    Textitems = String($dataItems[Listi].name); // on va chercher le nom fichier 
                    Textitems = Textitems.split(' - '); // on le découpe en 2 
                    $gameScreen.setDTextPicture('\\OW[5]' + Textitems[0] + '', 20);
                    $gameScreen.showPicture(Pid + (36 * 1), '', 0, InpicX + Xitem, InpicY + Yitem, 100, 100, 255, 0); // affiche image a PID+36 (max72)
                    $gameScreen.setDTextPicture('\\OW[4]' + Textitems[1] + '', 19);
                    $gameScreen.showPicture(Pid + (36 * 2), '', 0, InpicX + Xitem, InpicY + Yitem + 15, 100, 100, 255, 0); // affiche D_text titre objet
                    console.log(67);
                    NBitempagemenu++
                    Pid++
                    Xitem += ISIZEX + MargeX;
                }
                if (NBitempagemenu == 36) {
                    console.log('On break car NBitempagemenu= ' + NBitempagemenu); //afficher objet
                    break;
                    console.log(69);
                } else if (NBitempagemenu == 12 || NBitempagemenu == 24) {
                    //Saut de ligne
                    Xitem = 0;
                    Yitem += ISIZEY + MargeY;
                }
            }
            console.log(70);
        }
        console.log(71);



    }
    console.log('end');

}
 
Last edited by a moderator:

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,440
First Language
French
Primarily Uses
RMMV
Missing Listi declaration before first semicolon?
nop you can do this , if you don't need to not initialise a variable befor start a loop.
 

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,440
First Language
French
Primarily Uses
RMMV
Missing Listi declaration before first semicolon?
i dont initialise because depending of the page (pagevar)


The listi will get new valur


            if (Pagevar == 1) {
                Listi = 1; // si sur page 1 , listi recommence le scan a 1
            } else {
                Listi = Listi[Pagevar]; // si sur page 2 ou autre , listi recommence le scan a Listi[Pagevar]...[pagevariable dans jeux]
            }
 

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,440
First Language
French
Primarily Uses
RMMV
What is Listi? Listi isn't an array right? Afaik Listi is a number on there.
I forgot to declare my global variables and also thank you, I had also made a mistake, I changed.
I correct another error as I had forgotten to declare a string to display the image.


This is what gives my super menu script.
It is 100x times faster than rpgmaker menu and appears almost instantly.
I am satisfied.












The final script

Code:
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
    // to be overridden by plugins
    console.log('start');
    _Game_Interpreter_pluginCommand.call(this, command, args);
    if (command === 'menuobj') {




        var Pid = 100; // picture ID for clic, 100 + max 36 Max 200
        var ItemtotalDB = 170; // Maximum item dans le DB rpgmaker
        var Itemtotalposs = 0; // Nombre objet posseder
        var Objetposseder = []; // creer une variable poru chaque item avec valeur
        var i = 1; // représente page pour listi 
        var Pagevar = $gameVariables.value(34);
		var Listi = 0;
		var ListiP = [];// ou doi commencer le listi a chaque page


        for (Listi = 1; Listi < ItemtotalDB; Listi++) {
            if ($gameParty.hasItem($dataItems[Listi]) == true) {
                 Objetposseder[Listi] = Listi; //create variable based on DB Objetposseder1=2,Objetposseder2=2,Objetposseder3=3...
                Itemtotalposs++; //calcul global total objet poseder		
                if (Itemtotalposs == 37 || Itemtotalposs == 73 || Itemtotalposs == 108) { //a chaque +1 que 36 Itemtotalposs = 1 nouvelle page
                    i++;
                     ListiP[i] = Listi; // pour page 2,3,4..., on sait que on doi comment la list a cette endroit . 
                }
            }
        }
		            console.log('check si array existe' + ListiP[2] + Objetposseder[2]);
        if (Itemtotalposs == 0) {
            console.log('le joueur na pas objet');
        } // stop because no objet !!}
        else {
            //page1
            var Xitem = 0; // X coor for the item + picturesize+ marge
            var Yitem = 0; // Y coor for the item + picturesize+ marge
            var InpicX = 88; // Initial X of menue item list
            var InpicY = 226; // Initial Y of menue item list
            var MargeX = 7; // Marge bettwenn 2 picture X 
            var MargeY = 6; // Marge bettwenn 2 picture Y
            var ISIZEX = 82; // X size of picture
            var ISIZEY = 82; // X size of picture
            var NBitempagemenu = 0;

            if (Pagevar == 1) {
                Listi = 1; // si sur page 1 , listi recommence le scan a 1
            } else {
                Listi = ListiP[Pagevar]; // si sur page 2 ou autre , listi recommence le scan a Listi[Pagevar]...[pagevariable dans jeux]
            }

console.log('check si array existe' + ListiP[2] + Objetposseder[2]);
            for (; Listi < ItemtotalDB; Listi++) {
                if (Objetposseder[Listi] == Listi) {
                    //afficher objet

					Listi = String(Listi); 
                    $gameScreen.showPicture(Pid, Listi, 1, InpicX + Xitem, InpicY + Yitem, 150, 150, 255, 0);
					$gameScreen.movePicture(Pid, 1, InpicX + Xitem, InpicY + Yitem, 100, 100, 255, 0, 18);
					Listi = Number(Listi); 
                    console.log('Affiche imageqqqqqqqqqqqqqqqqqqqq ' + Pid + 'et listi est a ' + Listi);
                    $gameScreen.setPictureCallCommon(Pid, 21, 1); // si clique sur item renvoi vers event.commun
                    Textitems = String($dataItems[Listi].name); // on va chercher le nom fichier 
                    Textitems = Textitems.split(' - '); // on le découpe en 2 
                    $gameScreen.setDTextPicture('\\OW[5] ' + Textitems[0] + '', 20); //plugincall dtext
					console.log('Text afficher zzzzzzzzzz ' + Textitems[0] + Textitems[1]);
                    $gameScreen.showPicture(Pid + (36 * 1), '', 0, InpicX + Xitem - 45, InpicY + Yitem-80, 100, 160, 50, 0); // affiche image a PID+36 (max72)
                    $gameScreen.setDTextPicture('\\OW[4] ' + Textitems[1] + '', 19); //plugincall dtext
                    $gameScreen.showPicture(Pid + (36 * 2), '', 0, InpicX + Xitem-41, InpicY + Yitem -80, 100, 20, 50, 0); // affiche D_text titre objet
					$gameScreen.movePicture(Pid + (36 * 1), 0, InpicX + Xitem - 45, InpicY + Yitem-46, 100, 100, 255, 0, 27);
					$gameScreen.movePicture(Pid + (36 * 2), 0, InpicX + Xitem-41, InpicY + Yitem -30, 100, 100, 255, 0, 20);
                    console.log(67);
                    NBitempagemenu++
                    Pid++
                    Xitem += ISIZEX + MargeX;
                }
                if (NBitempagemenu == 36) {
                    console.log('On break car NBitempagemenu= ' + NBitempagemenu); //afficher objet
                    break;
                    console.log(69);
                } else if (NBitempagemenu == 12 || NBitempagemenu == 24) {
                    //Saut de ligne
                    Xitem = 0;
                    Yitem += ISIZEY + MargeY;
                }
            }
            console.log('bouclefin = ' + Listi);
        }
        console.log(71);



    }
    console.log('end');

}
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,035
Messages
1,018,455
Members
137,821
Latest member
Capterson
Top