First, I'd like to say I'm new to Squirrel, and learning the ropes as I go, so excuse my newbieness

I've already managed to find unnamed vehicles since they will always be "Road Vehicle #" for cars, and I did this by getting the list of vehicles, checking each name if it begins with "Road Vehicle"... I can imagine this being quite slow if done on a large number of vehicles though. Does anyone have suggestions as to how I could do this?
Also, I will need to somehow find out the number by the end of the renamed vehicles. It could be done by a regex, for instance with ".*([0-9]+)$" or something similar. I haven't found any pattern matching in the Squirrel language though. If anyone has a clue as to how to do this, please fill me in

Edit: I found out that trying to get the shared vehicles list locks up my OpenTTD. I use the following code:
Code: Select all
local vh_shared = AIVehicleList_SharedOrders(vh);

Cheers,
Hempa