adapap / OWScript

Python-like scripting language which transpiles into Overwatch Workshop script rulesets.
MIT License
37 stars 2 forks source link

Constants and function parameters on rule names use the variable name and not it's value #25

Closed netux closed 5 years ago

netux commented 5 years ago

When using a constant or a function parameter on the name of a rule, if the variable is not preceded by another string, the part of the name where the variable is used evaluates to the variable name, instead of its value

Example

const variable_name = "Variable value"

Rule variable_name
    Event
        On Global

%test_function(param_name)
    Rule param_name
        Event
            On Global

test_function("Parameter value")

becomes

rule("variable_name") {
    Event {
        Ongoing - Global;
    }
}
rule("param_name") {
    Event {
        Ongoing - Global;
    }
}

For some reason, only the first variable is evaluated this way, variables concatenated after the first one evaluate to its value instead.

Example

const variable_name = "Variable value"
const text_str = "text"

Rule variable_name + " and some more " + text_str
    Event
        On Global

becomes

rule("variable_name and some more text") {
    Event {
        Ongoing - Global;
    }
}