Include (-
[ CheckDPMR result sinp1 sinp2 rv adjustment return_value;
adjustment = 0;
if ((noun) && noun hasnt (+ familiar +) ) adjustment = adjustment - 1;
if ((second) && second hasnt (+ familiar +) ) adjustment = adjustment - 1;
sinp1 = inp1; sinp2 = inp2; inp1 = noun; inp2 = second;
rv = FollowRulebook( (+does the player mean rules+) );
inp1 = sinp1; inp2 = sinp2;
if ((rv) && RulebookSucceeded()) {
result = ResultOfRule();
if (result == (+ it is very likely outcome +) ) return_value = 4;
if (result == (+ it is likely outcome +) ) return_value = 3;
if (result == (+ it is possible outcome +) ) return_value = 2;
if (result == (+ it is unlikely outcome +) ) return_value = 1;
if (result == (+ it is very unlikely outcome +) ) return_value = 0;
return_value = return_value + adjustment;
if (return_value < 0) return_value = 0;
return return_value;
}
return 2;
];
-).
When, however, I type something with a missing second noun, I get:
[** Programming error: tried to test “has” or “hasnt” of <illegal object
number 1> **]
I’m not sure how to test for this. I thought testing for the presence of second would solve the problem. I’m assuming that I6 has shortcircuiting logic?
You’re testing exactly right—Inform stores 0 (“nothing”) in the noun and second noun variables if there’s nothing supplied—but it looks like it’s also using 1 as a special value, which is also not a valid object in Glulx.
I’m unfortunately not sure what setting noun or second to 1 means. inp1 and inp2 can be set to 1 to mean “there’s a value that’s not an object here” (e.g. a number), but noun and second should always be objects or 0, shouldn’t they?
hmm… it seems it only happens with actions applying to one number and one thing, and the command is like “type 4” without specifying the indirect object.