View Single Post
  #1  
Old 04-01-2007, 11:13 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Algorithm for warping

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.onRightMouseDownddxdyclicks )
{
  
temp.coords Map_Window.globaltolocalcoord( { dxdy } );
  
  
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;
    
screenwidth - ( width );
    
screenheight - ( height );
  } 
Thanks a TON!
__________________
Reply With Quote