News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

Create rectangles on the minimap using script.

Started by Yona-TYT, June 07, 2016, 04:06:09 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yona-TYT


This is necessary to map divided into regions... http://forum.simutrans.com/index.php?topic=15388.msg151671#msg151671


But it can also be useful if you need to delimit regions of the map in any scenario.
Playing around with the code i made this:



I did not find how to rotate the map, always mantien a fixed position.
Also not i found as turn this into a function  of script scenario.


      koord tt[4];
      int x1,x2, y1=512, y2, sizx = 168, sizy = 125;
      for(int vv=0;vv<4;vv++) {
         if(vv!=0)y1-=sizy+3;
         x1=0;
         x2=0;
         y2=0;
         for(int cc=0;cc<3;cc++) {
            if(x1!=0)x1=x2+1;
            else x1+=1;
         
            x2 = x1+sizx+1;
            if(vv==0)y2 = y1-sizy-3;
            else y2 = y1-sizy-3;
            koord tt0(x1-1,y1);
            koord tt2(x2,y2);
            tt[1]=koord(tt0.x, tt2.y);
            tt[3]=koord(tt2.x, tt0.y);
            tt[0]=koord(tt0.x, tt0.y);
            tt[2]=koord(tt2.x, tt2.y);
            scr_coord yona[4];


            for(uint i=0; i<lengthof(yona); i++) {
               yona[i]= karte_to_screen(tt[i])+pos;
            }
               
            display_direct_line_dotted( yona[0].x,yona[0].y, yona[1].x, yona[1].y, 5, 5, COL_YELLOW );
            display_direct_line_dotted( yona[1].x,yona[1].y, yona[2].x, yona[2].y, 5, 5, COL_YELLOW );
            display_direct_line_dotted( yona[2].x,yona[2].y, yona[3].x, yona[3].y, 5, 5, COL_YELLOW );
            display_direct_line_dotted( yona[3].x,yona[3].y, yona[0].x, yona[0].y, 5, 5, COL_YELLOW );
            }


         }

Tjoeker

I'd love to be able to divide the map into regions/countries. However, I'd like to draw lines instead of rectangles... (or making multiple rectangles 1 region).
In a normal Simutrans game, this could be optional and is purely visual. and if you could script things for regions in scenarios this would be a huge +1! (as I'm planning a scenario with countries as well :) )

I know borders has been requested before, but I hope this gets reconsideration as this doesn't change gameplay in 'sandbox' mode, but opens up many possibilities for scenarios.

prissi

Drawing lines between coordinates is be easy, the same is done to show for instance industry connections. I think the interface to scenarios would be more difficult.

Yona-TYT

#3
In that case, you could implement a function to mark rectangles directly on the minimap and then send to a "savegame". This might work  ;D .


Then you can use a script so that only the public service can use it.  ;)

Yona-TYT

Quote from: Tjoeker on June 07, 2016, 02:23:55 PM
I'd love to be able to divide the map into regions/countries. However, I'd like to draw lines instead of rectangles... (or making multiple rectangles 1 region).
In a normal Simutrans game, this could be optional and is purely visual. and if you could script things for regions in scenarios this would be a huge +1! (as I'm planning a scenario with countries as well ☺ )

I know borders has been requested before, but I hope this gets reconsideration as this doesn't change gameplay in 'sandbox' mode, but opens up many possibilities for scenarios.



I'm glad your interest in these scenarios  ☺ .
Here the work of map divided into regions and scores of dwachs.
regions.zip

Dwachs

Quote from: Yona-TYT on June 08, 2016, 01:54:26 AM
In that case, you could implement a function to mark rectangles directly on the minimap and then send to a "savegame". This might work  ;D .
I am thinking about a possible implementation. The main problem is to broadcast such information to all clients.
Parsley, sage, rosemary, and maggikraut.

Yona-TYT

#6
You can also use a placeholder to enter the coordinates and a name for the rectangle, this seems easier I think.


Edit.
It would also be good to enter the coordinates with a selection tool, which would be more practical I think.