Error: Unexpected symbol in expression

Discussion in 'Programming' started by bleeze, Sep 12, 2019.

  1. bleeze

    bleeze Member

    Joined:
    Sep 12, 2019
    Posts:
    6
    I'm not used to programing, have very basic skills. Tried creating a 2d Array, maybe it doesn't work this way?
    Anyway, i followed a youtube video for creating inventories, he did use Gms 2 and im using Gms, which could be the issue. Pls help me in any way possible! It's the position of the "underscore" ( " _ " ) that causes the error.


    var _typeofitem = argument0
    var _sprite = argument1

    itemdef [ _typeofitem, itemprop.sprite ] = _sprite
     
  2. Binsk

    Binsk Member

    Joined:
    Jun 22, 2016
    Posts:
    583
    Normally it doesn't matter in GameMaker except for this one case:

    You need a semicolon at the end of a line that starts with var.

    For future reference, please copy+paste the actual error message. It usually has some extra info.
     
  3. EvanSki

    EvanSki King of Raccoons

    Joined:
    Apr 17, 2018
    Posts:
    578
    You need an Assessor after Itemdef
     
  4. Binsk

    Binsk Member

    Joined:
    Jun 22, 2016
    Posts:
    583
    Not if it is an array. It should be just fine without one.

    The only time you use an accessor w/ an array is to modify by reference when passed into a script, all other times are unnecessary. All other data structures, however, do indeed need them.
     
  5. bleeze

    bleeze Member

    Joined:
    Sep 12, 2019
    Posts:
    6

    Thank you this worked! thanks for advice :)
     

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