1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

GM:S 1.4 Debug error pls

Discussion in 'Programming' started by prithvidiamond, Jun 27, 2016.

  1. prithvidiamond

    prithvidiamond Member

    Jun 21, 2016
    Pls debug what mistake I have made i the code below and what best can be done:

    //inside step event
    var inst;

    if (mouse_check_button_pressed(mb_left) and inst = collision_point(mouse_x, mouse_y, fruit = fruitguess, true, true));
    points += 1

    script_execute = scr_draw_obj1;
    script_execute = scr_draw_obj2;


    all help is appreciated,

  2. jo-thijs

    jo-thijs Member

    Jun 20, 2016
    The way you use = is invalid.
    If you use = inside an if statement, then it will be treated as a comparison, not as an assignment.
    The same goes for using = inside an argument expression of a function.
    And assigning a script to script_execute is invalid as well, you should rather use: scr_draw_obj1(...);
  3. FrostyCat

    FrostyCat Member

    Jun 26, 2016
    Let's be absolutely honest here, do you even understand what you just wrote?
    • Why are you trying to initialize inst in the middle of an if condition?
    • What kind of object/instance ID is fruit = fruitguess?
    • Why are you attempting to run scripts like this when the Manual clearly instructs otherwise?
    Quit the blind trial-and-error and read the Manual entries on basic GML form, then follow its instructions instead of making up nonsense in panic. If you are too panicked to think straight, put the keyboard down until you can. If it doesn't make sense to another human, it can only make less sense to a parser.
  4. obscene

    obscene Member

    Jun 21, 2016
    In the future it's helpful if you explain why you want code debugged. Did your game crash? Did it freeze? Did you get an error? Did something happen you didn't expect? When you have errors that's the first thing you need to share.

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