| Home | A simple start. |
|
|
|
Introduction
When starting Racer, the script in data/scripts/onyx/main.oxs is automatically loaded (since Racer v0.9.0RC8). This file can contain a number of callbacks that are called when an event happens inside Racer. You can compare it to the .rex files in data/scripts, which get called when the same events happen. However, in Onyx a lot of extra functionality is available, so these scripts can become way more complex if you want to.
An example main.oxs script is shown below, which contains all available callbacks:
//
// Onyx main script
// Shows all callbacks
//
#include "racer.oxs"
void OnCar(handle h)
{
echo("A car arrived");
}
void OnRace()
{
echo("The race started");
}
void OnLap()
{
echo("Lap crossed");
}
void OnSoftReset()
{
echo("Soft reset (Shift-F)");
}
void OnPostReset()
{
echo("Post reset");
}
void OnSpeedLimiter(int n)
{
if(n==0)echo("Speedlimiter off");
else echo("Speedlimiter on");
}
void OnAllFinished()
{
echo("All cars have finished");
}
void OnRestart()
{
echo("Restart");
}
(last updated July 24, 2013 )