Meter will not stop (Help!)

Hello again! 
I'm having difficulties with another part of my game. This time with a HUD Meter. 
I have it so that when the character steps on top of a Region ID the HUD meter starts to go up. It's suppose to stop once the variable connected to it reaches 160, but it goes past it and once off the spot it will re-adjust itself to said 160. I'm not sure how to fix this so it can just stop at the limit even if you're just standing on it. 
Here are some images:

Spoiler
This is the common event always running in the background, for the meter. 

[IMG]https://41.media.tumblr.com/8ac745448ff187db0fc7b873166f4169/tumblr_inline_nn8pr8KIAp1t6ctn8_540.png[/IMG]

This is the region ID  

[IMG]https://40.media.tumblr.com/d92685deda545731f60823ff45787970/tumblr_inline_nn8prcoluX1t6ctn8_540.png[/IMG]

At the start of it it goes slow and steady. Which is what I want. 

[IMG]https://40.media.tumblr.com/421687e590bb7d41169784225c76e585/tumblr_inline_nn8prih5ae1t6ctn8_540.png[/IMG]

But once it finishes, the bar goes over by a little too much. 

[IMG]https://41.media.tumblr.com/82ec10d39d7e5e0fb8890c0e5a0ec3a0/tumblr_inline_nn8prpAYCH1t6ctn8_540.png[/IMG]

Then once you step off of it, it resets backwhere it needs to. 

[IMG]https://36.media.tumblr.com/c115c3d8b873da668a9eddbad5db451c/tumblr_inline_nn8prvTTkj1t6ctn8_540.png[/IMG]
I would be so grateful if someone can help me out here. 

Thank you. 
In short, it is because you move the picture BEFORE capping the variable between -160 and 160, not after. So if it's 170, you'll move it to 170 then after the next 60 frames will move it back again.


However, other questions ...


How does the variable increase?


Why do you have the second line in the first event? You are setting the variable to the value in the variable. That achieves nothing.


Try something like this as the second line instead of Var 20 = Var 20:

Control Variables [0020: Panic] = Script: v=$game_variables[20]; [160, [-160, v].max].min]followed by your Move Picture command.
Or just move the Move Picture to the bottom of the event, after the variable has been adjusted in the way you're already doing it. And get rid of the second line.
Thank you so much! It works perfectly now!! You're great! 

Original thread: https://forums.rpgmakerweb.com/threads/meter-will-not-stop-help.39162/