Now we are ready to use the sound file in our HTML Asset in a Trainz session.
I'll assume you have some familiarity with Surveyor and know how to place objects and such. This will be a bit long but I've made screenshots to help you out. Go step by step and you'll be able to do this.
Fire up Trainz, go to Surveyor and start a new session. I'm using the Wilson Mills & Mount Olive Route in this example as it includes several passenger stations.
Find the location on the tracks where you want the sound file to play. I'll put mine next to a passenger station.
Next we need to place a trigger on the track where we want the sound to play. Select the Track flyout, then click the Trackmark Mode button. Select Trigger and place it on the track.
A dialog box will pop up that will show the name of the trigger as assigned by Trainz. In my exmaple, I'll use the default of "Trigger 1". You can change the name to anything you like. If you have many triggers in a session, you'll want to avoid confusion by coming up with a naming scheme so you know what each trigger is to be used for.
This is how it looks in Surveyor. I've placed a loco and cars on the track before the station. The trigger is placed right before the station platform.
Click the "Edit Session Rules" button - upper left, button in the middle.
This is what the Session Rules window will look like. (I've deleted a few of the default rules to make this clearer).
At the bottom of the Session Rules window click ADD. This brings up a dialog box with all the available Rules you can choose from. Scroll down and click on "Trigger Check". Click on the checkmark button to add the Rule.
Note there is another rule called "Trigger Rule". That is a old version, like from TRS2004. I use Trigger Check as it has some additional useful options.
You should see this:
Note: You can move a Rule up and down in the window by highlighting the rule and using the UP and DOWN arrow buttons at the bottom of the Session Rules window.
Click on the Trigger Check rule to highlight it, then click on the EDIT button at the bottom of the Session Rules window.
Now we can set all the criteria for this Rule.
You should see this:
Click on Add Trigger. You'll get a list of all the triggers available in this session and route. Select "Trigger 1" and click the checkmark button.
Now we have this:
Note there are several options listed.
Checking "Trigger only once" means the trigger will be activated one time when the first train crosses it and not ever again in the session. Leaving it unchecked means the rule will activate on every train that crosses it.
The "wait for child rules" is for advanced, complicated sessions. Leave it unchecked.
You can choose to only trigger the rule if a train is running forward or backwards into the trigger. Only useful occasionally in very complicated sessions. Leave it unchecked.
"Accept all trains" is the default and will activate the rule when any train crosses the trigger.
If you choose "Accept trains matching specific criteria" you can choose to only have this rule activate when a specific vehicle (loco or traincar), driver or type of car crosses the trigger. This can be useful if you want this sound to play only, for example, when the players train crosses the trigger and not when the AI trains cross it.
To make this simple, leave the options at they are (top three unchecked, Accept All Trains).
Finally, note that you can add multiple triggers to this rule. If you want this sound to play at all 10 stations on a route you can place a trigger at each station then add all 10 triggers to the rule.
Click on the checkmark button in the lower right to save all your changes.
Now we've added all the criteria to the Trigger Check rule. Here is what the Session Rules window looks like. Note the Trigger Check rule now shows which triggers it is assigned to check.
Now we'll add the rule to play the sound.
At the bottom of the Session Rules window click ADD. Scroll down and select "Play Sound" and click the checkmark button.
Use the UP and DOWN arrow buttons to move the Play Sound rule underneath the Trigger Check rule. Play Sound MUST be directly underneath Trigger Check!
You should see this:
Now click on the Play Sound rule to highlight it. At the bottom of the Session Rules windows click the RIGHT arrow button to indent the Play Sound rule.
You should see this:
What indenting does is make the Play Sound rule a "child rule" of the parent rule above it (Trigger Check). This means Play Sound will only run if all the criteria of the Trigger Check rule have been met.
Those that know computer languages will recognize this an IF-THEN situation. If Trigger Check is true, THEN Play Sound.
Non-computer geeks can think of it like a parent-child relationship. The child rule can only activate if the parent says it's OK.
For example, if Trigger Check is set to only accept a train driven by the "Adair" driver and a train with any other driver assigned crosses the trigger - then Trigger Check will not run Play Sound because all the criteria were not met. When the train with Adair assigned to it crosses the trigger, then Trigger Check will allow Play Sound to run because all criteria were met in that case.
This is a key concept to understand. The child rule (Play Sound) only runs when the parent rule (Trigger Check) gives it permission. I hope I made that clear to the non-computer geeks among us.
---- continued in Part Two ----