|ID||A unique ID, which is used by Rocrail to address the element. This ID is usually assigned by Rocrail.|
|Text||This attribute stores the string, which should be displayed in the track plan and can be changed here.|
|Image||you can define the path to an image using this button, if you like to see an image in your trackplan instead of a simple text|
|Tip||Tooltip for this element.|
|Point size||You can change with this attribute the font size of the text.||0 (default) means the standard value of the operating system.|
|Background||Background color.||Is only shown if the attribute transparent is not set.|
|Orientation||Default is horizontal.|
|Reset||Reset the saved text content at startup.||Useful for dynamic text.|
The Position Tab is described in chapter Track diagram elements. The attribute cx/cy is important for the rendering of text.
If a string is not completely displayed in the plan, you should increase this value until the whole string is shown in the track plan.
If the text ends with .png the text object will try to find the matching image in the Imagepath.
The image will be scaled, with respect to the image aspect, to fit the text size as defined on the Position Tab. (7374+)
An action can be used to let the text be spoken by a program like espeak on the server.
To have textfields updated by a block be spoken on the client, read Speak command.
This action will only be executed when this text object is update by a Text action. (See Dynamic text).
| Example for an action to speak the updated |
text could look like this.
| In the 'properties' of the text-element this action needs to be
linked to this text object using the actioncontrol dialog like this.
Dynamic text is text that is updated or changed through an action.
A text object needs to be created in the track plan to contain the dynamic text. It is not important what text is written in the field as this will be changed through the action that controls the text object and therefore can be left blank.
It is important that the width of the text object (Cx in the Position tab) be wide enough to contain all the text that will be written here by the action. Also make a note of the ID of the text object. This will be needed when the action that will change the text will be defined.
From the Tables menu, choose the Actions table and create a new action by clicking on New.
In the field Type choose Text, in the field ID choose the ID of the text object you have just created above and in the Command field choose Update (it is the only option).
The Parameter field will contain the text that will appear in the associated text object. E.g. The train in %bkid% is the %lcid%. The text between the % are the variables that will be updated every time the action is carried out.
|%lcident%||Loco identifier (RFID, Railcom, Lissy, Barcode…)|
|%lcdir%||Loco direction: “fwd”/“rev”|
|%lcplacing%||Loco placing: “norm”/“swap”|
|%lcscbk%||Schedule block ID|
|%lcscbkloc%||Schedule block location|
|%lcschour%||Schedule departure hour|
|%lcscmin%||Schedule departure minute|
|%lcscnextbk%||Schedule next block ID|
|%lcscnextbkloc%||Schedule next block location|
|%lcscprevbk%||Schedule previous block ID|
|%lcscprevbkloc%||Schedule previous block location|
|%bkloc%||Block location name|
|%frombkid%||Coming from block|
|%frombkloc%||From block location name|
|%frombkdesc%||Coming from block description|
|%bkmvspeed%||Speed measured in block (use it with state 'free'¹)|
|%load%||Load in mA|
|%volt%||Voltage in mV|
|%temp%||Temperature in °C|
|%mvspeed%||Measured speed in KM/H|
|%#varname% or with Sub-ID %#varname#lcid%||The integer value|
¹) Hint: %bkmvspeed% will be updated on the in-event. The next event which can be used to trigger the update of the text is the change to status 'free'. If you trigger the update on other stati, you will get the last measured speed (which might differ from the actual one.)
All defined environment variables can also be used:
“Good morning %USER%.”
(consider in Windows: %USERNAME%)
will be evaluated like this:
“Good morning rob.”
The next step is to choose the object that will be associated with the action.
In the example above it would be the block for which the dynamic text will be updating with the loco ID. Therefore if the block that is being associated with the action is block LP1 and the next train to enter the block is 3MT, the text object would read “The train in LP1 is the 3MT”.
Following the example the Properties of block LP1 are chosen. In the Actions submenu the action that changes the dynamic text is chosen from the list in the ID field. The State field should read enter so that the action is initiated when a train enters the block.
espeaking the updated text
There are two options to have the updated text read e.g. by espeak:
- Use the speakcommand –> this will be executed on the client computer.
- Configure an extra action as shown here –> this will be executed on the server computer.
Examples with sound files and espeak
A Linux script with the content:
mplayer jingle.wav; espeak -vde+f2 " $* ";
will play a jingle before the dynamic text is spoken.
A Windows batch could look like this:
c:\playwav ns.wav c:\espeak -vnl+m3 %1% exit
Just put the code in a .bat file, like sound.bat. Just call that .bat file from an action connected with a text object in Rocrail.
The %1% will be replaced by the dynamic text that comes from Rocrail
sndrec32 /play /close /embedding c:\sound\gong.wav C:\Programme\eSpeak\command_line\espeak.exe -v de+f2 %*
The examples of commands in scripts or batch files with sounds and “espeak” can also be used individually.
If only a single command line should be done, it can be even without a script or batch file entered directly in the
command field of the action.
The Microsoft Speech Platform offers better quality voices in various languages including English, German, Dutch and Italian.
To install on your computer follow these instructions:
1. Download and install the Speech Platform Runtime http://www.microsoft.com/download/en/details.aspx?id=27225 (the file 'x86_SpeechPlatformRuntime\SpeechPlatformRuntime.msi').
2. Download and install Runtime Languages for use with the Speech Platform http://www.microsoft.com/download/en/details.aspx?id=27224 (files with names starting with 'MSSpeech_TTS_').
However these languages cannot be run from command line espeak. Balabolka is a free to use program that can be used to run Microsoft Speech Platform as default. It can be downloaded from here http://www.cross-plus-a.com/balabolka.htm
Choose the tab Microsoft Speech Platform and you will find the language you have downloaded. Closing the program now and this set this voice as your default. Balabolka can be run in command line mode too.
playwav ns.wav c:\Balabolka\balabolka.exe -rmnq %1% exit
With the above parameters Balabolka reads your dynamic text in a minimized form and then quits after the text is read. It is important that for this to work, the Action that calls up the batch file comes from the cell that contains the dynamic text.
Other voices such as those produced by AT&T can be bought if you wish even more better sounding voices.
Balabolka can also save the read text in the program into .WAV or MP3. format. These can be used to create batch files that can be called up from Rocrail upon specific events as explained in the note above for espeak. e.g. A specific station announcement is played only when a specified locomotive enters a specific block http://youtu.be/t1Zffyg4FOQ
Mac OS X: Use the “say” command.
Some systems can process text messages on displays like CBUS: CAN-GC8.
To use this feature the address must be greater than zero.
cmdr0A40 OText 0281 send text [Good morning rob] cmdr0A40 OCBUS 1638 translate: tx cmdr0A40 OCBUS 2028 set display 5600:1 to "Good morning rob" cbwriter OCBUS 0170 OPC_ACDAT(0xF6) address=5600 display=1 line=0 nr=0 text=[Good] cbwriter OCBUS 0170 OPC_ACDAT(0xF6) address=5600 display=1 line=0 nr=1 text=[ mor] cbwriter OCBUS 0170 OPC_ACDAT(0xF6) address=5600 display=1 line=0 nr=2 text=[ning] cbwriter OCBUS 0170 OPC_ACDAT(0xF6) address=5600 display=1 line=0 nr=3 text=[ rob]
If you have more than one Command Station you can use this field to link this output with the CS you actually wired it with. Leave blank in case you have only one CS or when it is wired to the default CS. (First digint in the rocrail.ini)
Address of the Display module.
The display number on the module. Range from 1 to 8.