Is there any command to delete lines? ???
I can think of an idea to solve this: http://forum.simutrans.com/index.php?topic=17140.msg164387#msg164387
But I need to remove lines to achieve it. ;)
Please check r8274
Quote from: Dwachs on July 25, 2017, 07:08:01 AM
Please check r8274
For some reason the "delete()" function can not be used. ???
(http://files.simutrans.com/index.php/apps/files_sharing/ajax/publicpreview.php?x=1440&y=372&a=true&file=erorro_delete.png&t=FOglmT1glMqsDKU&scalingup=0)
I see, 'delete' is a language keyword.. will fix tonight.
Edit: fixed in r8275, renamed to 'destroy'
It does not work as I expected :-[ , I need a function that allows disassociating the line of vehicles to eliminate them.
I need to remove the lines that are not used, but I receive an error message when I remove the vehicle.
code:
function checks_all_line(pl)
{
local list = player_x(pl).get_line_list()
local l_nr = list.get_count()
local line = null
for(local j=0;j<l_nr;j++){
line = list[j]
if (line){
local cov_nr = 0
local cov_list = line.get_convoy_list()
foreach(cov in cov_list) {
cov_nr++
}
if (cov_nr>0)
continue
else {
local sch = line.get_schedule()
local sch_nr = sch.entries.len()
if (sch && sch_nr==0){
line.destroy(player_x(pl))
}
}
}
}
return null
}
(http://files.simutrans.com/index.php/apps/files_sharing/ajax/publicpreview.php?x=1440&y=372&a=true&file=error_vehic_line.png&t=5n2e5qnL9ODHPC7&scalingup=0)
Why would you like to delete a line in a scenario? It can be done: assign all convoys to another line (or destroy them), then destroy the line.
Quote from: Dwachs on July 28, 2017, 06:41:32 AM
Why would you like to delete a line in a scenario? It can be done: assign all convoys to another line (or destroy them), then destroy the line.
I just want to remove the lines that are not used.
Any function to know if the line has associated vehicles ?.
Quote from: Yona-TYT on July 28, 2017, 08:39:05 AM
I just want to remove the lines that are not used.
Imho this is the task of the player.
Quote
Any function to know if the line has associated vehicles ?.
line.get_convoy_list().get_count()==0
It's not working for me. :-[
Script: http://files.simutrans.com/index.php/s/3veHwrenSgcEQun
Savegame: http://files.simutrans.com/index.php/s/L4NXqsHEGABY64W (http://files.simutrans.com/index.php/s/L4NXqsHEGABY64W)
Code: scenario.nut (line 555)
function checks_all_line(pl)
{
local list = player_x(pl).get_line_list()
local l_nr = list.get_count()
local line = null
for(local j=0;j<l_nr;j++){
line = list[j]
if (line){
local cov_nr = 0
local cov_list = line.get_convoy_list()
if (cov_list.get_count()!=0)
continue
local sch = line.get_schedule()
local sch_nr = sch.entries.len()
if (sch && sch_nr==0){
line.destroy(player_x(pl))
}
}
}
return null
}