Making a visual gauge that automatically updates and visually fills/deplets?

Is it possible to make a visual bar/gauge that automatically updates and visually fills/depletes?

So far I've used


which is offline right now, and I have used a crop picture event. The problem with the crop picture event is that the way I've set it up it is a lot of work to do for every gauge and it shows the depletion/fill only step by step. I've used a lot of if and if else statements to crop it based on the variable assembled to the gauge (meaning for example if there is 100 health every 10 steps the picture would crop).

There has to be a better way of displaying that, right? Like in Ren'Py this is just one command.


So what is the best way to make a visual gauge for an evented battle system? One that, at best, visually fills up and depletes!
push

ok, so I assume this is not possible. Maybe someone has a tip for implementing gauges the best way?
Hi mardin,

unfortunately, there is no out of the box gauge element available. But it is possible to build one yourself as you already figured out. I think you can animate it yourself with a loop command and Crop Picture instead of lots of Condition commands. You can then put it into a common event to reuse for multiple gauges.

A rough example/idea for a 200px gauge. The longer the wait the slower the animation speed.
(I also sent you a PM with a fix for the background issue you had a while ago).

Code:
Number Variable [gauge_width] = 200
Loop
  Crop Picture [gauge_width]
  Wait 20ms
  Condition [gauge_width] <= 0
    Break Loop
  Else
    Number Variable [gauge_width] - 10

Original thread: https://forums.rpgmakerweb.com/threads/making-a-visual-gauge-that-automatically-updates-and-visually-fills-deplets.120818/