The International Simutrans Forum

Development => Scripting Scenarios and AI => Topic started by: Yona-TYT on March 22, 2017, 03:45:54 AM

Title: Get coordinates when constructing roads/ways.
Post by: Yona-TYT on March 22, 2017, 03:45:54 AM

I'm trying to mark the edges of the roads at the time of building, but the problem is that I do not get a practical way to get the start and end coordinates.

I have tried using the "is_work_allowed_here" function, but it is impossible to know if the roads was built or not.
Title: Re: Get coordinates when constructing roads/ways.
Post by: Dwachs on March 22, 2017, 07:28:48 AM
I am not sure whether I understood right: You want to mark the start and end tiles after a player has built a way in the tutorial?
Title: Re: Get coordinates when constructing roads/ways.
Post by: Yona-TYT on March 22, 2017, 02:06:44 PM
Quote from: Dwachs on March 22, 2017, 07:28:48 AM
I am not sure whether I understood right: You want to mark the start and end tiles after a player has built a way in the tutorial?
Yes, but it is difficult to determine, for example when clicking there is no way to differentiate whether it was built or not.
Title: Re: Get coordinates when constructing roads/ways.
Post by: An_dz on March 22, 2017, 03:27:45 PM
You probably can check after the click if there's a way on that tile now.
Title: Re: Get coordinates when constructing roads/ways.
Post by: Yona-TYT on March 23, 2017, 03:21:19 AM
Quote from: An_dz on March 22, 2017, 03:27:45 PMYou probably can check after the click if there's a way on that tile now.
I'm trying to mark the edges automatically when building paths, but I can only get start and end coordinates with "is_work_allowed_here", this means that the coordinates are obtained before the road is built. This gives problems when you click without building anything.
You can try the attached sctipt.

Tutorial-test2.zip (http://www.mediafire.com/file/v3qgw2h2pk928xq/Tutorial-test2.zip)