Référence de l'API
Tout ce qu'un script peut utiliser, objet par objet. Pour chaque objet figurent ce qu'il est, à quoi il sert et un exemple, puis ses propriétés (sans parenthèses : blocks.B3.occupied), ses méthodes (avec parenthèses : turnouts.W5.diverging()) et ses événements (un gestionnaire sous forme de closure : stations.South.onArrival { Train train -> … }). Le fonctionnement est expliqué dans Objets, collections et événements.
« Donne » est le type : ce qu'une propriété ou une méthode renvoie, ou ce qu'un événement transmet au gestionnaire. Un clic sur le nom d'un objet vous y conduit ; tapez dans le champ de recherche pour filtrer sur l'objet, le nom ou l'explication.
Ceci est la version 2 de ce que voient les scripts. On ne fait qu'ajouter ; ce qui existe ne change pas de nom.
Script.trainsPropriétés Every train on the layout by its name.Script.blocksPropriétés Every block by its name.Script.placesPropriétés Every station, yard, staging yard, siding and depot.Script.stationsPropriétés The stations.Script.yardsPropriétés The shunting yards.Script.stagingPropriétés The staging yards.Script.turnoutsPropriétés Every turnout with a name.Script.dutiesPropriétés Every duty.Script.signalsPropriétés Every signal placed on the layout.Script.devicesPropriétés Every tablet, phone or other computer registered with TRAX Control.Script.atMéthodes Every day at this time of this computer's clock.Script.layoutPropriétés The layout itself: start, shutdown, messages, power.Script.clockPropriétés The model clock: its time, and every model day at a time.Script.inputMéthodes A feedback address: a detector's or a push button's.Script.outputMéthodes An accessory address: a light, a signal, an uncoupler.Script.flagMéthodes A flag, which rules can ask too.Script.routeMéthodes The first way from one block to another.Script.everyMéthodes Again and again, every so many seconds.Script.betweenMéthodes Whether this computer's clock is between two times.Script.sayMéthodes A message on every screen.Script.announceMéthodes An announcement: shown and spoken on every screen.Script.logMéthodes A line in this script's log.Script.powerMéthodes The track power on or off.Script.stopAllMéthodes The emergency stop: every train, at once.Things.findMéthodes The thing with this name, or null.Things.eachMéthodes Every one of them.Things.valuesMéthodes All of them.Things.findAllMéthodes Those that match.Things.containsKeyMéthodes Whether one has this name.Layout.onStartÉvénements Once every script has run its own lines.Layout.onRouteSetÉvénements When a route is set: its turnouts sent.Layout.onRouteReadyÉvénements When every turnout of a route is reported in place.Layout.onRouteDisturbedÉvénements When a turnout of a route is reported the other way.Layout.onRouteReleasedÉvénements When a route is released.Layout.onStationConnectedÉvénements When the command station is connected again.Layout.onStationLostÉvénements When the command station is lost.Layout.onPowerOnÉvénements When the track power goes on.Layout.onPowerOffÉvénements When the track power goes off.Layout.onEmergencyStopÉvénements When every train is stopped at once.Layout.onDeviceCameÉvénements When a device opens TRAX Control while it had none open.Layout.onDeviceWentÉvénements When a device has had TRAX Control closed for a little while.Layout.onDeviceAsksÉvénements When a new device registers and asks to be admitted.Layout.onShutdownÉvénements When the scripts stop: a few seconds at most.Layout.sayMéthodes A message on every screen.Layout.announceMéthodes An announcement: shown and spoken on every screen.Layout.powerMéthodes The track power on or off.Layout.stopAllMéthodes The emergency stop.Layout.betweenMéthodes Whether the clock is between two times.Train.namePropriétés Its name.Train.onArrivalÉvénements When it comes into a station or yard.Train.onDepartureÉvénements When it has left a station or yard altogether.Train.onEnteredÉvénements When its front comes into a block.Train.onLeftÉvénements When it has left a block altogether.Train.onWaitingÉvénements When its agent waits for its way to its next stop: at once and every half minute.Train.onTrackChosenÉvénements When its agent chose its track in a station or yard.Train.onDelayedÉvénements When it runs late on its timetable's service: at the threshold, and again at every as many more.Train.onNotThereÉvénements When it is not where its circulation expects it: not at the first stop of its run when due, or not ready to join another train.Train.arriveAtMéthodes The track its agent is to take at the stop it goes to now; tried at once when it waits.Train.isInMéthodes Whether it stands in a block or a place now.Train.startAgentMéthodes Starts its agent, on its own duty or the one given.Train.stopAgentMéthodes Stops its agent where it is.Block.namePropriétés Its name.Block.occupiedPropriétés Whether it is occupied now.Block.placePropriétés The station or yard it belongs to, or null.Block.onOccupiedÉvénements When it becomes occupied.Block.onFreeÉvénements When it becomes free.Block.onEnteredÉvénements When a train's front comes into it.Block.onLeftÉvénements When a train has left it altogether.Place.namePropriétés Its name.Place.kindPropriétés station, yard, staging, siding, industrialSiding or depot.Place.blocksPropriétés Its tracks.Place.freeTracksPropriétés Its tracks that are free now.Place.onWaitingÉvénements When a train's agent waits for its way here: at once and every half minute.Place.onTrackChosenÉvénements When a train's agent chose its track here.Place.onArrivalÉvénements When a train comes into it.Place.onDepartureÉvénements When a train has left it altogether.Turnout.namePropriétés Its name.Turnout.straightMéthodes Sets it straight, as a click does.Turnout.divergingMéthodes Sets it diverging, as a click does.Turnout.isStraightMéthodes Whether it is reported straight now.Turnout.onReportedÉvénements When it is reported set: "straight" or "diverging".Signal.namePropriétés Its name.Signal.showsMéthodes Whether it shows this aspect now: red, green or caution.Signal.onAspectÉvénements When it changes: "red", "green" or "caution".Signal.onGreenÉvénements When it shows green.Signal.onRedÉvénements When it shows red.Duty.namePropriétés Its name.DutyStep.trainPropriétés The train whose agent goes through the stop.DutyStep.stepPropriétés Which stop of the duty, counted from 1.DutyStep.momentPropriétés start, arrived, finished or waiting.DutyStep.placePropriétés The stop's station or yard; null when the stop is one block.DutyStep.blockPropriétés The stop's block, when it is one.DutyStep.secondsPropriétés While waiting: how long, in seconds.DutyStep.reasonPropriétés While waiting: why, in TRAX Control's words.Device.namePropriétés The name it registered under.Device.isHereMéthodes Whether it has TRAX Control open now.Device.onCameÉvénements When it opens TRAX Control while it had none open.Device.onWentÉvénements When it has had TRAX Control closed for a little while.ModelClock.timePropriétés The time of day on the layout now.ModelClock.runningPropriétés Whether it runs.ModelClock.ratePropriétés How many times as fast as real time.ModelClock.atMéthodes Every model day at this time.ModelClock.betweenMéthodes Whether the model time is between two times.Input.onOnÉvénements When it goes on.Input.onOffÉvénements When it goes off.Input.onPropriétés Whether it is on now.Output.greenMéthodes Switches it green (on).Output.redMéthodes Switches it red (off).Flag.onMéthodes Sets it.Flag.offMéthodes Clears it.Flag.isOnMéthodes Whether it is set.Route.setMéthodes Sets it through the interlocking.Waiting.trainPropriétés The train.Waiting.placePropriétés The station or yard it waits to go to; null for a stop of one block.Waiting.blockPropriétés The block it waits to go to, for a stop of one block.Waiting.secondsPropriétés How long it has waited.Waiting.reasonPropriétés Why, in TRAX Control's words.Delay.trainPropriétés The train.Delay.servicePropriétés Its service's number this run.Delay.minutesPropriétés How many minutes late.Delay.placePropriétés Where the service goes, when that is a station or yard.NotThere.trainPropriétés The train that is not there.NotThere.servicePropriétés The service's number this run.NotThere.placePropriétés Where it was expected, when that is a station or yard.NotThere.blockPropriétés Where it was expected, when that is one block.TrackChoice.trainPropriétés The train.TrackChoice.blockPropriétés The track.TrackChoice.placePropriétés The station or yard.RouteEvent.namePropriétés Its name.RouteEvent.fromPropriétés The block it starts in.RouteEvent.toPropriétés The block it runs to.RouteEvent.statePropriétés setting, set, disturbed or released.
Rien trouvé.
Les objets
- Script The script itselfEverything a script can write without an object in front: the layout's collections (trains, blocks, stations …), the layout as a whole (layout), the model clock (clock), and a few helpers: messages, addresses, flags, routes and time.
- Things A collectionAll things of one sort on your layout, by name: all trains, all blocks, all stations.
- Layout The layoutThe layout as a whole: what happens to all of it (the scripts starting and stopping, routes, the command station, track power, devices coming and going) and what you do for the whole layout (a message, an announcement, track power, the emergency stop).
- Train A trainA train made up on your layout, as in the Trains panel.
- Block A blockA stretch of track with a detector, as in the diagram: a track in a station, a stretch of open line.
- Place A station or yardA station, shunting yard, staging yard, siding or depot: a named group of tracks (blocks).
- Turnout A turnoutA named turnout in the diagram.
- Signal A signalA signal placed on your layout.
- Duty A dutyA duty from the Duties panel: a series of stops a train's agent runs.
- DutyStep A duty's stopWhat a method is given when a duty's stop calls it.
- Device A deviceA tablet, phone or other computer registered with TRAX Control, as on the Devices page.
- ModelClock The model clockYour layout's clock, which can run faster than real time and can stand still; the timetable runs on it.
- Input A feedback addressA feedback address on your command station or feedback module: of a detector, or of a push button or switch on the layout.
- Output An accessory addressAn accessory address on your command station: a light, a bell, an uncoupler, a signal not in the diagram.
- Flag A flagA named on/off switch that exists only inside TRAX Control.
- Route A routeA route from one block to another as TRAX Control finds it: the first way that keeps its direction and needs no turnout by hand.
- Waiting A waiting agentWhat onWaiting gives when a train's agent waits for its route to the next stop: which train, where to, how long already and why.
- Delay A delayWhat onDelayed gives when a timetable train runs late: which train, which service, how many minutes and where to.
- NotThere Stock that is not thereWhat onNotThere gives when a train is not where its circulation expects it: which train, which service and where it should have been.
- TrackChoice A chosen trackWhat a station's onTrackChosen gives when a train's agent chooses a track there: the train, the track and the station.
- RouteEvent A route changingWhat the layout's route events give (onRouteSet, onRouteReady, onRouteDisturbed, onRouteReleased): the route's name, from which block to which, and how it stands now.