Why doesn't player_x.create_line() return a line_x object? I suppose you can locate the newly created line by searching player_x get_line_list(). What's the best way to identify it in that list? Is it guaranteed to be the last one in the list?
pl.create_line(wt_rail)
// find the line - it is a line without schedule and convoys
local list = pl.get_line_list()
foreach(line in list) {
if (line.get_waytype() == wt_rail && line.get_schedule().entries.len()==0) {
// right type, no schedule -> take this.
c_line = line
break
}
}
This is not possible in the code. The code that actually creates the line does not know about the script, and does not know which script to call back with the new line. So we have to live with that inconvenience.
Of course such functionality can be implemented, but this would require some amount of work.
It would be great to improve this, I would love several scripts with this. 8)