I have an issue with my menu : Cannot read property "param" of undefined

Discussion in 'Javascript/Plugin Support' started by Stry, Feb 20, 2019.

  1. Stry

    Stry Warper Member

    Messages:
    2
    Likes Received:
    0
    First Language:
    French
    Primarily Uses:
    RMMV
    Hello, since a few days, I tried to create a plugin by myself but I had an issue that I didn't know how to resolve..

    [​IMG]

    [​IMG]

    [​IMG]

    I understand that the problem comes from the line with TextManager.param(paramId) and _actor.param(paramId) but i don't know how to resolve it.

    If anyone has a solution, I'm interested ^^'.
     
    #1
  2. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,601
    Likes Received:
    1,007
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    The error is only coming from one line, not both. You can tell from the error message exactly which line number (we can't see your line numbers in the code screenshot).


    I know it is the this._actor line based on the error message. "cannot read property param of undefined" is like trying to do this:
    Code:
    undefined.param
    Obviously, that will cause an error because "undefined" doesn't have any properties.

    So you can deduce that:
    Code:
    this._actor === undefined 
    1. Do you expect "this._actor" to have a value?
      • If so, where does this value come from?
    2. The drawAttack function you wrote takes 2 parameters but you are passing 3. I don't know which one is right
    Probably you need to receive actor as a parameter in drawAttack and use that instead of this._actor but that's just a guess.
     
    #2
    Stry likes this.
  3. Stry

    Stry Warper Member

    Messages:
    2
    Likes Received:
    0
    First Language:
    French
    Primarily Uses:
    RMMV
    Hello !

    I resolve the problem this evening, like you said I added the missing parameter which was actor, and I initialized "this._actor" with actor.

    [​IMG]

    Thanks to you I understand the problem more easily, thank you for your answer ^^
     
    #3

Share This Page