Scripting API

Home Scripting API Index Class Overview

com.nolimitscoaster

Class SpecialTrack


public final class SpecialTrack
extends Object

Can be used to access a special track (switch track) from within scripted block mode

Method Summary

bool canChangeManualSwitchDirection()
  Returns if the switch can be changed using setManualSwitchDirection.
bool canChangeSwitchDirection()
  Returns if the switch can be changed using setSwitchDirection.
Coaster getCoaster()
  Returns the coaster this trigger belongs to
int getMoveableBranchCount()
  Returns the number of moveable track branches
nlvm.math3d.Matrix4x4f getMoveableBranchMatrix(int branch)
  Returns the transformation matrix for a moveable track branch
String getName()
  Returns the name of the special track
int getNumberOfSwitchDirections()
  Returns the number of available switch directions
int getSetSwitchDirection()
  Returns the current switch track position (0: first track, 1: second track, ...)
int getSwitchDirection()
  Returns the current switch track position (0: first track, 1: second track, ...)
float getSwitchTime()
  Returns the switching time as specified in the editor
float getVisibleSwitchState()
  Returns the current switch position as a continuous value.
void setCanManualSwitchDirection(bool enable)
  Sets if a switch can be changed in manual mode by using the control panel. Will be ignored in auto mode.
bool setManualSwitchDirection(int pos)
  Changes the switch direction. Works only in semi manual block and full manual block mode.
bool setSwitchDirection(int pos)
  Sets the current switch track position (0: first track, 1: second track, ...)


Method Detail


canChangeManualSwitchDirection

public final bool canChangeManualSwitchDirection()

Returns if the switch can be changed using setManualSwitchDirection.

Meant to work with semi manual block mode and full manual block mode, for implementing control panel controls. Note: the original methods setSwitchDirection and canChangeSwitchDirection were designed only for scripted operation mode, and are designed for scripted block system coasters. The new methods setManualSwitchDirection and canChangeManualSwitchDirection are meant to work for implementing control panel controls, and work in manual modes only.

Returns:
    true when the switch can be changed using setManualSwitchDirection.

Since:
    2.6.4.0


canChangeSwitchDirection

public final bool canChangeSwitchDirection()

Returns if the switch can be changed using setSwitchDirection.

The switch can only be changed in scripted block mode. When a train is on the gap between the moveable and fixed parts of the switch, the switch cannot be changed.

Returns:
    true when switch can be changed, false otherwise.


getCoaster

public final Coaster getCoaster()

Returns the coaster this trigger belongs to

Returns:
    coaster this trigger belongs to

Since:
    2.5.7.0


getMoveableBranchCount

public final int getMoveableBranchCount()

Returns the number of moveable track branches

Can be used with getMoveableBranchMatrix for attaching custom scenery objects to moving track branches Note that depending on the track style the number of available moveable branches may vary.

Returns:
    number of moveable track branches

Since:
    2.5.3.0


getMoveableBranchMatrix

public final nlvm.math3d.Matrix4x4f getMoveableBranchMatrix(int branch)

Returns the transformation matrix for a moveable track branch

Can be used for attaching custom scenery objects to moving track branches Note that depending on the track style the number of available moveable branches may vary, so checking the result for null or checking the result of getMoveableBranchCount should always be done.

Parameters:

branch - branch index (starting from 0...getMoveableBranchCount()-1)

Returns:
    transformation matrix or null if the SpecialTrack has no branch at index

Since:
    2.5.3.0


getName

public final String getName()

Returns the name of the special track


getNumberOfSwitchDirections

public final int getNumberOfSwitchDirections()

Returns the number of available switch directions

Returns:
    number of available switches (>= 1).

Since:
    2.5.7.0


getSetSwitchDirection

public final int getSetSwitchDirection()

Returns the current switch track position (0: first track, 1: second track, ...)

When the switch track is moving, it will return the value last set with setSwitchDirection() When the switch track is not moving, it will return the same value as getSwitchDirection()

Returns:
    switch number

Since:
    2.2.5.8


getSwitchDirection

public final int getSwitchDirection()

Returns the current switch track position (0: first track, 1: second track, ...)

Will return -1 when the switch track is currently in movement.

Returns:
    switch number


getSwitchTime

public final float getSwitchTime()

Returns the switching time as specified in the editor

Returns:
    switch time in seconds as specified in the editor

Since:
    2.6.2.0


getVisibleSwitchState

public final float getVisibleSwitchState()

Returns the current switch position as a continuous value.


setCanManualSwitchDirection

public final void setCanManualSwitchDirection(bool enable)

Sets if a switch can be changed in manual mode by using the control panel. Will be ignored in auto mode.

The default is true.


setManualSwitchDirection

public final bool setManualSwitchDirection(int pos)

Changes the switch direction. Works only in semi manual block and full manual block mode.

Similar to setSwitchDirection, but works in semi manual block and full manual block mode. Note: the original methods setSwitchDirection and canChangeSwitchDirection were designed only for scripted operation mode, and are designed for scripted block system coasters. The new methods setManualSwitchDirection and canChangeManualSwitchDirection are meant to work for implementing control panel controls, and work in manual modes only.

Parameters:

pos - the switch direction (0...number of switches-1)

Returns:
    true when the switch could be changed.

Since:
    2.6.4.0


setSwitchDirection

public final bool setSwitchDirection(int pos)

Sets the current switch track position (0: first track, 1: second track, ...)

The switch can only be changed in scripted block mode. Will be ignored if the switch cannot be changed at the time of call. Returns true if the switch direction change was initiated.

Parameters:

pos - switch position (must be >= 0 and < getNumberOfSwitchDirections())