3D Studio Max Locomotive Interior Tutorial

Chapter 6 Setting up the Config.txt file

In this tutorial you will learn how to create a working Config.txt file for the interior.

For editing the text files I use a program called Context. You can use Notepad or any other text editor.

1. Config entries

In the following table the required entries for the interior and a brief description are shown. There are many more possibilities for TRS2004 than what is shown here.

Create a new text document from within your selected text editor and enter the following information.

Config.txt entry Description
kuid <KUID2:86105:55999:0> This is the kuid number. Replace the "86105" with your user number and replace the15000 with a suitable number for your item. The recommended range for a locomotive is 1-9999. Although the kuid range is no longer a requirement I still prefer to keep my numbers within these ranges. The last number represents the version number for the item.
username Tutorial Interior This is the name that will show up if any errors arise and is TrainzObjectz. Give the interior a meaningful title but keep it short as possible.
kuid-table {
}
This tells the download station what items are required for the locomotive to work. It can also be used for mesh replacement, texture replacement etc
kind interior This tells Trainz that the kind is an interior and not a scenery or track item.
category-class ZI This will allow the content to be sorted by the category class. ZI is a train part interior.
category-region-0 US This is the region the locomotive was used in. If there is more than one country required then you can add category-region-1 on the next line.
category-era-0 2000 This is the years that the item is used in. As with the region category you can have more than one.
description "Tutorial on how to create a Locomotive interior" This is a description about the locomotive. It can be brief or very detailed.
asset-filename Tutorial_Interior This is the folder that the meshes and the textures are contained in.(See previous chapter)
cameralist
{
camera0 -0.984,0.332,0.690,0.051,-0.117
}
This is the in cab viewing locations. You can have as many of these as you need
cameradefault 0 This tells TRS which of the above views to use when first entering the cab.

mesh-table
{
default
{
mesh SD70MACBNSF_interior.im
auto-create 1
}

This is the mesh table. In this table you can reference items such as animation and other attachments. Animated items can also be controlled via the use of a script.

This is also where you add the setup for levers and gauges

speedo_needle {
kind needle
auto-create 1
mesh Needle.im
att a.needle0
limits 0, 50
angles -0.78525, 0.78525
att-parent default
}
This is a typical setup for a speedo needle gauge.

bplocomain_needle {
kind needle
auto-create 1
mesh Needle.im
att a.bplocomain_needle
limits 0,50
angles -0.78525, 0.78525
att-parent default
}

This is a typical setup for a main brake pressure needle gauge.

throttle_lever {
kind lever

auto-create 1
mesh throttle_lever.im
att a.throttle_lever

limits 0,8
angles 0.698, -0.698
notches 0,0.125,0.25,0.375,0.5,0.625,0.75,0.875,1
notchheight 1,1,1,1,1,1,1,1,1
radius .2
att-parent default
}

This is a typical setup for a throttle lever.
reverser_lever {
kind lever
auto-create 1
mesh Reverser_Lever.im
att a.reverser_lever
limits 0,2
angles 0.525, -0.525
notches 0,0.5,1
notchheight 1,2,1
radius .2
att-parent default
}
This is a typical setup for a reverser lever.

trainbrake_lever {
kind lever
auto-create 1
mesh Automatic_Brake.im
att a.automatic_brake
limits 0,4
angles 0.698, -0.698
notches 0,0.18,0.22,0.26,0.29,0.3,0.34,0.38,0.42,0.45,0.49,0.53,0.57,0.61,0.65,0.91,1
notchheight 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
radius .2
att-parent default

}

This is a typical setup for a trainbrake lever.
} This bracket closes the entire mesh table. Leaving this out will cause undesirable results.
obsolete-table {
}
This setting is for previous versions that you want to obsolete.
trainz-build 2.2 This tells the download station which version of Trainz the item is for which in this case is TRS2004 SP2

Once you have the text entered save the file to the root directory of the locomotive. In this case the folder is called Tutorial_Interior and name the file config.txt

NOTE Do not copy and paste from this tutorial. If you are having trouble with the interior not showing up then you can download a working config.txt file here.

 

2. Viewing in Trainz

Once you have the config created and saved then it is time to see if our locomotive will show up in Trainz. Before we start trainz up we need to edit the settings in the trainzoptions.txt file. Open the TRS2004 directory and open the trainzoptions.txt file. Enter the following line on its own line

-freeintcam

You could also use TrainzObjects to enter the setting. Save and close the file and then navigate to the tutorial_loco and open the config file. Find the line

interior <KUID:-1:101475>

and change it to

interior <KUID:86105:55999>

Replace the 86105:55999 with the number you have used for your interior. Save and close the file and start Trainz up and go to surveyor. The loco should be listed as Loco Tutorial. Add the loco to a suitable track location and switch to driver. Switch to the interior view and using the Page Up, Page Down and the arrow keys find a suitable viewing location and either write the values down that appear at the bottom left of the screen or hit the screenshot key. This is the value for the camera list. If you want more than one camera location then continue panning around and writing down the camera locations.

 

3. Settings

Now that we have had a look in trainz and seen that everything works the way it should levers and gauges etc we need to have a closer look at the gauge and lever blocks and see what each line does and how to customize them for your own situation.

speedo_needle { This line is the name of the effect block. In this case it is a default name with predefined actions. If you are using script to control your gauges then you can name this anything you want.
kind needle This tells TRS that it is a needle effect and as such it adopts the needle actions
auto-create 1 This line tells TRS that the object should be created when the rest of the interior is created and should appear without the need for script to make it show up.
mesh Needle.im Name of the mesh file for the needle
att a.needle0 Name of the attachment point for the needle
limits 0, 50 Range of movement steps for the needle. The more steps the smoother the needles movement.
angles -0.78525,0.78525

This is the angular limits of movement in radians. To find these values you need to take the values we calculated in chapter 3. You then need to multiply the values by 0.01745

For example the values we found for the needles were -45 and +45 therefore

45 X 0.01745 = 0.78525 and this value in its positive and negative value are what we add to the config file

att-parent default What the effect is attached to.
} Closing bracket for this effect only.

 

 

throttle_lever { This line is the name of the effect block. In this case it is a default name with predefined actions. If you are using script to control your levers then you can name this anything you want.
kind lever This tells TRS that it is a lever effect and as such it adopts the lever actions
auto-create 1 This line tells TRS that the object should be created when the rest of the interior is created and should appear without the need for script to make it show up.
mesh throttle_lever.im Name of the mesh file for the lever
att a.throttle_lever Name of the attachment point for the lever
limits 0,8

Always equals 1 less than the notch index total
.i.e. Throttle has 9 stops, b limit is 8, reverser has 3 stops, b limit is 2

angles 0.698, -0.698

This is the angular limits of movement in radians. To find these values you need to take the values we calculated in chapter 3 and multiply the values by 0.01745

For example the values we found for the throttle were -40 and +40 therefore

40 X 0.01745 = 0.698 and this value in its positive and negative value are what we add to the config file

If you want the lever to work in reverse then swap these values around.

notches 0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1 These are the locations that the lever will stop at in each movement. For the throttle there are 9 steps, one for zero and one for each notch 1 though to 8. The values must start at 0 and must not exceed 1. Anything above or below 0 or 1 will be ignored. They do not need to be evenly spaced as long as the number of notches and notchheights match there will be no problems.
notchheight 1, 1, 1, 1, 1, 1, 1, 1, 1 This is the length of the red or green lines that appear when the cursor is places over the lever. It is essential that you have exactly the same number of notchheights as there are notches. Failure to do so will result in an error in the log0.htm file.
radius .2 This is the distance in meters from the levers attachment point that the label will appear
att-parent default What the effect is attached to.
} Closing bracket for this effect only.

 

reverser_lever { This line is the name of the effect block. In this case it is a default name with predefined actions. If you are using script to control your levers then you can name this anything you want.
kind lever This tells TRS that it is a lever effect and as such it adopts the lever actions
auto-create 1 This line tells TRS that the object should be created when the rest of the interior is created and should appear without the need for script to make it show up.
mesh reverser_lever.im Name of the mesh file for the lever
att a.reverser_lever Name of the attachment point for the lever
limits 0,2

Always equals 1 less than the notch index total
.i.e. Throttle has 9 stops, b limit is 8, reverser has 3 stops, b limit is 2

angles 0.525, -0.525

This is the angular limits of movement in radians. To find these values you need to take the values we calculated in chapter 3 and multiply the values by 0.01745

For example the values we found for the throttle were -40 and +40 therefore

30 X 0.01745 = 0.525 and this value in its positive and negative value are what we add to the config file

If you want the lever to work in reverse then swap these values around.

notches 0, 0.5, 1 These are the locations that the lever will stop at in each movement. For the throttle there are 9 steps, one for zero and one for each notch 1 though to 8. The values must start at 0 and must not exceed 1. Anything above or below 0 or 1 will be ignored. They do not need to be evenly spaced as long as the number of notches and notchheights match there will be no problems.
notchheight 1, 2, 1 This is the length of the red or green lines that appear when the cursor is places over the lever. It is essential that you have exactly the same number of notchheights as there are notches. Failure to do so will result in an error in the log0.htm file.
radius .2 This is the distance in meters from the levers attachment point that the label will appear
att-parent default What the effect is attached to.
} Closing bracket for this effect only.
 

4. Final Note

Although we have a working loco interior it is by no means complete and there are many items that can be added and configured using scripting. There are many other types of attachments and they are all listed in the Content Creation Guidelines. Texturing is very basic for the interior and a lot more work is required to bring it up to a releasable product.

This type of interior does not use animated levers. Animated levers require either a collision box or a script to control them.

 

Back to chapter titles

 

 

 

Trainz and Trainz Railroad Simulator are trademarks of Auran

Best viewed at 1024 x 768 or higher

Pages best viewed with Cooper and Cooper Black font installed.

Copyright © 2007 P. Campbell. All rights reserved. Revised: June 13, 2007