Skip to main content

Global events

Global events are special “event” functions that will be automatically called by SCS at various times when the program starts. These are like “hooks” to things that are happening in the game, some examples include:

  • onStart() , which is called when the program starts running
  • onSensorEnter(), which is called when an object enters the sensor on the Entity running the program.
  • etc.

Global events should be declared in the same way as declaring a regular function.

function onStart()     <-- Declaration of global event onStart()
print('Hello world!')

This function will print the text string ‘Hello world!’ to the log console when the program starts.

Refer to the Global events reference for more details on the global event functions available in SCS.