Saturday, November 24, 2012

Don't worry if you broke the rules... you can change them!

I started writing this post about changing your track rules back in July, and then decided to shelf it when I heard that one of the RW_Tools tutorials already covered search and replace as part of the tool. As the months flew by I started to see a trend even though it was infrequent. Other people were having problems with their track rules as well. Each time I thought I should get back to this post and finish. Not a simple task because later in July my hard drive crashed and the research material was not backed up (among other files like RW screen shots and other temp stuff). The long Thanksgiving weekend and yet another plea for help motivated me to complete this article. I hope it can help others in fixing this messy, but not impossible issue.

This story starts some time in April (2012). All three boys were actually asleep for once so it was a rare moment that I could work on my route. I was changing the speed limits on the main between Alivso and Newark, when I ran into a dreadful issue. I had used two different track rules when I placed one of my special tight curve turnouts and in the process used the same rule for several stretches of track after that. So when I selected a length of track which included this special section I could not change the speed limits. At the time I understood the problem, the track rules were different, but I was avoided thinking about how to fix it. It seemed too 'big' for me. Then my 3D modeling mistress called and the CC was pushed to the back burner.

Lets fast forward to a few months after that. I was working out the route details with Micaelcorleone, and inevitably he found that I broke the track rules, not that I was hiding it but it caused problems for him. It was time to crack open the track rules, figure them out, and fix what I could. You can find your route's track rules in Networks folder Tracks.bin file. For the CC my folder structure looks like this:

The first step is the most time consuming. You need to identify all the different rules you have in your Track.BIN, and copy them to Notepad as you will need these strings for the search replace in the final step. You want to copy the entire '<TrackRule>' section as it will be unique as a search string for replacement.

As it turned out I had five sets of rules in my route. The first was the SP-SF Scalerail track rule, which is the one I thought I wanted (you will see why).

The second was a copy of the SP-SF Scale rail rule I altered to make tighter curves (can you guess what this will become?).

The third was surprising an NEC rule which must have sneaked in when I used the scroll wheel while the control was in focus.

The forth was a SanBar rule... must have been before I got ScaleRail...

The last was a surprised me quite a bit, as I had track without any rule! At the time I had a screen shot of this, but alas it was lost with the crash.

Sorting this all out turned out to be simpler than I imagined, but I had to use RW Tools and its handy multi-line search and replace function. I would copy the TrackRule section I wanted to replace in the top box and the TrackRule section I wanted in the lower, and selected 'Replace All'.

Before I got into the tasks of search and replace, I took a moment to think about what it was that I really wanted for my rules. One of the reasons I did not use my custom rule across the entire route was because the track spacing was too wide. It was actually a bug in the beta SP/SF Scalerail track, and was corrected in the official release. I had used the released SP/SF track and its rule for the greater majority of the route and the only part I needed from my custom rule. The solution again was simple. I needed to clone the release  ScaleRail SP/SF BIN, add my customization for the tight curve radius, and then change all rules using the multiline search replace tool to references my new route specific 'SR_SP_DMV.bin' track rule in my 'Tracks.bin'.

Even though the searching part was the most time consuming the entire operation took less than half an hour to complete. Just remember to keep your search string unique enough so it does not accidentally start replacing other properties of your 'Tracks.bin'. For further reference I would like to direct your attention to the RW_Tools documentation. In this case it talks about replacing sections of track, but the steps are fundamentally the same.

No comments:

Post a Comment