RailScript
RailScript Namespace Reference
This page lists every object attribute currently published by the RailKernel runtime namespace. Attributes marked writable can be changed with SET. “Planned” attributes already belong to the contract but currently return <not yet implemented>.
Addressing objects
System values use system.attribute. Other objects use domain["name"].attribute or domain["guid"].attribute. Indexed locomotive functions use locomotive["name"].function[number].attribute.
system.projectLoaded
feedback["K31"].occupied
locomotive["Class 66"].function[0].nameObject collections
An empty selector, such as block[] or feedback[], identifies every object in that namespace domain. Use it with FOR EACH. The loop variable represents one object at a time and exposes exactly the same attributes as the individually selected object.
commandStation[] feedback[] accessory[] signal[] block[] train[] trainType[] locomotive[] route[] script[] variable[] counter[] timer[]
FOR EACH item IN block[]
DO
LOG item.name + ": " + item.occupied
END
System and project system
Examples
LOG "Project: " + system.projectName
IF system.emergencyStop THEN LOG "Emergency stop is active" END Read-only
projectLoaded · emergencyStop · applicationVersion · osName · osVersion · osArchitecture · javaVersion · language · currentTime · uptimeMillis · commandStationCount · connectedCommandStationCount · poweredCommandStationCount · allCommandStationsConnected · projectName · projectDirty · projectRevision · scale · catalogueFile · trackCount · flexTrackCount · blockCount · feedbackCount · accessoryCount · signalCount · locomotiveCount · trainCount · trainTypeCount · routeCount · userVariableCount
Command station commandStation
Collection identifier and attributes available through its loop variable: commandStation[]
Examples
IF commandStation["ECoS"].connected THEN LOG "ECoS connected" END
SET commandStation["ECoS"].powerOn = true Read-only
guid · name · technicalName · type · host · port · connected · vendor · model · articleNumber · firmwareVersion · hardwareVersion · serialNumber · supportsDecoderCvRead · supportsDecoderCvWrite · supportsMfxDecoderRead · supportsFeedbackDeletion · locomotiveCount · accessoryCount · routeCount · feedbackCount · feedbackModuleCount · boosterCount
Writable
powerOn
Feedback feedback
Collection identifier and attributes available through its loop variable: feedback[]
Examples
WHEN feedback["K31"].occupied DO LOG "K31 occupied" END
LOG "Feedback length: " + feedback["K31"].length Read-only
guid · name · commandStation · s88 · bus · module · contact · address · occupied · reliable · unreliable · excludeFromEmergencyStop · forwardRole · backwardRole · railCount · length · blockGuid · blockName · forwardStart · forwardEnd · backwardStart · backwardEnd
Accessory accessory
Collection identifier and attributes available through its loop variable: accessory[]
Examples
SET accessory["A.1"].position = STRAIGHT
IF accessory["A.1"].reserved THEN LOG accessory["A.1"].reservedBy END Read-only
guid · name · type · commandStation · address · threeWay · address2 · protocol · defaultState · unreliable · comment · half · reserved · reservedBy · state
Writable
position
Signal signal
Collection identifier and attributes available through its loop variable: signal[]
Examples
SET signal["Station entry"].state = GREEN
LOG "Signal block: " + signal["Station entry"].block Read-only
guid · name · manufacturer · articleNumber · productName · gauge · signalType · aspects · technology · railwayCountry · railwayCompany · x · y · heightMm · block · blockGuid · blockSide · direction · comment · linkedAccessory · linkedAccessoryGuid · linkedDecoder
Writable
state
Block block
Collection identifier and attributes available through its loop variable: block[]
Examples
IF block["Platform 1"].occupied THEN LOG block["Platform 1"].currentTrain END
LOG "Forward stop: " + block["Platform 1"].forwardStop Read-only
guid · name · type · abstract · length · forwardBrake · forwardStop · backwardBrake · backwardStop · electrified · occupied · reserved · reservedBy · currentTrain · direction · bidirectional · maximumSpeed · minimumDwellTime · waiting · deadlocked · feedbackCount · accessoryCount · signalCount · decouplerCount · firstForwardFeedback · lastForwardFeedback · forwardEntryFeedback · forwardBrakeFeedback · forwardStopFeedback · forwardExitFeedback · firstBackwardFeedback · lastBackwardFeedback · backwardEntryFeedback · backwardBrakeFeedback · backwardStopFeedback · backwardExitFeedback
Train train
Collection identifier and attributes available through its loop variable: train[]
Examples
IF train["Intercity 1200"].placed THEN LOG train["Intercity 1200"].currentBlock END
WHEN train["Intercity 1200"].newFeedback DO LOG "New feedback reached" END Read-only
guid · name · locomotive · locomotiveGuid · trainType · trainTypeGuid · lengthMm · wagonGroupCount · motionSamplingEnabled · placed · newFeedback · currentBlock · currentBlockGuid · currentRoute · currentRouteGuid · currentFeedback · currentFeedbackGuid · direction · placedElementType · placedElementGuid · placedOffsetMm · brakeDistanceMmSpeed50 · brakeDistanceMmSpeed70 · brakeDistanceMmSpeed90 · brakeDistanceMmSpeed110 · motionSpeedMmPerSec50 · motionSpeedMmPerSec70 · motionSpeedMmPerSec90 · motionSpeedMmPerSec110
Planned
speed · state · destination · route · waiting · deadlocked · automatic · reservedBlockCount
Train type trainType
Collection identifier and attributes available through its loop variable: trainType[]
Examples
LOG trainType["Intercity"].maximumSpeedKmh
IF trainType["Intercity"].alignAtPlatform THEN LOG "Platform alignment enabled" END Read-only
guid · name · category · maximumSpeedKmh · unlimitedMaximumSpeed · accelerationFactor · brakingFactor · priority · reservationCount · reservationBeforeDeparture · alignAtPlatform · trainCount · allowedBlockCount
Locomotive locomotive
Collection identifier and attributes available through its loop variable: locomotive[]
Examples
SET locomotive["NS 1200"].speed = 64
SET locomotive["NS 1200"].function[3].active = true Read-only
guid · name · displayName · description · comment · brand · catalogueNumber · gauge · commandStation · address · protocol · speedSteps · lengthMm · maximumSpeedKmh · locomotiveType · electric · configuredDirection · decoderUid · mfxUid · decoderTemplate · imageFile · feedbackDistanceFront · feedbackDistanceRear · volume · totalDistanceKm · totalRunningTimeMillis · functionCount
Writable
speed
Read-only
function[n].name · function[n].type · function[n].mode · function[n].visible · function[n].directional · function[n].autoOffMs
Planned
speedKmh · direction · moving · connected · currentBlock · currentBlockGuid · reserved · reservedBy · placed · trainName · trainGuid · minimumDecoderStep · maximumDecoderStep · calibratedSpeedTable · acceleration · braking · massSimulation · brakeCorrection · automatic · active · blocked · outOfService · maintenanceInterval · maintenanceDue · pushPullMode · function[n].active
Route route
Collection identifier and attributes available through its loop variable: route[]
Examples
LOG route["Station loop"].fromBlock + " → " + route["Station loop"].toBlock
MOVE "Intercity 1200" USING "Station loop" QUEUE Read-only
guid · name · fromBlock · fromBlockGuid · toBlock · toBlockGuid · blockCount · legCount · trackCount · accessoryCount · corridorLengthMm · respectBlockDirection · continuationRoute · continuationRouteGuid
Planned
active · queued · reserved · reservedBy · available · blocked
RailScript script
Collection identifier and attributes available through its loop variable: script[]
Examples
RUN "Station loop sounds"
WHEN !script["Station loop sounds"].isRunning DO LOG "Sound script completed" END Read-only
guid · name · enabled · language · isRunning
User variable variable
Collection identifier and attributes available through its loop variable: variable[]
Examples
SET variable["operatingMode"].value = "night"
LOG variable["operatingMode"].value Read-only
guid · name · type · defaultValue · description · persistent · readOnly
Writable
value (unless readOnly)
Counter counter
Collection identifier and attributes available through its loop variable: counter[]
Examples
SET counter["departures"].value = counter["departures"].value + 1
LOG counter["departures"].value Read-only
guid · name · initialValue · minimum · maximum · step · enabled · comment
Writable
value
Timer timer
Collection identifier and attributes available through its loop variable: timer[]
Examples
SET timer["station dwell"].durationMillis = 30000
WHEN timer["station dwell"].expired DO LOG "Dwell completed" END Read-only
guid · name · duration · elapsed · elapsedMillis · remaining · remainingMillis · expired · enabled · comment
Writable
durationMillis · running