You can do with script calls.
The problem is that if you want to write something, you first have to take a piece of paper.
Without the paper, you cannot write.
What I mean is that you have to create a bitmap(paper) first, then write something above it.
And after that, you have to add this bitmap in the scene map(that where I presume you want to show the variable).
Since you are posting in learning javascript, I will not create the code here for you, but point some direction for you to find out.
So, in Rm Mv, you can create a
bitmap using the
Sprite Class or the
Window Class.
- With the window class, it will be more like the Window_MapName(rpg_windows.js, line 4657)
- With the sprite class, will be more like the Sprite_Timer(rpg_sprites.js, line 1998)
Read these parts of the code for you to learn how to do it.
After you create your sprite or window, you have to
add it to the scene.
You can do this by accessing the current scene(SceneManager._scene) and add a child to it(rpg_scenes.js, line 733(sprite timer), or 743(mapWindow).
Also for the sprite timer, you have to take a look at
Spriteset_Base(rpg_sprite.js, line 2123) to see how it adds the timerSprite.
However, you can add the sprite just like the window map too.
And then, after that, you can use the
drawText function to write your text.
But, if you are making this constantly updating, I recommend you that after you make the script call work, add it to a plugin and execute it via a plugin command or with the activation of a switch.
Because in script call you will be constantly eval your script, with can give you performance issues, or not.