How to register single click to cause code to run?

HidetoKoudanshi

  • Posts: 127
The below code is on a When Drawing event.

I'm trying to make it so when you click my +1 actor button, it runs the code (Checks to see if capsules exists and if not, sets capsules to 1. Otherwise if capsules exists, set capsules to current-value-of-capsules +1.) When I set it to Mouse Was Pressed On Self, nothing happens. The number doesn't show at all. If I set it to Mouse Is Down On, the number shows and runs up the count for as long as I click and hold the actor. I just need to register a single click to cause a single +1 to be added to the value of capsules. What am I doing wrong?
If I ever commission you for code work, please know that I understand how commissioning works. You must get paid first before you will code anything for me. Only once you are paid the agreed-upon price, will you begin coding for me. I respect artists and coders. You deserve to be paid for your hard efforts.

Luyren

  • *
  • Posts: 2811
Remove your "mouse is pressed on self" from the drawing event.
Use a mouse event that only changes your game attribute.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.

HidetoKoudanshi

  • Posts: 127
But I also need the number to permanently display to the left of the +1 actor button. What then?
If I ever commission you for code work, please know that I understand how commissioning works. You must get paid first before you will code anything for me. Only once you are paid the agreed-upon price, will you begin coding for me. I respect artists and coders. You deserve to be paid for your hard efforts.

Luyren

  • *
  • Posts: 2811
Same thing. Drawing your value and increasing your value are two different things, handled by two different events.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.