| Chapter 17: Activities |

| 17.6. Beginning and ending activities manually

If we have declared a new activity, like "analysing", the normal way to make it happen would be to write

> carry out the analysing activity with the pitchblende;

which goes through the whole machinery of rules - before, for, after - and then resumes, the activity having started, taken place and come to an end.

But there are times when it is not convenient to write a suitable "for ..." rule, or where we need more control, and do not wish to hand the whole business over to a single phrase. For such times we are allowed to write:

> begin the analysing activity with the pitchblende;
> ...
> end the analysing activity with the pitchblende;

This time the activity is ongoing throughout as many phrases as we care to write between the "begin" and "end". The before rules are considered at the time of the "begin ..." phrase; the after rules at the "end ...". What, then, of the "for" rules? In the above setup, they would simply be ignored. But we can make them effectual like so:

> begin the analysing activity with the pitchblende;
> ...
> if handling the analysing activity with the pitchblende begin;
> ...
> end if;
> ...
> end the analysing activity with the pitchblende;

The "for" rules are invoked when the "handling ..." test is carried out: the condition is true only if no rule has intervened. Thus we should place the activity's normal behaviour inside the "if".

We need to follow three golden rules: all activities must end, they must never last longer than a turn, and if activity B starts during activity A then it must also finish during activity A. We must also be careful to make sure that if an activity applies to something, then it begins and ends with the same something (the pitchblende, in the above example).

Previous | Contents | Next