Identifying the current rule

I’m working on a testing framework for Kerkerkruip, and I’m having trouble coming up with a system that can handle all of the things I need to test.

I had an idea that I could write a rulebook that runs all the tests that are needed, but any tests that can’t be run yet should be “deferred.” These rules would be added to a table of rules to run again after the game state changes.

So, is there an easier way to do this? If not, is there some way I can package the deferral into a phrase? The part I can’t figure out is how to pass the current rule as a value. Is there a global variable that holds the current rule or the last rule to return a result? Is there some neat way to do it or do I have to do the ugly addressing that Dannii uses in Simple Unit Tests?

I’d really appreciate some help! Thanks!

I’m sure there is a way, although it probably involves I6. Try looking at the unsuccessful attempt rulebook and how it sets the “reason the action failed”.

Yah, I already looked in the Standard Rules for that, but all the real work is done in I6, it seems.

There is no nice way to get the current rule. The “reason the action failed” is set through some manual code in accessibility and requirements rules. (Plus… the return value of ProcessRulebook()? I’m not sure if that’s always a rule value.)

You could do this with a table of rules (or functions), rather than a rulebook. If you iterate through the table manually, you’ve got the entries right there, you don’t have to scrounge for them.

Yeah, that’s what Dannii does. But I think I’ve come up with some alternatives so I don’t have to deal with this situation.