RMMV Best way to get specific info from note tags?


Apr 6, 2016
Reaction score
First Language
Primarily Uses

So I am in need of getting the damage formula and the elementId from customEffectEval I have.

So, I was going at this thing some months ago. And I did a little snippet of code, that I felt, even then, was rather messy.
BISH.SkillDescription.getEffectFormula = function (i, n) {
        if (this.hasStateFormula(i, n) === true) {
            textBeforeFormula = "var damage = ";
            f = $dataStates[this.getCurState(i, n)].qmeta["Custom Regenerate Effect"];
            x = f.indexOf("var damage = "); //First part of formula string;
            x += textBeforeFormula.length;
            y = f.indexOf(";"); //Formula string ends.
            f = f.substring(x,y);
            f = f.contains("origin.") ? f.replace("origin.", "a.") : ("Error in $dataStates[" + this.getCurState(i, n) + "].qmeta formula. Given string \"" + f + "\" cannot find \"origin.\"");
            a = this.getEffectType(i, n) + "${";
            a += f;
            a += "} ";
            a += this.getEffectElement(i, n);
            return a;

    BISH.SkillDescription.getEffectElement = function(i) {
        //Get the element ID of the formula.
        p = $dataStates[this.getCurState(i, n)].qmeta["Custom Regenerate Effect"];
        s = "";
        if (p.contains("var elementId = ")) {
            u = p.indexOf("var elementId = ");
            o = p.indexOf(";", u);
            u = p.substring(u, o)
            o = u.indexOf("=");
            u = u.substring(o + 2);
            s += $dataSystem.elements[u] + " damage";
            s += " ";
        return s;
As you can see, it's not a pretty sight. I could do it smoother now. I did a quick little fix for the first one, then I thought. I should ask if there is a better way to this that I am unaware of as of yet. So here I am, a guy, sitting in front of a screen, at a forum, asking for tips and tricks. At any rate here is what I did about 5 minutes ago.
Window_SkillHelp.prototype.getEffectFormula = function (customEffectEvalString) {
        textBeforeFormula = "var damage = ";
        var x = customEffectEvalString.indexOf(textBeforeFormula);
        x += textBeforeFormula.length;
        var y = customEffectEvalString.indexOf(";");
        customEffectEvalString = customEffectEvalString.substring(x,y);
        return customEffectEvalString;
Still not happy with this, but I only spent a few minutes on it to get it working with the plugin revamp.

So my question is, is there an easier way to do this, or is the approach above close to the way it should be done?

I believe the plugin in charge of assigning this specific notetag is YEP_BuffsStatesCore. But, the question should not necessarilybe treated as plugin specific.

Best regards,

Edit: Realizing that I never specific what I'd be looking for -.- So for example, where it says "var damage = ", I'd like to extract the damage formula so that I can calculate it. In terms of the element, I'd just like to extract the number.

Alright, so I am currently using this function:
BISH.getCustomEvalFormula = function(customEval, string) { //To find a value, it has to end with ";" and have a unique identifier.
    formulaStart     = customEval.indexOf(string) + string.length;
    formulaEnd         = customEval.indexOf(";", formulaStart);
    formula         = customEval.substring(formulaStart, formulaEnd);
    return formula;
Last edited:

Latest Threads

Latest Profile Posts

New sprites in my project!
Updating my stream thumbnail collection here Streaming more game dev in 30 minutes or so. :LZSexcite:

Programming languages are amazing.

Someone needed help with a problem in C#. I've got 0 experience in C#. I read 0 lines of their code. I only knew what they wanted to do. I wrote a completely generic code in Javascript containing the generic answer. But they understood what I was doing and translated that to their code. 20 seconds later, problem solved.
been using ChatGPT to write a new story. I told it to :
generate a word like gundam for a false prophet super AI

it answered :
"NOVUS" as an acronym for "New Omnipotent Virtual Unit for Synthetics"? sounds similar to "gnosis," which is a term associated with knowledge and spiritual enlightenment, fitting the theme of a false prophet.

Five traps done, more on the way!
Stay tuned!

Forum statistics

Latest member