Multiple Yanfly Plugin SyntaxErrors

Discussion in 'Javascript/Plugin Support' started by princessbinas, Dec 28, 2018.

  1. princessbinas

    princessbinas Villager Member

    Messages:
    6
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    I recently loaded up a previous game I made (and is still a work-in-progress) with a bunch of Yanfly Plugin Engine scripts. All of the scripts I am using are from Yanfly and the base RPG Maker MV steam edition product. I am not entirely sure what is going on because I am not sure how to debug the plugins, so here are the pictures of the error and the YEP plugins that show up in game in and are present in the folder.



    These scripts were working a month or two ago and they are at the latest version at the time of posting this thread. I thought updating every single plugin would fix this issue, but it did not.

    I would directly send this bug report to Yanfly, but I cannot find any form of contact with him/her. I have no clue as to what is causing these errors nor how to fix them. Even less in terms of debugging. I am not knowledgeable in JavaScript (I know a tiny bit of C++, HTML/CSS, and C#).

    If this is not a bug, then can someone let me know what happened? I did not even change anything in the plugin settings when I first loaded up my project. All I did was add the note tags for item synthesis and add a few new icons to the IconSet file.

    If viewing my project is necessary, please let me know and I will zip it up for viewing. I am willing to try stuff and throw whatever comes up at the wall to see what sticks (the latter being my usual method of tackling things)...

    http://yanfly.moe/2016/01/15/yep-58-item-synthesis/
    http://yanfly.moe/2015/10/16/yep-11-item-core/
    http://yanfly.moe/2016/04/29/yep-96-item-disassemble-rpg-maker-mv/

    EDIT: I narrowed it down to the Item Synthesis Plugin. I am not sure what happened... I guess I miss used a tag at best and it broke at worst. I will edit again if tag removal doesn't solve anything.

    EDIT: Nevermind, I flubbed the note tags... I will leave this up as a reminder why I should take a break instead of obsessively search for fixes... Taking a break is what lead me to figuring out I flubbed my tags. I give anyone and everyone permission to slap me with a fish...

    EDIT: I am not sure what I am doing wrong when it comes to the note tags... I am trying to follow the directions provided in the plugin.



    Here are the lines of code in Item Synthesis that are being targeted.

     
    Last edited: Dec 28, 2018
    #1
    Fornoreason1000 likes this.
  2. Andar

    Andar Veteran Veteran

    Messages:
    28,672
    Likes Received:
    6,594
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    1) the Problem is somewhere in the data parsing, which means that somehow the data needed for the plugins no longer fits - like missing vor wrong database entries and so on.
    2) that said, whenever yanflies Plugins start to behave strangely, my first step is to check plugin order and core version because that has been known to cause strange errors at random times.

    So please post a Screenshot oft your plugin manager, of the console message (F8) of that error and the version of your projects RPG_core.JS file (open with Text editor).
     
    #2
    Fornoreason1000 likes this.
  3. princessbinas

    princessbinas Villager Member

    Messages:
    6
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    I actually found the reason it acted up when I was talking about it on Discord with someone else who had the same issue at some point. Someone found that the issue was how I typed the IDs. Instead of putting "<Item Recipe: 131>," I put "<Item Recipe: 0131>." I was being a little too formal... This can be closed now.
     
    #3
  4. Andar

    Andar Veteran Veteran

    Messages:
    28,672
    Likes Received:
    6,594
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    so it was case 1 - wrong database entries.
    just for info: leading zeroes are the indicator for an octal number instead of a decimal number, so 0131 octal is in reality 89 decimal...
     
    #4
  5. princessbinas

    princessbinas Villager Member

    Messages:
    6
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    And what does octal mean in terms of the plugin?
     
    #5
  6. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,626
    Likes Received:
    1,053
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    Thankfully, Javascript has deprecated this behavior since the 2015 standards of the language. More information in the spoiler.

    In Javascript, to use octal numbers you have to explicitly use a leading 'zero' and the letter 'o', like this:
    Code:
    0o131 // this is the octal equivalent to 89 in decimal
    If Javascript sees this, it will correctly interpret it as 131 in decimal:
    Code:
    0131 // This is the number 131
    "0131" // This is a string "0131"
    @princessbinas
    The real issue is with how the plugin reads the notetag, this is the line you highlighted:
    Code:
    var array = JSON.parse('[' + RegExp.$1.match(/\d+/g) + ']')
    This is a bizarre way of constructing an array by the plugin author. What happens when you have the notetag as "Ingredient: 0131" or whatever is this:
    Code:
    var array = JSON.parse('[' + '0131' + ']');
    // Which is equivalent to this
    var array = JSON.parse('[0131]')
    // ^^ this is not valid JSON format, so the error is thrown "Unexpected Number in JSON"
    That line would have been better written like this:
    Code:
    var array = [parseInt(RegExp.$1.match(/\d+/g))]
    If it was written like this, you could have "Ingredient: 0000000131" and it would still be interpreted as 131
     
    #6
  7. princessbinas

    princessbinas Villager Member

    Messages:
    6
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    That makes some more sense now. Thank you.

    Someone should really suggest this to Yanfly for a future update. More flexibility for those who want leading zeroes for whatever reason.
     
    #7

Share This Page