Play Method

See Also Applies To Example Model

Starts a simulation.

object expression.Play

object expression    Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The Play method is run when the observer clicks on the Play button on the VisualBots control. The Play method performs the following sequence:

1) If at the start of the simulation:

         Execute the Reset method.

         Trigger the OnSimBegin event - execute observer's code.

         Execute the Update method.

2) Until the simulation enters pause mode or is instructed to end:

         Increment the time step.

         Trigger the OnSimStep event - execute observer's code.

         Execute the Update method.

3) If simulation enters pause mode, exit Play method.

4) When the simulation is instructed to end:

         Trigger the OnSimEnd event - execute observer's code.

         Execute the Update method.

         Exit Play method.

A simulation will continue until HaltTime has been executed or an observer action occurs that causes an exit from play mode, such as clicking on the Stop or Pause buttons of the VisualBots control.

To exit pause mode, call the Play method again, or call the Advance or Halt methods.

Example

The following example runs a simulation through 20000 time steps.

World.Sim.HaltTime=20000
World.Sim.Play