RigsofRods
Soft-body Physics Simulation
Public Member Functions | Data Fields | Private Member Functions | Private Attributes
Script2Script::racesManager Class Reference

This class allows you to organize races. More...

#include <races.as.h>

+ Collaboration diagram for Script2Script::racesManager:

Public Member Functions

 racesManager ()
 The constructor This initializes everything. More...
 
int addRace (string raceName, double[][] checkpoints, int laps, string objName_checkpoint, string objName_start, string objName_finish)
 Adds a race to the terrain. More...
 
int addRace (string raceName, double[][] checkpoints, int laps, string objName_checkpoint, string objName_start_finish)
 Add a race to the terrain. More...
 
int addRace (string raceName, double[][] checkpoints, int laps, string objName_checkpoint)
 Add a race to the terrain. More...
 
int addRace (string raceName, double[][] checkpoints, int laps)
 Add a race to the terrain, using the default checkpoint objects. More...
 
int addRace (string raceName, double[][] checkpoints)
 Add a not-looping race to the terrain, using the default checkpoint objects. More...
 
int addNewEmptyRace ()
 Add a new empty race (advanced users only!) More...
 
int getNewRaceID ()
 Creates a new free race ID. More...
 
void setCallback (string event, RACE_EVENT_CALLBACK @func)
 Adds a callback funciton. More...
 
RACE_EVENT_CALLBACK getCallback (string event)
 Gets a callback funciton. More...
 
void removeCallback (string event)
 Remove a callback function. More...
 
void startRace (int raceID)
 Starts a race. More...
 
void advanceCheckpoint (int raceID)
 Advances a checkpoint. More...
 
void setBestLapTime (int raceID, double time)
 Sets a best lap time. More...
 
void setBestRaceTime (int raceID, double time)
 Sets a best race time. More...
 
void eventCallback (int eventnum, int value)
 This should be called from within your RoR eventCallback function. More...
 
void unlockRace (int raceID)
 Unlocks a race. More...
 
void lockRace (int raceID)
 Locks a race. More...
 
void deleteRace (int raceID)
 Deletes a race. More...
 
int getRaceIDbyName (string raceName_in)
 Returns the race ID of a race name. More...
 
void cancelCurrentRace ()
 Aborts the current race. More...
 
bool raceCompleted (int raceID)
 Is a certain race completed? More...
 
int getCurrentRaceID ()
 Gets the ID of the current race. More...
 
double getBestLapTime (int raceID)
 Gets the best lap time of a certain race. More...
 
double getBestRaceTime (int raceID)
 Gets the best race time of a certain race. More...
 
bool addPenaltySeconds (int seconds)
 Add an amount of penalty time to the current race. More...
 
void setLaps (int raceID, int laps)
 Sets the amount of laps for a race. More...
 
void setRaceName (int raceID, string raceName)
 Sets the name for a race. More...
 
int getLaps (int raceID)
 Gets the amount of laps for a race. More...
 
raceBuilder getRace (int raceID)
 Gets the raceBuilder object of a race. More...
 
void addCheckpoint (int raceID, int number, string objName, double[] coords)
 Adds a checkpoint to a race. More...
 
void addCheckpointList (int raceID, uint startNumber, string objName, double[][] coords)
 Adds a list of checkpoints to a race. More...
 
void deleteCheckPoint (int raceID, int number, int instance)
 This deletes a checkpoint from a race. More...
 
void addCancelPoint (int raceID, string objName, double[] v, RACE_EVENT_CALLBACK @callback)
 This allows you to add an object with event boxes that will cause the race to be aborted. More...
 
void recalcArrow ()
 Recalculates where the arrow should point to. More...
 
void setupArrow (int position)
 Make the directional arrow point to a certain checkpoint of the current race. More...
 
void removeArrow ()
 This hides the directional arrow. More...
 
void setPenaltyTime (int raceID, int seconds)
 This sets the penalty time of a race. More...
 
int getPenaltyTime (int raceID)
 This returns the penalty time setting of a race. More...
 
void setVersion (int raceID, string version)
 This sets the version of your race. More...
 
void hideRace (int raceID)
 This hides your race. More...
 
void unhideRace (int raceID)
 This shows your race again, after it was hidden. More...
 
void setStartNumber (int raceID, int startNum)
 This allows you to change the startNumber of a race. More...
 
void resetEventCallback ()
 Resets the race event callback. More...
 
void finalize (int raceID)
 Finalizes your (advanced) race. More...
 
void saveRaces ()
 Saves all races. More...
 
void saveRace (int raceID)
 Saves a race. More...
 
void loadRace (int raceID)
 Loads a race. More...
 

Data Fields

int raceCount
 the raceID+1 of the last race. More...
 
int currentRace
 the ID of the current race. (-1 is there's no race running at the moment) More...
 
int currentLap
 the number of the current lap. (starts from 0) More...
 
int truckNum
 The number of the (last) used truck in the race. More...
 
int lastCheckpoint
 The number of the last passed checkpoint. More...
 
bool obligatedFinish
 if true: if you drive through the start checkpoint of another race, while racing, it will be ignored. (default=false) More...
 
bool showTimeDiff
 if true: Show + or - [best time minus current time] when passing a checkpoint. (default=true) More...
 
bool showBestLap
 if true: If a race is started or a new best lap is set, the best lap will be shown. (default=true) More...
 
bool showBestRace
 if true: If a race is started or a new best race is set, the best race will be shown. (default=true) More...
 
bool submitScore
 if true: If the user has a new best lap or new best race, this is submitted to the master server. (default=true) More...
 
bool showCheckPointInfoWhenNotInRace
 if true: if the user drives through a checkpoint of a race that isn't running, a message will be shown, saying "this is checkpoint xx of race myRaceName". (default=false) More...
 
bool silentMode
 if true: No flashmessages will be shown. (default=false) More...
 
bool allowVehicleChanging
 if false: if the user changes vehicle, the race will be aborted. (default=false) More...
 
bool abortOnVehicleExit
 if true: if the user exits his vehicle, the race will be aborted. (default=false) More...
 
int arrowMethod
 What checkpoint instance should the directional arrow point to. (default=ARROW_AUTO=point to the same instance as last checkpoint) More...
 
bool penaltyGiven
 
int actionOnTruckExit
 
int state
 In which state are we? More...
 
int cancelPointCount
 
double raceStartTime
 
double lapStartTime
 
string lastCheckpointInstance
 
string lastRaceEventInstance
 
double lastRaceEventTime
 
string raceManagerVersion
 the version of the raceManager More...
 
int LAPS_Unlimited
 Keep looping the race for an unlimited time. More...
 
int LAPS_NoLaps
 This race has a seperate start line and finish line. More...
 
int LAPS_One
 This race consist of 1 lap, and the start and finish line are the same object. More...
 
int ACTION_DoNothing
 Not used. More...
 
int ACTION_SuspendRace
 Not used. More...
 
int ACTION_StopRace
 Not used. More...
 
int ACTION_RestartRace
 Not used. More...
 
int STATE_NotInRace
 We're not racing at the moment. More...
 
int STATE_Waiting
 A race is suspended, and we're waiting until the race continues. More...
 
int STATE_Racing
 We're in the middle of a race :D. More...
 
int ARROW_AUTO
 This arrow method will always point to the checkpoint instance that comes closest to the previous one. More...
 

Private Member Functions

void raceEvent (int trigger_type, string inst, string box, int nodeid)
 This will get called when a truck is at a checkpoint You shouldn't call this manually (use the "Checkpoint" callback instead) More...
 
string formatTime (double seconds)
 Formats the time. More...
 
void finishCurrentRace ()
 Finishes a race. More...
 
void advanceLap ()
 Advances a lap. More...
 
void addLapTime (int raceID, double time, bool &out newBestLap)
 
void addRaceTime (int raceID, double time, bool &out newBestRace)
 
void raceCancelPointHandler (int trigger_type, string inst, string box, int nodeid)
 event handler for cancel points More...
 

Private Attributes

private raceBuilder[] raceList
 
dictionary callbacks
 

Detailed Description

This class allows you to organize races.

This class will handle all the race logic for you.

Attention
To use this class, you'll need to add the following code to your scripting file:
#include "races.as"
raceManager races()

Definition at line 55 of file races.as.h.

Constructor & Destructor Documentation

◆ racesManager()

Script2Script::racesManager::racesManager ( )

The constructor This initializes everything.

Member Function Documentation

◆ addCancelPoint()

void Script2Script::racesManager::addCancelPoint ( int  raceID,
string  objName,
double[]  v,
RACE_EVENT_CALLBACK callback 
)

This allows you to add an object with event boxes that will cause the race to be aborted.

Parameters
raceIDthe ID of the race
objNameThe name of the object (~the name of the odef file, but without the .odef extension)
vThe position where the cancel point should be
callbackA callback function that will be called when the race is canceled because of this cancel point.
See also
RACE_EVENT_CALLBACK

◆ addCheckpoint()

void Script2Script::racesManager::addCheckpoint ( int  raceID,
int  number,
string  objName,
double[]  coords 
)

Adds a checkpoint to a race.

This allows you to have duplicate checkpoints (useful to create shortcuts or splitted tracks).

Parameters
raceIDthe ID of the race
numberThe number of the checkpoint in the race. 0 is the start line 1 would be the first checkpoint 2 is the second checkpoint etc. You can have multiple checkpoints for the same number. The user will then be able to choose which checkpoint he takes.
objNamethe name of the object that should be used for the checkpoint
coordsthe coordinate for the race (6 numbers!
See also
addRace)
addCheckpointList

◆ addCheckpointList()

void Script2Script::racesManager::addCheckpointList ( int  raceID,
uint  startNumber,
string  objName,
double  coords[][] 
)

Adds a list of checkpoints to a race.

This allows you to have duplicate checkpoints (useful to create shortcuts or splitted tracks).

Parameters
raceIDthe ID of the race
startNumberThe number of the first checkpoint that should be added The first checkpoint in the coords list, will be added as number startNumber. The second checkpoint in the coords list, will be added as startNumber+1 etc. You can have multiple checkpoints for the same number. The user will then be able to choose which checkpoint he takes.
objNamethe name of the object that should be used for the checkpoint
coordsa list of coordinates for the race (6 numbers per coordinate
See also
addRace)

◆ addLapTime()

void Script2Script::racesManager::addLapTime ( int  raceID,
double  time,
bool &out  newBestLap 
)
private

◆ addNewEmptyRace()

int Script2Script::racesManager::addNewEmptyRace ( )

Add a new empty race (advanced users only!)

Returns
The unique ID of the race.
// example
double[][] checkpoints = {
{5980.50, 0, 5999.89, 0, 90, 0}, // this is checkpoint 0 (this is the start line)
{5959.52, 0, 6000.18, 0, 90, 0}, // this is checkpoint 1
{5912.66, 0, 6000.06, 0, 90, 0}, // this is checkpoint 2
{5871.04, 0, 6008.94, 0, 90, 0}, // this is checkpoint 3
{5826.71, 0, 6009.09, 0, 90, 0}, // this is checkpoint 4
{5759.27, 0, 6000.11, 0, 90, 0}, // this is checkpoint 5
{5700.36, 0, 6009.43, 0, 90, 0}, // this is checkpoint 6
{5664.99, 0, 6023.90, 0, 90, 0}, // this is checkpoint 7
{5620.49, 0, 6008.88, 0, 90, 0}, // this is checkpoint 8
{5586.43, 0, 5999.97, 0, 90, 0}, // this is checkpoint 9
{5539.42, 0, 5999.96, 0, 90, 0} // this is checkpoint 10 (this is the finish line)
}
int myRaceID = races.addNewEmptyRace();
races.setRaceName(myRaceID, "my advanced race");
races.setLaps(myRaceID, races.LAPS_NoLaps);
races.addCheckpointList(myRaceID, 0, "chp-checkpoint", checkpoints);
races.setVersion(myRaceID, "author-v1.0");
races.finalize();

◆ addPenaltySeconds()

bool Script2Script::racesManager::addPenaltySeconds ( int  seconds)

Add an amount of penalty time to the current race.

Parameters
secondsthe amount of seconds to add to the time
Returns
true on success

◆ addRace() [1/5]

int Script2Script::racesManager::addRace ( string  raceName,
double  checkpoints[][] 
)

Add a not-looping race to the terrain, using the default checkpoint objects.

Parameters
raceNameThe name of the race. This needs to be unique for your terrain, and shouldn't contain points.
checkpointsAn array of coordinates ( a coordinate exists out of 6 numbers: { position.x, position.y, position.z, rotation.x, rotation.y, rotation.z }
Returns
The unique ID of the race.

◆ addRace() [2/5]

int Script2Script::racesManager::addRace ( string  raceName,
double  checkpoints[][],
int  laps 
)

Add a race to the terrain, using the default checkpoint objects.

Parameters
raceNameThe name of the race. This needs to be unique for your terrain, and shouldn't contain points.
checkpointsAn array of coordinates ( a coordinate exists out of 6 numbers: { position.x, position.y, position.z, rotation.x, rotation.y, rotation.z }
lapsThe amount of laps. This can be one of the following: LAPS_Unlimited, LAPS_NoLaps, LAPS_One or another number representing the amount of laps (>=1)
Returns
The unique ID of the race.

◆ addRace() [3/5]

int Script2Script::racesManager::addRace ( string  raceName,
double  checkpoints[][],
int  laps,
string  objName_checkpoint 
)

Add a race to the terrain.

Parameters
raceNameThe name of the race. This needs to be unique for your terrain, and shouldn't contain points.
checkpointsAn array of coordinates ( a coordinate exists out of 6 numbers: { position.x, position.y, position.z, rotation.x, rotation.y, rotation.z }
lapsThe amount of laps. This can be one of the following: LAPS_Unlimited, LAPS_NoLaps, LAPS_One or another number representing the amount of laps (>=1)
objName_checkpointThe name of the object that should be used as checkpoint, start line and finish line
Returns
The unique ID of the race.

◆ addRace() [4/5]

int Script2Script::racesManager::addRace ( string  raceName,
double  checkpoints[][],
int  laps,
string  objName_checkpoint,
string  objName_start,
string  objName_finish 
)

Adds a race to the terrain.

Parameters
raceNameThe name of the race. This needs to be unique for your terrain, and shouldn't contain points.
checkpointsAn array of coordinates ( a coordinate exists out of 6 numbers: { position.x, position.y, position.z, rotation.x, rotation.y, rotation.z }
lapsThe amount of laps. This can be one of the following: LAPS_Unlimited, LAPS_NoLaps, LAPS_One or another number representing the amount of laps (>=1)
objName_checkpointThe name of the object that should be used as checkpoint
objName_startThe name of the object that should be used as start line
objName_finishThe name of the object that should be used as finish
Returns
The unique ID of the race.
// example
double[][] checkpoints = {
{5980.50, 0, 5999.89, 0, 90, 0}, // this is checkpoint 0 (this is the start line)
{5959.52, 0, 6000.18, 0, 90, 0}, // this is checkpoint 1
{5912.66, 0, 6000.06, 0, 90, 0}, // this is checkpoint 2
{5871.04, 0, 6008.94, 0, 90, 0}, // this is checkpoint 3
{5826.71, 0, 6009.09, 0, 90, 0}, // this is checkpoint 4
{5759.27, 0, 6000.11, 0, 90, 0}, // this is checkpoint 5
{5700.36, 0, 6009.43, 0, 90, 0}, // this is checkpoint 6
{5664.99, 0, 6023.90, 0, 90, 0}, // this is checkpoint 7
{5620.49, 0, 6008.88, 0, 90, 0}, // this is checkpoint 8
{5586.43, 0, 5999.97, 0, 90, 0}, // this is checkpoint 9
{5539.42, 0, 5999.96, 0, 90, 0} // this is checkpoint 10 (this is the finish line)
}
int myRaceID = races.addRace("Example Race", checkpoints, races.LAPS_NoLaps, "chp-checkpoint", "chp-start", "chp-start");

◆ addRace() [5/5]

int Script2Script::racesManager::addRace ( string  raceName,
double  checkpoints[][],
int  laps,
string  objName_checkpoint,
string  objName_start_finish 
)

Add a race to the terrain.

Parameters
raceNameThe name of the race. This needs to be unique for your terrain, and shouldn't contain points.
checkpointsAn array of coordinates ( a coordinate exists out of 6 numbers: { position.x, position.y, position.z, rotation.x, rotation.y, rotation.z }
lapsThe amount of laps. This can be one of the following: LAPS_Unlimited, LAPS_NoLaps, LAPS_One or another number representing the amount of laps (>=1)
objName_checkpointThe name of the object that should be used as checkpoint
objName_start_finishThe name of the object that should be used as start line and as finish line
Returns
The unique ID of the race.

◆ addRaceTime()

void Script2Script::racesManager::addRaceTime ( int  raceID,
double  time,
bool &out  newBestRace 
)
private

◆ advanceCheckpoint()

void Script2Script::racesManager::advanceCheckpoint ( int  raceID)

Advances a checkpoint.

Parameters
raceIDthe ID of the race

◆ advanceLap()

void Script2Script::racesManager::advanceLap ( )
private

Advances a lap.

◆ cancelCurrentRace()

void Script2Script::racesManager::cancelCurrentRace ( )

Aborts the current race.

◆ deleteCheckPoint()

void Script2Script::racesManager::deleteCheckPoint ( int  raceID,
int  number,
int  instance 
)

This deletes a checkpoint from a race.

Warning
If you delete a checkpoint in the middle of your race, it will become impossible to complete the race. (so make sure you add a new checkpoint if you do that)
Parameters
raceIDthe ID of the race
numberThe number of the checkpoint in the race. 0 is the start line 1 would be the first checkpoint 2 is the second checkpoint etc.
instancewhich instance of this checkpoint should be deleted? (you can have multiple checkpoints with the same number. The first added checkpoint for a certain number will have 0 as instance number, the second added checkpoint for a certain number will have 1 as instance.)

◆ deleteRace()

void Script2Script::racesManager::deleteRace ( int  raceID)

Deletes a race.

Parameters
raceIDthe ID of the race

◆ eventCallback()

void Script2Script::racesManager::eventCallback ( int  eventnum,
int  value 
)

This should be called from within your RoR eventCallback function.

Parameters
eventnumthe number of the event
See also
enum scriptEvents
Parameters
valuethe value of the event

◆ finalize()

void Script2Script::racesManager::finalize ( int  raceID)

Finalizes your (advanced) race.

◆ finishCurrentRace()

void Script2Script::racesManager::finishCurrentRace ( )
private

Finishes a race.

See also
cancelCurrentRace

◆ formatTime()

string Script2Script::racesManager::formatTime ( double  seconds)
private

Formats the time.

Parameters
secondsAn amount of seconds
Returns
The time, formatted as: "X minutes and X seconds"

◆ getBestLapTime()

double Script2Script::racesManager::getBestLapTime ( int  raceID)

Gets the best lap time of a certain race.

Parameters
raceIDthe ID of the race
Returns
the time in seconds

◆ getBestRaceTime()

double Script2Script::racesManager::getBestRaceTime ( int  raceID)

Gets the best race time of a certain race.

Parameters
raceIDthe ID of the race
Returns
the time in seconds

◆ getCallback()

RACE_EVENT_CALLBACK Script2Script::racesManager::getCallback ( string  event)

Gets a callback funciton.

Parameters
eventThe name of the event.
See also
setCallback
Returns
A reference to the function

◆ getCurrentRaceID()

int Script2Script::racesManager::getCurrentRaceID ( )

Gets the ID of the current race.

Returns
the ID of the race

◆ getLaps()

int Script2Script::racesManager::getLaps ( int  raceID)

Gets the amount of laps for a race.

Parameters
raceIDthe ID of the race
Returns
The amount of laps

◆ getNewRaceID()

int Script2Script::racesManager::getNewRaceID ( )

Creates a new free race ID.

Attention
Internal or extremely advanced use only
Warning
This does not only return a new race ID, it may also increment the race count, so only call this function when you're about to add a new race, without using the built in functions to add a race
Returns
The unique ID of the race.

◆ getPenaltyTime()

int Script2Script::racesManager::getPenaltyTime ( int  raceID)

This returns the penalty time setting of a race.

Parameters
raceIDthe ID of the race
Returns
penalty time in seconds

◆ getRace()

raceBuilder Script2Script::racesManager::getRace ( int  raceID)

Gets the raceBuilder object of a race.

Parameters
raceIDthe ID of the race
Returns
a reference to the raceBuilder object for that race
See also
raceBuilder

◆ getRaceIDbyName()

int Script2Script::racesManager::getRaceIDbyName ( string  raceName_in)

Returns the race ID of a race name.

Parameters
raceName_inthe race name
Returns
the ID of the race

◆ hideRace()

void Script2Script::racesManager::hideRace ( int  raceID)

This hides your race.

See also
unhideRace
Parameters
raceIDthe ID of the race

◆ loadRace()

void Script2Script::racesManager::loadRace ( int  raceID)

Loads a race.

Parameters
raceIDthe ID of the race

◆ lockRace()

void Script2Script::racesManager::lockRace ( int  raceID)

Locks a race.

Parameters
raceIDthe ID of the race

◆ raceCancelPointHandler()

void Script2Script::racesManager::raceCancelPointHandler ( int  trigger_type,
string  inst,
string  box,
int  nodeid 
)
private

event handler for cancel points

◆ raceCompleted()

bool Script2Script::racesManager::raceCompleted ( int  raceID)

Is a certain race completed?

Parameters
raceIDthe ID of the race
Returns
true if the race has been completed before, else, false

◆ raceEvent()

void Script2Script::racesManager::raceEvent ( int  trigger_type,
string  inst,
string  box,
int  nodeid 
)
private

This will get called when a truck is at a checkpoint You shouldn't call this manually (use the "Checkpoint" callback instead)

See also
setCallback

◆ recalcArrow()

void Script2Script::racesManager::recalcArrow ( )

Recalculates where the arrow should point to.

Useful if you changed the arrowMethod variable or if you changed the position of the next checkpoint.

◆ removeArrow()

void Script2Script::racesManager::removeArrow ( )

This hides the directional arrow.

◆ removeCallback()

void Script2Script::racesManager::removeCallback ( string  event)

Remove a callback function.

Parameters
eventThe name of the event.
See also
setCallback

◆ resetEventCallback()

void Script2Script::racesManager::resetEventCallback ( )

Resets the race event callback.

If the user drives through a checkpoint, then the script will only handle the event once, event if the user is in the event box for multiple frames. Sometimes, you may want to reset this, and then, you can call this function.

◆ saveRace()

void Script2Script::racesManager::saveRace ( int  raceID)

Saves a race.

Parameters
raceIDthe ID of the race

◆ saveRaces()

void Script2Script::racesManager::saveRaces ( )

Saves all races.

◆ setBestLapTime()

void Script2Script::racesManager::setBestLapTime ( int  raceID,
double  time 
)

Sets a best lap time.

Parameters
raceIDthe ID of the race
timethe lap time

◆ setBestRaceTime()

void Script2Script::racesManager::setBestRaceTime ( int  raceID,
double  time 
)

Sets a best race time.

Parameters
raceIDthe ID of the race
timethe race time

◆ setCallback()

void Script2Script::racesManager::setCallback ( string  event,
RACE_EVENT_CALLBACK func 
)

Adds a callback funciton.

Parameters
eventThe name of the event. This can only be one of the following:
  • RaceFinish -> called when a race was finished (not aborted before finish)
  • RaceCancel -> called when a race was aborted (not when the user finished successfully)
  • RaceStart -> called when a race was started
  • AdvanceLap -> called when the user passes the finishline and still has more laps to do
  • Checkpoint -> called when the user passes a checkpoint that is not the start or finish line
  • NewBestLap -> called when the user sets a personal new best lap time record
  • NewBestRace -> called when the user sets a personal new best race time record
  • LockedRace -> called when the user passes the startline of a locked race
  • RaceEvent -> called when the user passes through a checkpoint (including start of finish lines) (this is called before the processing is done, you can set "break" to false to ignore the event)
  • PenaltyEvent-> called when the user drives through a penalty event box
  • AbortEvent -> called when the user drives through an abort race event box
funcA reference to the function

◆ setLaps()

void Script2Script::racesManager::setLaps ( int  raceID,
int  laps 
)

Sets the amount of laps for a race.

Parameters
raceIDthe ID of the race
lapsThe amount of laps

◆ setPenaltyTime()

void Script2Script::racesManager::setPenaltyTime ( int  raceID,
int  seconds 
)

This sets the penalty time of a race.

Parameters
raceIDthe ID of the race
secondshow much penalty time should be set? (in seconds)

◆ setRaceName()

void Script2Script::racesManager::setRaceName ( int  raceID,
string  raceName 
)

Sets the name for a race.

Parameters
raceIDthe ID of the race
raceNameThe name of the race (needs to be unique, and shouldn't contain points)

◆ setStartNumber()

void Script2Script::racesManager::setStartNumber ( int  raceID,
int  startNum 
)

This allows you to change the startNumber of a race.

By default, the race is started by driving through checkpoint 0, and, in a race with multiple laps, after passing the last checkpoint, the player will have to drive to checkpoint 0 again. You can change this here (useful to make small loops in a bigger race).

Parameters
raceIDthe ID of the race
startNumThe number of the checkpoint that should be used as start point. Normally, the start line is position 0, the first checkpoint is position 1, etc.

◆ setupArrow()

void Script2Script::racesManager::setupArrow ( int  position)

Make the directional arrow point to a certain checkpoint of the current race.

Parameters
positionThe number of the checkpoint to which it should point. The start line is position 0, the first checkpoint is position 1, etc. It always points to a checkpoint of the current race

◆ setVersion()

void Script2Script::racesManager::setVersion ( int  raceID,
string  version 
)

This sets the version of your race.

Parameters
raceIDthe ID of the race
versionThe version of the race in the format 'username-v1.0' in which you replace 'username' by your username and '1.0' by the correct version number.

◆ startRace()

void Script2Script::racesManager::startRace ( int  raceID)

Starts a race.

Parameters
raceIDthe ID of the race

◆ unhideRace()

void Script2Script::racesManager::unhideRace ( int  raceID)

This shows your race again, after it was hidden.

Parameters
raceIDthe ID of the race

◆ unlockRace()

void Script2Script::racesManager::unlockRace ( int  raceID)

Unlocks a race.

Parameters
raceIDthe ID of the race

Field Documentation

◆ abortOnVehicleExit

bool Script2Script::racesManager::abortOnVehicleExit

if true: if the user exits his vehicle, the race will be aborted. (default=false)

Definition at line 72 of file races.as.h.

◆ ACTION_DoNothing

int Script2Script::racesManager::ACTION_DoNothing

Not used.

Definition at line 92 of file races.as.h.

◆ ACTION_RestartRace

int Script2Script::racesManager::ACTION_RestartRace

Not used.

Definition at line 95 of file races.as.h.

◆ ACTION_StopRace

int Script2Script::racesManager::ACTION_StopRace

Not used.

Definition at line 94 of file races.as.h.

◆ ACTION_SuspendRace

int Script2Script::racesManager::ACTION_SuspendRace

Not used.

Definition at line 93 of file races.as.h.

◆ actionOnTruckExit

int Script2Script::racesManager::actionOnTruckExit

Definition at line 76 of file races.as.h.

◆ allowVehicleChanging

bool Script2Script::racesManager::allowVehicleChanging

if false: if the user changes vehicle, the race will be aborted. (default=false)

Definition at line 71 of file races.as.h.

◆ ARROW_AUTO

int Script2Script::racesManager::ARROW_AUTO

This arrow method will always point to the checkpoint instance that comes closest to the previous one.

Definition at line 101 of file races.as.h.

◆ arrowMethod

int Script2Script::racesManager::arrowMethod

What checkpoint instance should the directional arrow point to. (default=ARROW_AUTO=point to the same instance as last checkpoint)

Definition at line 73 of file races.as.h.

◆ callbacks

dictionary Script2Script::racesManager::callbacks
private

Definition at line 105 of file races.as.h.

◆ cancelPointCount

int Script2Script::racesManager::cancelPointCount

Definition at line 78 of file races.as.h.

◆ currentLap

int Script2Script::racesManager::currentLap

the number of the current lap. (starts from 0)

Definition at line 60 of file races.as.h.

◆ currentRace

int Script2Script::racesManager::currentRace

the ID of the current race. (-1 is there's no race running at the moment)

Definition at line 59 of file races.as.h.

◆ LAPS_NoLaps

int Script2Script::racesManager::LAPS_NoLaps

This race has a seperate start line and finish line.

Definition at line 89 of file races.as.h.

◆ LAPS_One

int Script2Script::racesManager::LAPS_One

This race consist of 1 lap, and the start and finish line are the same object.

Definition at line 90 of file races.as.h.

◆ LAPS_Unlimited

int Script2Script::racesManager::LAPS_Unlimited

Keep looping the race for an unlimited time.

Definition at line 88 of file races.as.h.

◆ lapStartTime

double Script2Script::racesManager::lapStartTime

Definition at line 80 of file races.as.h.

◆ lastCheckpoint

int Script2Script::racesManager::lastCheckpoint

The number of the last passed checkpoint.

Definition at line 62 of file races.as.h.

◆ lastCheckpointInstance

string Script2Script::racesManager::lastCheckpointInstance

Definition at line 81 of file races.as.h.

◆ lastRaceEventInstance

string Script2Script::racesManager::lastRaceEventInstance

Definition at line 82 of file races.as.h.

◆ lastRaceEventTime

double Script2Script::racesManager::lastRaceEventTime

Definition at line 83 of file races.as.h.

◆ obligatedFinish

bool Script2Script::racesManager::obligatedFinish

if true: if you drive through the start checkpoint of another race, while racing, it will be ignored. (default=false)

Definition at line 64 of file races.as.h.

◆ penaltyGiven

bool Script2Script::racesManager::penaltyGiven

Definition at line 75 of file races.as.h.

◆ raceCount

int Script2Script::racesManager::raceCount

the raceID+1 of the last race.

Definition at line 58 of file races.as.h.

◆ raceList

private raceBuilder [] Script2Script::racesManager::raceList
private

Definition at line 104 of file races.as.h.

◆ raceManagerVersion

string Script2Script::racesManager::raceManagerVersion

the version of the raceManager

Definition at line 84 of file races.as.h.

◆ raceStartTime

double Script2Script::racesManager::raceStartTime

Definition at line 79 of file races.as.h.

◆ showBestLap

bool Script2Script::racesManager::showBestLap

if true: If a race is started or a new best lap is set, the best lap will be shown. (default=true)

Definition at line 66 of file races.as.h.

◆ showBestRace

bool Script2Script::racesManager::showBestRace

if true: If a race is started or a new best race is set, the best race will be shown. (default=true)

Definition at line 67 of file races.as.h.

◆ showCheckPointInfoWhenNotInRace

bool Script2Script::racesManager::showCheckPointInfoWhenNotInRace

if true: if the user drives through a checkpoint of a race that isn't running, a message will be shown, saying "this is checkpoint xx of race myRaceName". (default=false)

Definition at line 69 of file races.as.h.

◆ showTimeDiff

bool Script2Script::racesManager::showTimeDiff

if true: Show + or - [best time minus current time] when passing a checkpoint. (default=true)

Definition at line 65 of file races.as.h.

◆ silentMode

bool Script2Script::racesManager::silentMode

if true: No flashmessages will be shown. (default=false)

Definition at line 70 of file races.as.h.

◆ state

int Script2Script::racesManager::state

In which state are we?

See also
STATE_NotInRace, STATE_Waiting, STATE_Racing

Definition at line 77 of file races.as.h.

◆ STATE_NotInRace

int Script2Script::racesManager::STATE_NotInRace

We're not racing at the moment.

Definition at line 97 of file races.as.h.

◆ STATE_Racing

int Script2Script::racesManager::STATE_Racing

We're in the middle of a race :D.

Definition at line 99 of file races.as.h.

◆ STATE_Waiting

int Script2Script::racesManager::STATE_Waiting

A race is suspended, and we're waiting until the race continues.

Definition at line 98 of file races.as.h.

◆ submitScore

bool Script2Script::racesManager::submitScore

if true: If the user has a new best lap or new best race, this is submitted to the master server. (default=true)

Definition at line 68 of file races.as.h.

◆ truckNum

int Script2Script::racesManager::truckNum

The number of the (last) used truck in the race.

Definition at line 61 of file races.as.h.


The documentation for this class was generated from the following file: