Missing values
Why a rule silently never fires. Null loses every comparison, including <.
The most common way a correct-looking rule does nothing, forever, with no error.
A stat is 0. A field is null.
$.stat('nonsense') // 0
$.field('nonsense') // null
null loses every comparison
null < 5 // false
null > 5 // false
null == 0 // false
So someone without an infection field does not match infection < 5.
Usually that's right: it stops a cure rule firing on every healthy person in the world. But if you meant "everyone below 5, including people who've never been infected", your rule matches nobody.
Why you get no error
- A missing path reads as
undefined. - A condition treats
undefinedas "closed". - An expression that throws gives nothing, and the engine uses its default.
Three separate mechanisms, all silent. Editor completion only offers paths that exist, so if you typed a path by hand and completion didn't offer it, that's probably your bug.
Fixes
Count "doesn't have it" as passing:
!$.hasField('infection') || $.field('infection') < 5
Treat missing as zero:
($.field('infection') || 0) + 1
Check the plugin that owns it is installed:
$.hasPlugin('hunger') && $.field('satiety') < 20
Why missing isn't just 0
Because 0 means something. Satiety 0 is starving. Satiety null is this game has no
hunger. If missing read as zero, every character in a game without hunger would be starving.