Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | const l10n = require("../helpers/l10n").default; const id = "EVENT_VARIABLE_MATH_EVALUATE"; const groups = ["EVENT_GROUP_MATH", "EVENT_GROUP_VARIABLES"]; const subGroups = { EVENT_GROUP_MATH: "EVENT_GROUP_VARIABLES", EVENT_GROUP_VARIABLES: "EVENT_GROUP_MATH", }; const autoLabel = (fetchArg, args) => { if (args.expression) { return l10n("EVENT_VARIABLE_MATH_EVALUATE_LABEL", { variable: fetchArg("variable"), expression: fetchArg("expression"), }); } else { return l10n("EVENT_VARIABLE_MATH_EVALUATE"); } }; const fields = [ { key: "variable", label: l10n("FIELD_VARIABLE"), description: l10n("FIELD_VARIABLE_DESC"), type: "variable", defaultValue: "LAST_VARIABLE", width: "50%", }, { key: "expression", label: l10n("FIELD_EXPRESSION"), description: l10n("FIELD_EXPRESSION_DESC"), type: "matharea", rows: 5, placeholder: "e.g. 5 + (6 * $health)...", defaultValue: "", }, ]; const compile = (input, helpers) => { const { variableEvaluateExpression } = helpers; variableEvaluateExpression(input.variable, input.expression || "0"); }; module.exports = { id, description: l10n("EVENT_VARIABLE_MATH_EVALUATE_DESC"), references: ["/docs/scripting/math-expressions"], autoLabel, groups, subGroups, fields, compile, }; |