Thread: Coordinates..

Results 1 to 4 of 4
  1. #1 Coordinates.. 
    Registered Member

    Join Date
    Jun 2009
    Posts
    1,076
    Thanks given
    308
    Thanks received
    389
    Rep Power
    341
    Is there a formula to get the regionX coordinate when all I'm given is the localX coordinate?

    Thanks, Peril.
    Reply With Quote  
     

  2. #2  
    Icy Realm Owner
    Icy Whip's Avatar
    Join Date
    May 2007
    Posts
    1,419
    Thanks given
    30
    Thanks received
    35
    Rep Power
    213
    Quote Originally Posted by Peril View Post
    Is there a formula to get the regionX coordinate when all I'm given is the localX coordinate?

    Thanks, Peril.
    like this?

    Code:
    			else if (Command.startsWith("coords"))
    			{
    				try
    				{
    					sendMessage("absX = " + absX + ", absY = " + absY);
    					sendMessage("currentX = " + currentX + ", currentY = " + currentY);
    					sendMessage("mapRegionX = " + mapRegionX + ", mapRegionY = " + mapRegionY);
    				}
    				catch(Exception e)
    				{
    					sendMessage("::coords");
    				}
    			}


    Signature made by Mr. Ervis

    Any questions, MSN me; [email protected]
    Reply With Quote  
     

  3. #3  
    Registered Member

    Join Date
    Jun 2009
    Posts
    1,076
    Thanks given
    308
    Thanks received
    389
    Rep Power
    341
    Quote Originally Posted by icey69 View Post
    like this?

    Code:
    			else if (Command.startsWith("coords"))
    			{
    				try
    				{
    					sendMessage("absX = " + absX + ", absY = " + absY);
    					sendMessage("currentX = " + currentX + ", currentY = " + currentY);
    					sendMessage("mapRegionX = " + mapRegionX + ", mapRegionY = " + mapRegionY);
    				}
    				catch(Exception e)
    				{
    					sendMessage("::coords");
    				}
    			}
    ....Sigh....
    Reply With Quote  
     

  4. #4  
    Registered Member
    Its paris's Avatar
    Join Date
    Apr 2009
    Posts
    1,141
    Thanks given
    56
    Thanks received
    234
    Rep Power
    689
    Depends on how big your region is.
    Should be something like:
    Code:
    regionCoordinate = (int)(absoluteCoordinate / regionSize);
    The result should be a floored number (if downcasting to int truncates the decimals or if it uses the known rules to ceil or floor the number).
    If your regionsize is 8, you would do:
    Code:
    regionCoordinate = (int)(absoluteCoordinate / 8);
    Or, since 8 is 2 ^ 3:
    Code:
    regionCoordinate = absoluteCoordinate >> 3;
    If it were to be 32 (2 ^ 5):
    Code:
    regionCoordinate = absoluteCoordinate >> 5;
    You get what I mean, in Hyperion I got this:
    Code:
    regionCoordinate = absoluteCoordinate >> 3) - 6;
    Don't ask me what the -6's for because I have no idea. If anyone knows, please tell me.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •