Simulation scripts are embedded scripts that are only executed while a simulation is running. There two types of simulation scripts:
[Simulation script types]
The main script: by default, each scene has a main script that handles all the functionality (that is is charge of calling child scripts (see hereafter)). Without main script, a simulation cannot run. The main script can be customized, but it is preferable to do all the customization work in a child script.
Child scripts: each scene object can be associated with a child script that will handle a specific part of a simulation. One particularity of them is that they can also run threaded (which is not the case with any other script types). The most common use for child scripts is to have them control a model (e.g. a robot).
Since child scripts are attached to scene objects (i.e. they are associated scripts), they will also be duplicated during a copy-and-paste operation, which is an important feature that allows a simulation scene to be easily scalable. Associated scripts form the basis of CoppeliaSim's distributed control architecture.
The main script
Accessing objects programmatically