The International Simutrans Forum

Development => Scripting Scenarios and AI => Topic started by: Yona-TYT on June 15, 2020, 09:23:00 AM

Title: [command] Initialization error when the way is from the public service.
Post by: Yona-TYT on June 15, 2020, 09:23:00 AM
If for example you try to build a bridge with a human player and there are public service tracks on both ends, command_x fails.
    local t = command_x(tool_build_bridge)
    t.set_flags(2)       
    local err = t.work(player_x(0), coord3d(126,193,-1), coord3d(126,195,-1), "ClassicRoad")

(https://www.mediafire.com/convkey/9526/qjo6xf193uoaqup6g.jpg)
Title: Re: [command] Initialization error when the way is from the public service.
Post by: Dwachs on June 15, 2020, 03:34:14 PM
This error is thrown only if the initialization step fails. Here, it means that the bridge-object parameter is wrong (or the bridge is not available due to timeline restrictions, which is the case for ClassicRoad).
Title: Re: [command] Initialization error when the way is from the public service.
Post by: Yona-TYT on June 16, 2020, 03:01:41 AM
Quote from: Dwachs on June 15, 2020, 03:34:14 PMThis error is thrown only if the initialization step fails. Here, it means that the bridge-object parameter is wrong (or the bridge is not available due to timeline restrictions, which is the case for ClassicRoad).
Yes, that was the problem, thanks!. 8)
Title: Re: [command] Initialization error when the way is from the public service.
Post by: Dwachs on June 16, 2020, 05:30:00 AM
you could also use the build_bridge command. It will give more useful error messages