Bars with Variables

Seems to happen regardless of what variables I use, be they defined or undefined.

Please let me know if you get it working with your own variables.
Something something when you start a game the variables aren't quite created yet.
So it gets grumpy on us. I just put the variables inside the actual window methods to avoid this, as I should have done in the first place.

See link to updated script.
I made two chests that raised and lowered my game variable, the bar responds as predicted and moves back and forth from positive to negative.

http://pastebin.com/x9SdiqDA
Ah, it looks like it's working!

Just one tiny thing: in the process of updating it, you appear to have left out two of the options you had integrated previously: namely the EnabledMap and EnabledBattle params.

But the bar itself is definitely fixed and displays variables correctly now. Thanks very much for addressing that.
Ok, edited.
Thanks for that, setting it to battle only was quite crucial for me. The bar itself is perfect now!

Feel free to move on now and focus on Bareacine, or any other projects you're working on.

In the event that you'd like to expand upon this, though:

1. Is the text above the bar always supposed to read 'var/varMax', or should it automatically be using the values that are selected for the bar itself? Sorry if this is something the user is supposed to edit for themselves, I looked through the script but couldn't find any obvious places to put it. An option to hide the text completely could also be quite useful to some.

2. Some of the positioning parameters don't quite seem to work in the way you might expect. This is a completely unfounded guess, but I suspect this may have something to do with the fact that the default 816x624 resolution is referenced in the script a few times, resulting in strange behaviour when using one of the resolution change plugins that have been released.

3. Is there a way to change the vertical positioning of the text? I tried fiddling with the 'bar 1 text y' parameter but that seems to either be affecting the size of the text or not affecting it at all.

Side note: you said earlier that this plugin is too specific to each individual user to be posted in its own plugin thread, which I agreed with. However, if you were to implement a greater degree of user customization at some point, I think this would actually have some pretty broad appeal. At the very least, it would be a shame if your hard work wasn't properly showcased.
1) User edited

2)I can check if I can get it to detect your resolution. I am running default. Which plugin did you use to change this with?

3)I could clean it up a lot and make it more presentable for released plugins, I could have overridden the text y when debugging and forgot to change it back, happens.

Trying to solve the enemy bars issue at the moment., don't know enough about how sprites are placed and moved on the screen to resolve it. Will probably have to wait until Yanfly or someone who hasn't been programming for 2 weeks to release one.
1. Ah, I took another look and found where the text is configured. I have no idea how to reference variables within text, though.

this.drawText('$gameVariables.value(5)/100', x , y - this.lineHeight(), width, 'center'); will literally just show '$gameVariables.value(5)/100'... But that's just me being code illiterate.

2. Personally, I'm using Yanfly's Core Engine to change my resolution. I think there's a simple way to check and reference the current screen width and height, just based on what I've seen while skim-reading through scripts, but I have no idea what it is.
this.drawText($gameVariables.value(5)+'/100', x , y - this.lineHeight(), width, 'center');

Original thread: https://forums.rpgmakerweb.com/threads/bars-with-variables.47119/