I have this code that works if I define a rulebook. But I would like to be able to access the rule.
r1 is a room. r2 is west of r1. r3 is south of r2. r4 is east of r3. r1 is north of r4.
the cluelength rules are a rulebook producing a number.
a cluelength rule (this is the jake-g-length rule):
if the player is in r1, rule succeeds with result 37;
if the player is in r2, rule succeeds with result 23;
if the player is in r3, rule succeeds with result 49;
every turn: [the commented code doesn't work. What am I doing wrong?]
[follow the jake-g-length rule;
let X be the number produced by the rulebook;
let Y be the number produced by the jake-g-length rule;]
let Y be the number produced by the cluelength rules;
say "[Y].";
The numeric details of the code aren’t important, but I want to be able to use a rule to find a number, instead of a rulebook. Is this possible or desirable? If so, how?
I’ve had success using “the outcome produced by the rulebook” when I’ve defined outcomes, but I’m having trouble with numbers.
Code that works for outcomes
the goodrhyme rules are a rulebook. the goodrhyme rules have outcomes unavailable, not-yet, already-done and ready.
a goodrhyme rule (this is the vc-big-bag rule) :
if player has big bag:
vcal "You already made the big bag.";
already-done;
ready;
every turn:
consider the vc-big-bag rule;
let X be the outcome of the rulebook;
if X is the ready outcome, say "You can make the big bag now.";
I’m using 6g60. Thanks!