Error message is calling a sprite a variable

Discussion in 'Programming' started by Ethan Uffelman, Jun 3, 2019.

  1. Ethan Uffelman

    Ethan Uffelman Member

    Joined:
    Jun 3, 2019
    Posts:
    2
    I'm trying to get my character to jump, but when I press space this happens:

    FATAL ERROR in
    action number 1
    of Key Press Event for <Space> Key
    for object objElyssa:


    Variable objElyssa.sprElyssa_jumpRight(100005, -2147483648) not set before reading it.
    at gml_Object_objElyssa_KeyPress_32 (line 26) - sprite_index = sprElyssa_jumpRight;
    ############################################################################################
    --------------------------------------------------------------------------------------------
    stack frame is
    gml_Object_objElyssa_KeyPress_32 (line 26)

    Could anyone explain what this means? It's saying Variable ObjElyysa.sprElyssa, but those aren't variables. All I've figured out is that it corresponds with the picture I've uploaded. I know there are a lot of things I'm doing wrong besides what is stated here, but that's really all I care about. I'll try and figure out the rest myself.

    Can anyone see the picture? There is a notification telling me that I can't post links until I've posted five things.
     

    Attached Files:

  2. TsukaYuriko

    TsukaYuriko Q&A Spawn Camper Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    1,353
    To clarify, you can't post links without moderator approval. You definitely can post links. :) (You can't edit posts with links, though.)

    You are receiving this error message because sprElyssa_jumpRight is not recognized as a sprite (it would otherwise be resolved to that sprite's ID). Therefore, it is assumed that you intend for it to be a generic variable. This doesn't exist as well, hence the error.

    Double-check your spelling and clear your asset cache to rule out cache issues.
     
    Bentley likes this.
  3. Ethan Uffelman

    Ethan Uffelman Member

    Joined:
    Jun 3, 2019
    Posts:
    2
    I'm pretty sure I spelled everything correctly. Could you tell me how to clear my asset cache? Sorry, I'm very new to coding.
     
  4. TsukaYuriko

    TsukaYuriko Q&A Spawn Camper Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    1,353
    It's under Build -> Clean.

    If that doesn't do the trick, try commenting out the affected line or assigning a different sprite - does anything still go wrong? If so, the source lies elsewhere altogether.
     
    Last edited: Jun 12, 2019
  5. EvanSki

    EvanSki Dedicated link provider

    Joined:
    Apr 17, 2018
    Posts:
    441
    You're trying to call the sprite as a variable in the object
    try objElyssa.sprite_index
     
  6. TsukaYuriko

    TsukaYuriko Q&A Spawn Camper Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    1,353
    That's merely the code generated from the D&D. In the screenshot included in the opening post, you can see that it's just sprElyssa_jumpRight.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice