I’ve got a question about rulebooks.
Say I make a rulebook called The alphabet rules, containing books A B C D E F.
Now if I wanna run through all the rules, I can say ‘follow the alphabet rules.’
So I’ve gone through A, and I’m in B, and something happens that makes me want to skip directly to E now. IE: I want to halt execution of B, skip C and D and go directly to the start of E, continuing on through F. Is that possible?
My punt atm is if I just said (during B) ‘follow the E rule’, I’ll just follow E and then either stop (depending on its outcome), or I’ll return to the line after ‘follow the E rule’ and keep going through all the alphabet rules, including E again.
I know I can skip to the next rule in a book by saying ‘continue the action’, but how about if I want to skip 2 rules?
I assume you mean a solution other than setting a flag in rule B and checking it at the start of C and D.
Yeah, that’s right. Really just a GOTO E.
I’ve got this huge process that’s more manageable and convenient as a series of named rules in a rulebook, but sometimes depending on what happens, I want to skip parts on the way through.
Could it work better as an activity or an action?
Otherwise you’ll have to check a flag.
I was thinking of breaking it up into standalone rules or actions. An activity doesn’t suit what’s going on.
Looks like I’ll go with a flag. Thanks.
Rulebooks can have return values. Just have rulebook B return a value, and the alphabet rulebook check it.
Maybe rules A-D belong in a separate rulebook from E-F?
Something like this:
The alphabet rules are a rulebook.
Beginning the alphabet is an activity.
The alphabet cleanup rules are a rulebook.
Before beginning the alphabet (this is rule A):
For beginning the alphabet (this is rule B):
For beginning the alphabet (this is rule C):
An alphabet cleanup rule (this is rule E):
An alphabet cleanup rule (this is rule F):
An alphabet rule: carry out the beginning the alphabet activity.
An alphabet rule: follow the alphabet cleanup rulebook.[/code]
Or more simply, as Dannii said, maybe the whole thing could be an activity. In which case, rules E and F would be “after alphabet” rules.
I had a hell of a time with the logic in the “for getting attention” rulebook in Speech Motivations. You could look at that and see if it’s similar to your situation.
Note that I commented out some of the rules there - it was a thorny problem!
Also note that “deny motivation” doesn’t actually do anything - it’s just a semantic device clarifying that activity processing ends there.