GML Need help with variables. (Quick Response Needed for deadline)

Discussion in 'Programming' started by Aram Potter, Aug 10, 2018.

  1. Aram Potter

    Aram Potter Member

    Aug 10, 2018
    Hi all,

    I'm fairly new to Gamemaker and I need help with a small problem I'm having to do with some variables.

    I have 2 different integer variables: and amount.

    What I am trying to do is take away the amount variable integer from the integer when I click a button.

    What I've tried to do is, on left click: -= amount;

    Please let me know what I am doing wrong, any help would be really appreciated.

    Thank you.
  2. atrus159

    atrus159 Member

    Aug 8, 2018
    This seems to be correct, what's the bug you're having?
  3. BabyDukaCPH

    BabyDukaCPH Member

    Feb 8, 2017
    Yeah, this sounds right. It's basically like saying a - b = c. Try going to the Scripts tab > Search In Scripts... and type in - then you will have an overview of all the instances calling that variable. You can do the same with amount. And try putting more of the code from your event in a post
  4. TheouAegis

    TheouAegis Member

    Jul 3, 2016
    That code needs to be in the button object's mouse button left pressed event.
  5. flerpyderp

    flerpyderp Member

    Apr 26, 2018
    Yes, since you haven't described the problem, we can only guess and offer solutions which might be irrelevant. If the problem is that isn't changing despite the left mouse being clicked, check to see that you're not constantly setting it to a value in the step event somewhere.

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