Tool to create tables in config file

CobraLAD

Member
Hello

Is there a tool that can create your kuid-table & allowed-products with all the spaces, if not I should be able create one.
 
Hello

Is there a tool that can create your kuid-table & allowed-products with all the spaces, if not I should be able create one.
Open up the config.txt of another asset and copy out the container you need and save that to a separate text document.

Going forward, you can then use that saved allowed-products container any time you need it by copying that into your new train car and then editing the container as needed to suit your needs. I've created a folder with all kinds of parts like that such as mesh-tables, track-containers, copies of textures and their related texture.txt files and other parts I may need.

In another folder, I have Trainz tech info where I place copies of various forum posts I find useful such as how to setup iPortals, or repair certain kinds of assets.

Over the years, I've gathered up quite a collection of parts and information that make repairing and creating assets quickly. It's like having a draw with screw drivers, pliers, wire, and other things needed to repair something.
 
CMP in the pre TANE days had a tool that could add most of the containers that you might want to add to an asset. It basically added a generic framework that you then had to customize to suit your needs. I found it pretty useful at times but that might be the only nice thing I can say about CMP.
 
AssetX can create and repair (update) mesh-tables and kuid-tables at least for assets up to and including TANE. It can’t do mesh-tables in later editions using FBX and trainzmesh, but can still do kuid-tables.

We definitely need a config-writing and editing tool for current Trainz editions. If one is to be developed, it will probably be from a user. N3V don’t seem to be interested in providing such tools.
 
When adding your commodities to your assist, you copy the kuid line by line like this

allowed-products
{
0 <kuid:101046:101052>
1 <kuid:101046:101068>
2 <kuid:101046:101060>
3 <kuid:101046:101019>
4 <kuid:101046:101025>
5 <kuid:101046:101042>
6 <kuid:101046:101070>
7 <kuid:101046:101056>
8 <kuid:101046:101047>
}
 
Press the wrong button.🙀
to continue from above
if you must copy long list, it can takes time
So I created in excel a list of the tags with all the space in 1 column and the list of kuids in the next column, combining the columns with a formula, gives you the list with all the spaces.

I want to create a tool, where you just copy all your kuids, and the tool will create the list with all the tags & spaces and add the final list to your clipboard
 
So this tool will be a excel file with macros. I have been creating tools and programs for ± 18 years with Excel. It is very powerful program.
The excel file will add an additional tab on the ribbon called Trainz 'config' Tools (still thinking about a proper name). Suggestions welcome.

For this example, I will be creating a list of 34 containers for a BI3 industry, and a prod?? list to paste to your kuid-table. Also a list for train cars under allowed-products with 1 click

Step 1: Split the description and kuid - completed
First is to copy the list from the CM by selecting all the items you want, press ctrl+c (I know you all know this 😊) and paste the list in excel.

The first button (Split & Sort) will split and sort the list with 1 click. See screenshots below.

Screenshot 1. list copied.
Screenshot 2. 1 click to split, sort & swop (I will add an option not to swop the columns, but this is how I work)

Sceenshot 1
toolstep1_01.jpg


Screenshot 2
toolstep1_02.jpg



next step is to create 34 queues for the 34 items like this with 1 click.

Code:
  queue1
  {
    size                                256
    product-kuid                        <kuid:-3:10014>
    initial-count                       10
   
    allowed-products
    {
    }
  }

to be continued...
 
Hi Cobra,

Great tool !! Is it to possible to split and sort BY KUID, and not only BY NAME as shown on your screenshot ?
Keep up your good (and usefull) work :) ...

Cheers,

Philippe
Hello Philippe
Yes I added the options today and some more. The tool will remember your settings
Will post a short video later, to show how the tool work

toolstep1_03.jpg
 
you gave me something to think about. A standard sort in excel will sort like this

Code:
<kuid:101046:100486>
<kuid:-3:10014>
<kuid:-3:10041>
<kuid:334896:120033>
<kuid:334896:120034>
<kuid:334896:120035>
<kuid:334896:120036>
<kuid:334896:120037>
<kuid:334896:120038>
<kuid:334896:120039>
<kuid:334896:120040>
<kuid:410057:101883>
<kuid:410057:101890>
<kuid2:164988:88088>
<kuid2:164988:88091>
<kuid2:164988:88093>
<kuid2:30671:98906001>
<kuid2:30671:98906002>
<kuid2:30671:98906005>
<kuid2:30671:98906006>
<kuid2:334896:120000>
<kuid2:334896:120001>
<kuid2:334896:120002>
<kuid2:334896:120003>
<kuid2:334896:120004>
<kuid2:334896:120006>
<kuid2:334896:120007>
<kuid2:334896:120008>
<kuid2:334896:120009>
<kuid2:334896:120010>
<kuid2:334896:120027>
<kuid2:334896:120032>
<kuid2:49267:35004>
<kuid2:49267:35005>

This is actually a good sample, some 334896 is on top because of kuid: and some below because of kuid2:

Ideally, it would be better to sort the list out as follows

Code:
<kuid:101046:100486>
<kuid2:164988:88088>
<kuid2:164988:88091>
<kuid2:164988:88093>
<kuid:-3:10014>
<kuid:-3:10041>
<kuid2:30671:98906001>
<kuid2:30671:98906002>
<kuid2:30671:98906005>
<kuid2:30671:98906006>
<kuid2:334896:120000>
<kuid2:334896:120001>
<kuid2:334896:120002>
<kuid2:334896:120003>
<kuid2:334896:120004>
<kuid2:334896:120006>
<kuid2:334896:120007>
<kuid2:334896:120008>
<kuid2:334896:120009>
<kuid2:334896:120010>
<kuid2:334896:120027>
<kuid2:334896:120032>
<kuid:334896:120033>
<kuid:334896:120034>
<kuid:334896:120035>
<kuid:334896:120036>
<kuid:334896:120037>
<kuid:334896:120038>
<kuid:334896:120039>
<kuid:334896:120040>
<kuid:410057:101883>
<kuid:410057:101890>
<kuid2:49267:35004>
<kuid2:49267:35005>
 
Hi Cobra,

Yes excel can't sort kuids automatically . I've done it hundred times in order to produce some listings . It gets confused between kuid and kuid 2, and doesn't recognise ":" as a separator .
In order to succeed, I have to make a column for each part of the kuid number, replace temporarily the ">" by nothing, and then sort by columns, and reintegrate the ">" after the sorting .
This is tedious as hell, this is why I was curious if you managed to do it automaticaly with your macro .

In fact, your second list is better ... but false . The negative kuids are to be rejected at the end of the list, and the 49267: should be before the 410057: , so as the 30671: and 101046: ....

A good sorting shoud be : 1, 2, 23, 235, 349, 3007, 345653, 400001, -25, -3, -1 ...

Cheers,

Philippe
 
Last edited:
Hi Cobra,

Excellent (no pun intented ;) :LOL:) ! ... and the video proof is indisputable : kudo's mate !

Cheers,

Philippe
 
Just an update. I am trying my best to release first part by weekend. "Split & Sort". I am working on fine tuning (not to replace/delete existing data on your sheets) and the help screen. Please bare with me. Only have few hours in evening to work on this.
 
Here is the first release. Trainz 'config' Tool 2024-03-08
1. Split & Sort - completed
2. Combine - completed

For those who is not familiar with macros

A few things you need to know before using this tool
  • Excel macros is not 100% error free. You might get an error message. The split & sort tool will only work if the Kuid & Description is copied from the Content Manager and pasted onto an excel sheet and is selected, otherwise there might be an error as the macros will not find the correct positions where to split. I added a pop-up message “Nothing to do” where you might get an error message, so that you can continue to use the tool. Please let me know if you do get any error messages and what you did to get the message.
  • You need to enable your macro settings if not enabled yet, otherwise you will get an Enable Content message every time you want to use this tool. Please see this link on how to do that. Enable or disable macros in Microsoft 365 files - Microsoft Support. Although it is for 365, it is the same for all versions down to 2010 and maybe even older.
  • There is unfortunately not a 100% working mouse wheel scroll for Excel UserForms. It used to work well with Excel 32bit, but not on 64bit. I will keep looking. You can read all about Userforms here: What is a UserForm in Excel? - TeachExcel.com.
I added a Help also. Apologies for the grammar. English is not my home language.

Hope this tool will help a few people

Below is screen shot of what I am planning with the create section

tool_screenshot1.jpg
 
Back
Top