How to Use Message Popup Rule

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
m
m
Line 336: Line 336:
 
<td width=46>[[image:BackToTop.png|link=#top|alt=Top|Top]]</td>
 
<td width=46>[[image:BackToTop.png|link=#top|alt=Top|Top]]</td>
 
<td width=75>[[image:NextUp.png|link=#stepHTML|alt=Next Up|Top]]</td>
 
<td width=75>[[image:NextUp.png|link=#stepHTML|alt=Next Up|Top]]</td>
<td width=75>[[image:NextDown.png|link=#bottom|alt=Next Down|Next Down]]</td>
+
<td width=75>[[image:NextDown.png|link=#stepAlt|alt=Next Down|Next Down]]</td>
 
<td width=75>[[image:BackToBottom.png|link=#bottom|alt=Bottom|Bottom]]</td>
 
<td width=75>[[image:BackToBottom.png|link=#bottom|alt=Bottom|Bottom]]</td>
 
</tr>
 
</tr>
Line 345: Line 345:
 
The settings shown in this example will direct '''Trainz''' to load the message from text stored in the '''config.txt''' string table of a specified HTML asset.
 
The settings shown in this example will direct '''Trainz''' to load the message from text stored in the '''config.txt''' string table of a specified HTML asset.
  
<table>
+
<table width=1000>
 
<tr valign="top">
 
<tr valign="top">
 
<td>[[image:MessagePopup4.JPG|link=]]</td>
 
<td>[[image:MessagePopup4.JPG|link=]]</td>
 
<td>
 
<td>
<table cellpadding=2 bgcolor=#eeeeee>
 
<tr>
 
<td colspan="2">
 
----</td>
 
</tr>
 
<tr valign="top">
 
<td>[[image:Gears.PNG|link=]]</td>
 
<td><span style="font-size: 17px;">'''Settings:'''</span><br>
 
[[image:PortalOptionButtonFilled.PNG|link=]] '''A pre-defined string-table entry from a HTML asset (advanced)'''<br>
 
'''In This Example:'''
 
:[[image:CheckBoxOff.PNG|link=]] '''Pause game while message is displayed''' - game play will not be paused
 
:[[image:CheckBox.PNG|link=]] '''Close previous message popup windows''' - this is usually a good idea unless you want multiple message windows open
 
:'''Message location:''' '''<span style="text-decoration: underline;">Top left</span>''' of the screen has been chosen as the location for the message window. Other positions are '''Top right''', '''Bottom left''' and '''Bottom right'''
 
:'''HTML Asset:''' '''<span style="text-decoration: underline;">General Purpose Session HTML</span>''' one of the HTML assets installed with '''Trainz'''
 
:'''String Table Token:''' '''<span style="text-decoration: underline;">html_warning_late</span>''' the string table '''token''' in the config.txt file of the '''<span style="text-decoration: underline;">General Purpose Session HTML</span>''' asset contains the message to be displayed
 
:'''HTML Wave:''' '''<span style="text-decoration: underline;">General Purpose Session HTML</span>''' HTML asset contains the ''optional'' sound file to be played
 
:'''Wav Name:''' '''<span style="text-decoration: underline;">all-aboard.wav</span>''' is the ''optional'' sound file to be played
 
:[[image:CheckBox.PNG|link=]] '''Autoplay Wav''' - the sound will be played when the page is displayed</td>
 
</tr>
 
<tr>
 
<td colspan="2">
 
----</td>
 
</tr>
 
</table>
 
  
 
<table bgcolor=#000000 cellpadding=2>
 
<table bgcolor=#000000 cellpadding=2>
Line 393: Line 369:
 
</table>
 
</table>
 
<br>
 
<br>
 +
<table width=1000 cellpadding=2 bgcolor=#eeeeee>
 +
<tr>
 +
<td colspan="2">
 +
----</td>
 +
</tr>
 +
<tr valign="top">
 +
<td>[[image:Gears.PNG|link=]]</td>
 +
<td><span style="font-size: 17px;">'''Settings:'''</span> Shown in the example above:-
 +
<table>
 +
<tr valign="top">
 +
<td>[[image:PortalOptionButtonFilled.PNG|link=]] '''A pre-defined string-table entry from a HTML asset (advanced)'''</td>
 +
</tr>
 +
<tr valign="top">
 +
<td>[[image:CheckBoxOff.PNG|link=]] '''Pause game while message is displayed''' - game play will not be paused</td>
 +
</tr>
 +
<tr valign="top">
 +
<td>[[image:CheckBox.PNG|link=]] '''Close previous message popup windows''' - this is usually a good idea unless you want multiple message windows open</td>
 +
</tr>
 +
<tr valign="top">
 +
<td>'''Message location:''' '''<span style="text-decoration: underline;">Top left</span>''' of the screen has been chosen as the location for the message window. Other positions are '''Top right''', '''Bottom left''' and '''Bottom right'''</td>
 +
</tr>
 +
<tr valign="top">
 +
<td>'''HTML Asset:''' '''<span style="text-decoration: underline;">General Purpose Session HTML</span>''' one of the HTML assets installed with '''Trainz'''</td>
 +
</tr>
 +
<tr valign="top">
 +
<td>'''String Table Token:''' '''<span style="text-decoration: underline;">html_warning_late</span>''' the string table '''token''' in the config.txt file of the '''<span style="text-decoration: underline;">General Purpose Session HTML</span>''' asset contains the message to be displayed</td>
 +
</tr>
 +
<tr valign="top">
 +
<td>'''HTML Wave:''' '''<span style="text-decoration: underline;">General Purpose Session HTML</span>''' HTML asset contains the ''optional'' sound file to be played</td>
 +
</tr>
 +
<tr valign="top">
 +
<td>'''Wav Name:''' '''<span style="text-decoration: underline;">all-aboard.wav</span>''' is the ''optional'' sound file to be played</td>
 +
</tr>
 +
<tr valign="top">
 +
<td>[[image:CheckBox.PNG|link=]] '''Autoplay Wav''' - the sound will be played when the page is displayed</td>
 +
</tr>
 +
</table>
 +
</td>
 +
</tr>
 +
<tr>
 +
<td colspan="2">
 +
----</td>
 +
</tr>
 +
</table>
 
For example, the '''config.txt''' file of the asset '''General Purpose Session HTML''' contains the following:-
 
For example, the '''config.txt''' file of the asset '''General Purpose Session HTML''' contains the following:-
 
  '''string-table'''
 
  '''string-table'''
Line 409: Line 429:
 
</table>
 
</table>
  
<table width="100%">
+
<table> <!-- BEGIN Nav Buttons Table -->
 
<tr valign="top">
 
<tr valign="top">
<td align="right">[[image:BackToTop.png|link=#top|alt=Top|Top]]</td>
+
<td width=729><span id="stepAlt"></span>&nbsp;</td>
 +
<td width=46>[[image:BackToTop.png|link=#top|alt=Top|Top]]</td>
 +
<td width=75>[[image:NextUp.png|link=#stepString|alt=Next Up|Top]]</td>
 +
<td width=75>&#160;</td>
 +
<td width=75>[[image:BackToBottom.png|link=#bottom|alt=Bottom|Bottom]]</td>
 
</tr>
 
</tr>
</table>
+
</table> <!-- END Nav Buttons Table -->
  
 
='''Alternatives to the Message Popup Rule'''=
 
='''Alternatives to the Message Popup Rule'''=
Line 443: Line 467:
 
<td width=729><span id="bottom"></span>&nbsp;</td>
 
<td width=729><span id="bottom"></span>&nbsp;</td>
 
<td width=46>[[image:BackToTop.png|link=#top|alt=Top|Top]]</td>
 
<td width=46>[[image:BackToTop.png|link=#top|alt=Top|Top]]</td>
<td width=75>[[image:NextUp.png|link=#stepString|alt=Next Up|Top]]</td>
+
<td width=75>[[image:NextUp.png|link=#stepAlt|alt=Next Up|Top]]</td>
 
<td width=75>&nbsp;</td>
 
<td width=75>&nbsp;</td>
 
<td width=75>&nbsp;</td>
 
<td width=75>&nbsp;</td>

Revision as of 08:27, 20 September 2023

The information in this Wiki Page applies to TANE, TRS19, Trainz Plus and TRS22. This page describes how to configure the Message Popup Rule.

LinkWiki.PNG

For examples of how to use this rule in Sessions see the Trainz Wiki Page at:-


Contents

 Workflow Diagram 
Workflow diagram
  Top   Next Down Bottom

Add a Message Popup Rule

DotPoint.JPG The Message Popup Rule is a Trainz Session Rule that creates onscreen messages for users in Driver Mode.


The Message Popup Rule is added to a Session and configured using the WikiLink.PNG Session Editor in Surveyor. The rule will open a browser window on the screen in Driver Mode that will remain on the screen until it is closed by the user or by another rule.


There are three ways the message window can be created:-
Options: Choose one of:-
Ablue.png with a Custom Message - the quickest and easiest method, OR
Bblue.png with a HTML (Web) Page - the most complicated method but it often gives the best results, OR
Cblue.png with a String Table Message


  Top Next Up Next Down Bottom

Using a Custom Message

The settings shown in this example will direct Trainz to load the message from text entered in the Custom Message box.

MessagePopup3.JPG
NotePad.PNG Notes:

DotPoint.JPG No knowledge of HTML is required for this option
DotPoint.JPG You can select and display an optional icon with the message
DotPoint.JPG You are no longer limited in the number of lines of text you can add. Although the popup window will only show 7 lines, a vertical scroll bar will appear for longer messages
DotPoint.JPG Text only can be entered (box cannot be left blank). Some HTML markup is acceptable, for example italic and bold tags


LinkWiki.PNG

For more information, see the Trainz Wiki Page at:-



Gears.PNG Settings: Shown in the example above:-

PortalOptionButtonFilled.PNG Custom text

CheckBoxOff.PNG Pause game while message is displayed - game play will not be paused
CheckBox.PNG Close previous message popup windows - this is usually a good idea unless you want multiple message windows open
Message location: Top left of the screen has been chosen as the location for the message window. Other positions are Top right, Bottom left and Bottom right
Custom Message - the message entered into the text box will be displayed
Icon - the selected optional icon will be displayed
No optional sound has been added


MessagePopup2a.JPG The custom message popup created by the example shown above


PencilTips.PNG To find additional graphic icons that can be added to the Message Popup window, use Content Manager and set a Custom Filter to search for:-
DotPoint.JPG Category select Texture- Not Environmental
DotPoint.JPG Name type icon
DotPoint.JPG On Download Station select True
Not all those shown will be suitable. Double Left Click on a possible icon to display its details before downloading


LinkWiki.PNG

For information on how to create your own Message Popup Icons, see the Trainz Wiki Page at:-

  Top Next Up Next Down Bottom

Using a HTML Page

The settings shown in this example will direct Trainz to load the message from a HTML file in a HTML asset.

MessagePopup1.JPG
NotePad.PNG Notes:

DotPoint.JPG Knowledge of HTML, as used by Trainz, will probably be required for this option
DotPoint.JPG The HTML page (with filename extension ".html") must be in a Trainz asset of type HTML
DotPoint.JPG Graphics and a limited set of HTML effects are possible
DotPoint.JPG The sound file settings HTML Wave and Wave Name are optional
DotPoint.JPG If a sound file is to be played when the message is displayed then it must be of type WAV (with filename extension ".wav") and must be in a Trainz asset of type HTML. It does not have to be in the same HTML asset as the HTML page


LinkWiki.PNG

For more information, see the Trainz Wiki Page at:-



Gears.PNG Settings: Shown in the example above:-
PortalOptionButtonFilled.PNG A pre-defined HTML page (advanced)
CheckBox.PNG Pause game while message is displayed - this will halt the game play until the window is closed. This may be needed if you have a long introductory HTML information page, otherwise leave unchecked
CheckBox.PNG Close previous message popup windows - this is usually a good idea unless you want multiple message windows open
Message location: Top left of the screen has been chosen as the location for the message window. Other positions are Top right, Bottom left and Bottom right
HTML Asset: General Purpose Session HTML one of the HTML assets installed with Trainz
HTML Page: right_away.html which is a HTML file inside the General Purpose Session HTML asset
HTML Wave: General Purpose Session HTML HTML asset contains the optional sound file to be played
Wav Name: all-aboard.wav is the optional sound file to be played
CheckBox.PNG Autoplay Wav - the sound will be played when the page is displayed

  Top Next Up Next Down Bottom

Using a String-Table Message

The settings shown in this example will direct Trainz to load the message from text stored in the config.txt string table of a specified HTML asset.

MessagePopup4.JPG
NotePad.PNG Notes:

  • The config.txt file of the HTML asset must have a string-table container which holds all the text messages to be displayed.
  • The string-table token is the "tag" which identifies the message text in the config.txt file.



Gears.PNG Settings: Shown in the example above:-
PortalOptionButtonFilled.PNG A pre-defined string-table entry from a HTML asset (advanced)
CheckBoxOff.PNG Pause game while message is displayed - game play will not be paused
CheckBox.PNG Close previous message popup windows - this is usually a good idea unless you want multiple message windows open
Message location: Top left of the screen has been chosen as the location for the message window. Other positions are Top right, Bottom left and Bottom right
HTML Asset: General Purpose Session HTML one of the HTML assets installed with Trainz
String Table Token: html_warning_late the string table token in the config.txt file of the General Purpose Session HTML asset contains the message to be displayed
HTML Wave: General Purpose Session HTML HTML asset contains the optional sound file to be played
Wav Name: all-aboard.wav is the optional sound file to be played
CheckBox.PNG Autoplay Wav - the sound will be played when the page is displayed

For example, the config.txt file of the asset General Purpose Session HTML contains the following:-

string-table
    {
        html_warning_late       "You are running late!"
    }

...which will produce the message "You are running late!" from the Message Popup Rule settings shown above.

LinkWiki.PNG

For more information, see the Trainz Wiki Page at:-

  Top Next Up   Bottom

Alternatives to the Message Popup Rule

RulesWiki.PNG There are other HTML message window rules that are alternatives to the Message Popup rule. A few possibilities are:-


Related Links

LinkWiki.PNG
  Top Next Up    


Trainz Wiki

TrainzWiki.png

More Tutorials and Guides to Using Trainz


This page was created by Trainz user pware in April 2018 and was last updated as shown below.


Personal tools