## A delayed message sender

The LaterActor stores a message destined for another actor, along with a delay time. It sends the message after the specified amount of time has elapsed.

A single LaterActor can hold multiple messages, so you never need to create more than one LaterActor.

To use the LaterActor, load later.so and create an actor of type LaterActor.

### LaterActor messages

In addition to the messages understood by all actors, the LaterActor understands the following message:

AddMessage `hActor delay msg`
  Store the message `msg` (everything between `delay` and the semicolon, in a .aud file) to be sent `delay` seconds from the receipt of this message.

### Examples

`LoadDSO later.so;
later = Create LaterActor;
`

Sending a parameter-update message for a sound:
make "tweet" silent, 2 seconds from now.

  `tweet = BeginSound myActor;
  ...
  AddMessage later 2 SetAmp tweet 0;`

Calling another message group (faking an `AUDupdate()`):
5 seconds from now, invoke message group `foo` with no parameters;
5 seconds after that, invoke `bar` with an array of floats.

  `foo = Create MessageGroup;
  bar = Create MessageGroup;
  ...
  AddMessage later 10 SendData bar [ 3.1416 2.71828 42.000 ];
  AddMessage later 5 SendData foo [0]; // The 0 is ignored, but necessary.
  `

  It doesn't matter that those two AddMessage lines are "out of order". The LaterActor will sort it out and do the right thing at the right time.

Sending a delayed message from within a message group:
when AUDupdate("zip") happens, 2 seconds later make "tweet" silent.

  `zip = Create MessageGroup;
  tweet = BeginSound myActor;
  ...
  AddMessage zip AddMessage later 2 SetAmp tweet 0;`

  Read this as: To the message group "zip", add the following message: "AddMessage later 2 SetAmp tweet 0". (That message happens to contain another "AddMessage" command, but no big deal, I learned what `char **` meant in my introductory C programming class years ago.) The added message then means, as usual, "set the amplitude of tweet to zero, 2 seconds from now."

Sending a delayed message from within a message group, fancier:
when AUDupdate("zip") happens, use its first argument as the new amplitude of tweet and the second argument for how long to wait before changing the amplitude.

  `zip = Create MessageGroup;
  tweet = BeginSound myActor;
  ...
  AddMessage zip AddMessage later *1 SetAmp tweet *0;`

  Exactly the same as the previous example, except the constants have become variables.