YEP.181 – Message Eval Text – RPG Maker MV

Yanfly Engine Plugins is a plugin library made for RPG Maker MV, a wonderful piece of software to help you make that role playing game of your dreams. You can find out more about RPG Maker MV here.

You can grab the plugin here:

English Mirror

Support Team Yanfly on Patreon

We have a new Bonus Plugin today!

This is a small plugin that adds in a new text code for messages so that people can run JavaScript code and display it as text. This can be used to make calculations on the fly without needing to use Change Variable events prior to displaying the amount or to determine what kind of string would be displayed without making a plethora of Conditional Branch events.


Introduction


This plugin requires YEP_MessageCore. Make sure this plugin is located under YEP_MessageCore in the plugin list.

This is a small plugin that adds in a \evalText<<code>> text code for messages so that people can run JavaScript code and display it as text. This can be used to make calculations on the fly without needing to use Change Variable events prior to displaying the amount or to determine what kind of string would be displayed without making a plethora of Conditional Branch events.


Text Code


\evalText<<code>>
– Replace ‘code’ with JavaScript code. It will run the code inside, then return whatever is the last line of the code that’s ran. Here are some examples of what you could do this with:

– – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –

Examples:

\evalText<<$gameActors.actor(1).atk + $gameActors.actor(2).atk>>
– Displays the sum of actor 1’s ATK and actor 2’s ATK.

\evalText<<Math.min(1000, $gameParty.gold())>>
– Displays either ‘1000’ or the party’s gold count, depending on which one is currently smaller.

\evalText<<[‘His’,’Her’,’Its’][\v[123]]>>
– Depending on the value of Variable 123, this will display ‘His’ if the Variable 123 value is equal to 0, ‘Her’ if the value is equal to 1, or ‘Its’ if the value is equal to 2.

\evalText<<[‘Abel’,’Brandon’,’Chris’][$gameVariables.value(456)]>>
– Depending on the value of Variable 456, this will display ‘Abel’ if the Variable 456 value is equal to 0, ‘Brandon’ if the value is equal to 1, or ‘Chris’ if the value is equal to 2.


Happy RPG Making!


Please wait while you are redirected...or Click Here if you do not want to wait.