I want to use a variable I created in a plungin rather than a game variable. Is it possible to make the show Text window understand that there is a js variable to "translate" ?
MV Is it possible to use a JS variable in show Text ?
Learning JavascriptYes, but whether you can do that right off the bat depends on what you mean by "created in a plugin". What is it you're trying to display?
Two possibilities actually :
either some kind of global variable created inside my plugin :
var myVariable = "text";
Or variable/attribute like :
$gameActors.actor(1)._hp
either some kind of global variable created inside my plugin :
var myVariable = "text";
Or variable/attribute like :
$gameActors.actor(1)._hp
If you put it into a $gameVariables variable (either by Control Variables, or by setting it inside the plugin), you can use it in Show Text. But not a variable that's defined within a plugin - unless you include in your plugin a way for a text message to do so.
Ok that's what I thought. I was already using this technique (using a script to put myVariable into a $gameVariables) but I would have liked using only my variables.
I take this opportunity to thank you all for your kind answers. I think everybody here is very supportive and patient and that's not the case everywhere.
I take this opportunity to thank you all for your kind answers. I think everybody here is very supportive and patient and that's not the case everywhere.
The issue really is that there isn't currently a core function to display changing values in a text box other than the provided text codes, so as Shaz said you'd either have to add a new text code, or just stick with storing those values in game variables. I assure you that you're already doing this in the optimal way it's possible to do.
You could also use a script call to show the text instead of the event command and reference your plugin variable there. I can't remember the exact code, but it should be in the MV/MZ script call list that's in a pinned thread somewhere here in the js subforum.
Original thread: https://forums.rpgmakerweb.com/threads/is-it-possible-to-use-a-js-variable-in-show-text.142050/