Hi Paul, I've used the same scheme when converting multiclass mods. It works fine.
You're right, changing .veh files is tiresome, but you can automate things using AutoIt, if you have some (little) knowledge about programming. I've done some small utilities that helped me to change lines in batch, also applying some sort of intelligence to the process, i.e., "if the car has something like *this* in class, take the first n chars and complement with *that*"... you know.
For this, I prefer AutoIt as it has functions to alter .ini files, which are very similar to .veh files in structure. You just have to add a "section definition", i.e., a name enclosed in brackets like [general] at the beginning of the file.
Then, using the ini functions from autoit, you can read, alter, delete, whatever-you-like each line of the veh files very easily.
Since each mod has his own requirements, these utilities aren't very "reusable", but they don't take more than 10 minutes do develop, and they can work out 400+ files in less than 20 secs.
Example: During conversion of the Endurance mod, I found that classes ended up being something like Classes="reiza5, Endurance option1 option2 option3 option4".
Each "option" above was some sort of string, but one of them had the string GT1, or GT2, etc, from a group of no more than 5 possibilities. Then I decided to use it as a basis to automatically group cars togheter.
Then, I wrote the following utility, and used it togheter with this batch file to process every veh under the mod's folder:
batch file:
FOR /r %%G in (*.veh) do enduracers "%%G"
Script lazily made in Autoit (compiled to "enduracers.exe", hence the name used in the batch file):
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <File.au3>
Global $File = $CmdLine[1]
; Read description and category
$description = IniRead($File, "general", "Description", "erro")
$driver = IniRead($File, "general", "Driver", "erro")
$category = IniRead($File, "general", "Category", "erro")
$classes= IniRead($File, "general", "Classes", "erro")
;Sets new Class
if $classes <> "erro" Then
$counter = 0
$limit = StringLen($classes)
$newclasses = '"'
For $i=1 to $limit step 1
if stringmid($classes, $i, 1) == " " then
$counter = $counter + 1
if $counter = 3 then
$newclasses = $newclasses & '"'
ExitLoop
Else
$newclasses = $newclasses & ","
EndIf
Else
$newclasses = $newclasses & stringmid($classes, $i, 1)
EndIf
Next
IniWrite($File, "general", "Classes", $newclasses)
EndIf
;Sets new description
;First 5 chars define realfeel entry
;I want the fourth element from class (i.e., GT1, GT2, LP1, etc)
$aDesc = StringSplit($newclasses, ",") ; Split the string of classes using the delimeter "," and the default flag value.
;The 4th value is our target
$limit = stringlen($aDesc[4])
$rf = "ES_GR"
Switch StringMid($aDesc[4], 1, $limit-1)
Case "ES_GT1"
$rf = "ESGT1 "
Case "ES_GT2"
$rf = "ESGT2 "
Case "ES_P1"
$rf = "ES_P1 "
Case "ES_P2"
$rf = "ES_P2 "
Case "ES_LMPC"
$rf = "ESLMP "
EndSwitch
$newdescription = '"' & $rf & $description & '"'
IniWrite($File, "general", "Description", $newdescription)
How it worked:
Every time the batch file found a veh file, it took his name and passed this as a parameter to the script above (compiled to an .exe using Autoit compile function), which in turn did his magic, reading the information, selecting the right piece of it and rewriting the classes, also adjusting description strings to support realfeel (ESGT1, ESGT2, etc).
To have the [general] section inserted into the veh files, I used the minised-gui.exe app made by Grumbel and changed the first line of every veh file (which is a common commentary string) to "[general]" without quotes.
Ten minutes thinking, five minutes coding, 20 secs converting. Well worth it.
Note: the code above is provided as an example only, don't use it without adjusting it to your scenario, as it may probably mess your mod.