I just created a simple text escape for script variables/expressions. It is pretty useful if you have variables on your JS script that you want to display in a text message, but don't want to assign them in a game variable (escaping with \V[x]).
The plugin is attached to this post.
To escape any JS expression:
Hello, I have \S{myPlugin.numberOfApples} apples!
复制代码
As it uses the
eval
复制代码
function, you can't call functions that returns values, only variables or expressions. If any expression used causes an error that would crash your game, no worries, it is handled and logged (your message will reference the JS expression, thought).
Of course you won't be able to preview the message, as the variables are only available in game runtime.