In the tutorial scenario I found a problem when counting vehicles outside the depot, something seems to have broken when the schedule window was updated. https://forum.simutrans.com/index.php/topic,20444.msg194610/topicseen.html#msg194610 (https://forum.simutrans.com/index.php/topic,20444.msg194610/topicseen.html#msg194610)
It seems to be related to "is_work_allowed_here (pl, tool_id, pos)", since this happens when said function returns a message while editing the schedule.
This is how I count the vehicles:
function checks_all_convoys()
{
local cov_list = world.get_convoy_list()
local cov_nr = 0
foreach(cov in cov_list) {
if (!cov.is_in_depot())
cov_nr++
}
return cov_nr
}
To recreate use my attached test script and follow the steps below:
- Build a depot and route a vehicle, make an intentional click on something that is not "way / track" to display the text "Message test".
- Close the vehicle window and you will see that the vehicle is counted as if it left from the depot.
Note: I have left a vehicle counter in the scenario window right in the results.
This has nothing to do with the script. Thanks for your report.