1. Hey! Guest! The 34th GMC Jam will take place between August 22nd, 12:00 UTC (Thursday noon) and August 26th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

GMS 2 (Solved)Game Maker Breaks when Defining Params

Discussion in 'Programming' started by EvanSki, Jul 5, 2019.

  1. EvanSki

    EvanSki King of Raccoons

    Joined:
    Apr 17, 2018
    Posts:
    537
    So im coding a jsdoc script and it just suddenly stops working.
    it doesnt recognize the @param
    syntax highlighting stopped working (stopped highlighting certain variables as local and non local)
    and its spiting out errors that arent true and at the wrong lines.

    is broke.png

    as for the player step event
    step_lines.png
    Code:
    //animate player
    if (state = states.walking)
    {
        walk_anim_time += 1/game_get_speed(gamespeed_fps);
     
        var t = walk_anim_time / walk_anim_length;
     
        if (t >= 1)
        {
            walk_anim_time = 0;
            t = 1;
            state = states.idle;
        }
     
        var _x = lerp(x_from, x_to, t);
        var _y = lerp(y_from, y_to, t);
     
        x = _x * tile_width;
        y = _y * tile_height;
     
        image_index = frames[floor((walk_anim_frames -1) *t)];
     
    }
    
    
    if (keyboard_check(input_right))
    {
        scr_player_move(directions.right);
    }
    
    if (keyboard_check(input_left))
    {
        scr_player_move(directions.left);
    }
    
    if (keyboard_check(input_up))
    {
        scr_player_move(directions.up);
    }
    
    if (keyboard_check(input_down))
    {
        scr_player_move(directions.down);
    }
    Macros script
    Code:
    gml_pragma("global","MACROS()");
    
    #macro tile_width 32
    #macro tile_height 32
    
    #macro input_up (ord("W"))
    #macro input_left (ord("A")
    #macro input_down (ord("S"))
    #macro input_right (ord("D"))
    
    enum directions
    {
        right,
        up,
        left,
        down
    }
    
    global.components = [];
    global.components[directions.right] = [1,0];
    global.components[directions.up] = [0,-1];
    global.components[directions.left] = [-1,0];
    global.components[directions.down] = [0,1];
    
    
     
  2. TsukaYuriko

    TsukaYuriko Q&A Spawn Camper Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    1,538
    Try restarting the IDE and clearing the asset cache.

    Failing that, have you recently performed any major changes to your game's code base or updated GMS2?
     
  3. EvanSki

    EvanSki King of Raccoons

    Joined:
    Apr 17, 2018
    Posts:
    537
    I tried that and the error still persists
    I updated to the latest version but this problem was in the other versions as well just not as frequent as now
     
  4. EvanSki

    EvanSki King of Raccoons

    Joined:
    Apr 17, 2018
    Posts:
    537
    I think this is my issue right here

    EDIT: yes that was my problem, why didnt it just say so rather then giving random errors
     
    Last edited: Jul 5, 2019
    TsukaYuriko likes this.
  5. TsukaYuriko

    TsukaYuriko Q&A Spawn Camper Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    1,538
    Sneaky. Was trying to check for stuff like that but didn't catch it. :confused:
     
    EvanSki likes this.
  6. EvanSki

    EvanSki King of Raccoons

    Joined:
    Apr 17, 2018
    Posts:
    537
    But why didnt it just say hey you missed a ) here rather then like, hey all this stuff thats not broken is broken
     
  7. TsukaYuriko

    TsukaYuriko Q&A Spawn Camper Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    1,538
    Well, it did say "got {, expected )", which is what the code looked like after the macro was substituted with its value and pretty much equates to "hey you missed a )". The rest is collateral damage of the initial mess - once one line is messed up, every following line will be messed up, as the compiler has no sense of "lines" in a syntax sense.
     
    EvanSki likes this.

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