Thank you very much, I have solved it with a "return coord(count_c.x, count_c.y)" ;D
I'm sorry to divert the subject, but now the problem is the coordinates out of range when rotating the map. :-[
(http://files.simutrans.com/index.php/apps/gallery/preview/1089?width=1100&height=1100&c=a86da4e5084aae9e3e346bd5bbb8d5f4&requesttoken=G%2Bp21r0GF%2BGeRGbmF%2F0eVH41YszNT1GMAlVdhts%2B9f0%3D%3AT58lk%2F9DedinBhbRcpBOIAZgO%2FW4PwH1bSdo0bYPss0%3D)
Please stop posting new problems to unrelated threads. Just open a new one.
Map rotation in simutrans rotates all coordinates. I tried hard to hide this from the script side.
Cannot reproduce an error. What steps should I do?
Edit: Did you try to use coord::href?
It seems to only happen on maps with an asymmetric size, try a 64x192 map
to replicate you must rotate the map and use the "select" link to choose a coordinate.
Quote from: Dwachs on April 14, 2018, 08:03:39 AMEdit: Did you try to use coord::href?
function get_goal_text(pl)
{
local goal = ttextfile("goal.txt")
goal.start = "<em>--></em> <a href='script:script_text()'>"+ translate("Select")+"</a>"
goal.c1 = "<a href=\"("+our_coord.x+","+our_coord.y+")\">("+our_coord.x +","+""+our_coord.y+")</a>"
goal.c2 = "<a href=\"("+gl_pos.x+","+gl_pos.y+")\">("+gl_pos.x +","+""+gl_pos.y+")</a>"
goal.miss = ""+miss_list[our_coord.x]+""
return goal.tostring()
}
What exactly is the problem? Please read the documentation of coord::href and coord::_tostring.
I understand that "coord :: href" is to create links, but it's not what I'm looking for, the problem is that this function generates coordinates out of range when I rotate the map:
function check_coord()
{
count_c.y+=gl_c.y/15
if(count_c.y >= gl_c.y){
count_c.x+= gl_c.x/15
}
if(!world.is_coord_valid(coord(count_c.x,0)))
count_c.x=0
if(!world.is_coord_valid(coord(0,count_c.y)))
count_c.y=0
return coord(count_c.x,count_c.y)
}
(http://files.simutrans.com/index.php/apps/gallery/preview/1095?width=1100&height=1100&c=69bbd13ffd6110e022e3d0e8684c6f15&requesttoken=1GRHtned1w9OfhEEyws3B2eZ9pPji9bQ%2FPx9hrb5QLw%3D%3Av0s%2F9CXMsl8jTHUvjyRfNxTUkMGJzePixLAH8sa4cZc%3D)
There was indeed a problem with handling of coordinates on rotated non-square maps. Should be fixed with r 8422. Thanks for the report!
well that solved it!, I suspected that it was an error in the code hehehehe. :D
later I try it ;) .