

Null coalescing operator, for handling missing variables or stale actor referencesĪ reference to a geometry named in the entity definitionĪ reference to a material named in the entity definitionĪ reference to a texture named in the entity definition Parentheses for expression term evaluation control We are hoping people will experiment with them and give us feedback, so we can move them into general usage. Some operators are under Experimental Molang Features at the moment in the list below. Complex expressions evaluate to 0.0 unless there is a return statement, in which case the evaluated value of the return's sub-expression will be returned out of the current scope. In complex cases, multiple sub-expressions are each terminated with a semicolon. In simple cases, the terminating is omitted and the expression result is returned.
MATHMOD USER GUIDE CODE
An expression can be made of either one simple value or math calculation, or can be made of several sub-expressions where more complicated code is required. The language structure is largely based on simple 'C' language family style syntax. Now they evaluate as A ? B : (C ? D : E).įixed error where dividing by a dynamically determined negative variable resulted in a division by the absolute (positive) value of the number instead. Previously nested conditional expressions like A ? B : C ? D : E would evaluate as (A ? B : C) ? D : E. For example "'text' + 1" will now cause a content error.įixed conditional (ternary) operator associativity. Also fixed normalization logic in that query to go from 1 down to 0 instead of 0 up to 1.Īdded some new error messages for invalid expressions which previously ran with probably unexpected results.


(Not actually a Versioned Change)įixed em_remaining_use_duration conversion from ticks to seconds (multiplied by 20 instead of dividing). Initial support for Versioned Changes added. Versioned Change Versions Pack min_engine_version Any Versioned Change with a version less than or equal to that version number will be in effect. To know which Versioned Changes are in effect, look at the "min_engine_version" of the manifest.json of the resource or behavior pack that contains your Molang expression. This is a list of the Versioned Changes that have been added, along with the corresponding game version. Molang Versioned Change versions apply to each expression separately, so it's possible to have different versions active if multiple packs are loaded. This allows for changes to how Molang works without breaking existing content. Molang uses the "min_engine_version" from the manifest.json of the resource or behavior pack that contains each Molang expression to determine which version of the rules to apply. Its focus is to enable low-level systems like animation to support flexible data-driven behavior for both internal and external creators, while staying highly performant. Molang is a simple expression-based language designed for fast, data-driven calculation of values at run-time, and with a direct connection to in-game values and systems.
