Scheduling Events for a Specific Time

Events can be scheduled for a specific time for any object using the method schedule in the class Object:

# call a method after the simulation clock hits 100.0...

self schedule method-call "sing-and-dance" at-time 100.0.

It is often desirable to trigger a method call not for a specific simulation time, but for an offset relative to the current time (for example, "20 seconds from now"). This can be done with the help of the get-time method in the class Control:

# call a method 100.0 seconds from now...

self schedule method-call "sing-and-dance" at-time ((controller get-time) + 100.0).