Referência da API
Tudo o que um script pode usar, objeto por objeto. Para cada objeto está o que ele é, para que serve e um exemplo, e depois suas propriedades (sem parênteses: blocks.B3.occupied), métodos (com parênteses: turnouts.W5.diverging()) e eventos (um tratador como closure: stations.South.onArrival { Train train -> … }). Como funciona está em Objetos, coleções e eventos.
“Retorna” é o tipo: o que uma propriedade ou um método retorna, ou o que um evento passa ao tratador. Um clique no nome de um objeto leva você a esse objeto; digite no campo de busca para filtrar por objeto, nome ou explicação.
Esta é a versão 2 do que os scripts veem. Só se acrescentam coisas; o que existe não muda de nome.
Script.trainsPropriedades Every train on the layout by its name.Script.blocksPropriedades Every block by its name.Script.placesPropriedades Every station, yard, staging yard, siding and depot.Script.stationsPropriedades The stations.Script.yardsPropriedades The shunting yards.Script.stagingPropriedades The staging yards.Script.turnoutsPropriedades Every turnout with a name.Script.dutiesPropriedades Every duty.Script.signalsPropriedades Every signal placed on the layout.Script.devicesPropriedades Every tablet, phone or other computer registered with TRAX Control.Script.atMétodos Every day at this time of this computer's clock.Script.layoutPropriedades The layout itself: start, shutdown, messages, power.Script.clockPropriedades The model clock: its time, and every model day at a time.Script.inputMétodos A feedback address: a detector's or a push button's.Script.outputMétodos An accessory address: a light, a signal, an uncoupler.Script.flagMétodos A flag, which rules can ask too.Script.routeMétodos The first way from one block to another.Script.everyMétodos Again and again, every so many seconds.Script.betweenMétodos Whether this computer's clock is between two times.Script.sayMétodos A message on every screen.Script.announceMétodos An announcement: shown and spoken on every screen.Script.logMétodos A line in this script's log.Script.powerMétodos The track power on or off.Script.stopAllMétodos The emergency stop: every train, at once.Things.findMétodos The thing with this name, or null.Things.eachMétodos Every one of them.Things.valuesMétodos All of them.Things.findAllMétodos Those that match.Things.containsKeyMétodos Whether one has this name.Layout.onStartEventos Once every script has run its own lines.Layout.onRouteSetEventos When a route is set: its turnouts sent.Layout.onRouteReadyEventos When every turnout of a route is reported in place.Layout.onRouteDisturbedEventos When a turnout of a route is reported the other way.Layout.onRouteReleasedEventos When a route is released.Layout.onStationConnectedEventos When the command station is connected again.Layout.onStationLostEventos When the command station is lost.Layout.onPowerOnEventos When the track power goes on.Layout.onPowerOffEventos When the track power goes off.Layout.onEmergencyStopEventos When every train is stopped at once.Layout.onDeviceCameEventos When a device opens TRAX Control while it had none open.Layout.onDeviceWentEventos When a device has had TRAX Control closed for a little while.Layout.onDeviceAsksEventos When a new device registers and asks to be admitted.Layout.onShutdownEventos When the scripts stop: a few seconds at most.Layout.sayMétodos A message on every screen.Layout.announceMétodos An announcement: shown and spoken on every screen.Layout.powerMétodos The track power on or off.Layout.stopAllMétodos The emergency stop.Layout.betweenMétodos Whether the clock is between two times.Train.namePropriedades Its name.Train.onArrivalEventos When it comes into a station or yard.Train.onDepartureEventos When it has left a station or yard altogether.Train.onEnteredEventos When its front comes into a block.Train.onLeftEventos When it has left a block altogether.Train.onWaitingEventos When its agent waits for its way to its next stop: at once and every half minute.Train.onTrackChosenEventos When its agent chose its track in a station or yard.Train.onDelayedEventos When it runs late on its timetable's service: at the threshold, and again at every as many more.Train.onNotThereEventos 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étodos The track its agent is to take at the stop it goes to now; tried at once when it waits.Train.isInMétodos Whether it stands in a block or a place now.Train.startAgentMétodos Starts its agent, on its own duty or the one given.Train.stopAgentMétodos Stops its agent where it is.Block.namePropriedades Its name.Block.occupiedPropriedades Whether it is occupied now.Block.placePropriedades The station or yard it belongs to, or null.Block.onOccupiedEventos When it becomes occupied.Block.onFreeEventos When it becomes free.Block.onEnteredEventos When a train's front comes into it.Block.onLeftEventos When a train has left it altogether.Place.namePropriedades Its name.Place.kindPropriedades station, yard, staging, siding, industrialSiding or depot.Place.blocksPropriedades Its tracks.Place.freeTracksPropriedades Its tracks that are free now.Place.onWaitingEventos When a train's agent waits for its way here: at once and every half minute.Place.onTrackChosenEventos When a train's agent chose its track here.Place.onArrivalEventos When a train comes into it.Place.onDepartureEventos When a train has left it altogether.Turnout.namePropriedades Its name.Turnout.straightMétodos Sets it straight, as a click does.Turnout.divergingMétodos Sets it diverging, as a click does.Turnout.isStraightMétodos Whether it is reported straight now.Turnout.onReportedEventos When it is reported set: "straight" or "diverging".Signal.namePropriedades Its name.Signal.showsMétodos Whether it shows this aspect now: red, green or caution.Signal.onAspectEventos When it changes: "red", "green" or "caution".Signal.onGreenEventos When it shows green.Signal.onRedEventos When it shows red.Duty.namePropriedades Its name.DutyStep.trainPropriedades The train whose agent goes through the stop.DutyStep.stepPropriedades Which stop of the duty, counted from 1.DutyStep.momentPropriedades start, arrived, finished or waiting.DutyStep.placePropriedades The stop's station or yard; null when the stop is one block.DutyStep.blockPropriedades The stop's block, when it is one.DutyStep.secondsPropriedades While waiting: how long, in seconds.DutyStep.reasonPropriedades While waiting: why, in TRAX Control's words.Device.namePropriedades The name it registered under.Device.isHereMétodos Whether it has TRAX Control open now.Device.onCameEventos When it opens TRAX Control while it had none open.Device.onWentEventos When it has had TRAX Control closed for a little while.ModelClock.timePropriedades The time of day on the layout now.ModelClock.runningPropriedades Whether it runs.ModelClock.ratePropriedades How many times as fast as real time.ModelClock.atMétodos Every model day at this time.ModelClock.betweenMétodos Whether the model time is between two times.Input.onOnEventos When it goes on.Input.onOffEventos When it goes off.Input.onPropriedades Whether it is on now.Output.greenMétodos Switches it green (on).Output.redMétodos Switches it red (off).Flag.onMétodos Sets it.Flag.offMétodos Clears it.Flag.isOnMétodos Whether it is set.Route.setMétodos Sets it through the interlocking.Waiting.trainPropriedades The train.Waiting.placePropriedades The station or yard it waits to go to; null for a stop of one block.Waiting.blockPropriedades The block it waits to go to, for a stop of one block.Waiting.secondsPropriedades How long it has waited.Waiting.reasonPropriedades Why, in TRAX Control's words.Delay.trainPropriedades The train.Delay.servicePropriedades Its service's number this run.Delay.minutesPropriedades How many minutes late.Delay.placePropriedades Where the service goes, when that is a station or yard.NotThere.trainPropriedades The train that is not there.NotThere.servicePropriedades The service's number this run.NotThere.placePropriedades Where it was expected, when that is a station or yard.NotThere.blockPropriedades Where it was expected, when that is one block.TrackChoice.trainPropriedades The train.TrackChoice.blockPropriedades The track.TrackChoice.placePropriedades The station or yard.RouteEvent.namePropriedades Its name.RouteEvent.fromPropriedades The block it starts in.RouteEvent.toPropriedades The block it runs to.RouteEvent.statePropriedades setting, set, disturbed or released.
Nada encontrado.
Os objetos
- 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.