On my custom map script, I need the player to be able to warp (like CTRL + click on classic map). I can't find the algorithm.
I'm using a GuiShowImgCtrl named Map_Window.
The gmap is 32x32 levels wide.
This is what I've got ... it's probably all wrong.
PHP Code:
function Map_Window.onRightMouseDown( d, dx, dy, clicks )
{
temp.coords = Map_Window.globaltolocalcoord( { dx, dy } );
temp.ddx = temp.coords[0];
temp.ddy = temp.coords[1];
temp.wid = Map_Window.width;
temp.rate = ( 538 / 32 ) / 63;
temp.tiles = temp.wid / temp.rate;
temp.posx = ( temp.wid * 32 ) / temp.tiles * temp.ddx;
player.chat = "warpto" SPC temp.posx SPC 30;
I'm only working with x for now. If I can figure that out I can get y to work.
The map image is 538x538 pixels.
Looks like this:
PHP Code:
new GuiShowImgCtrl( "Map_Window" )
{
image = temp.map;
width = 538;
height = 538;
visible = temp.show;
x = screenwidth / 2 - ( width / 2 );
y = screenheight / 2 - ( height / 2 );
}
Thanks a TON!