PenUltima Online

It is currently Wed Aug 20, 2008 2:36 pm

All times are UTC - 4 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Finding out what tile your standing on
PostPosted: Thu Jan 24, 2008 7:01 pm 
Offline

Joined: Fri Apr 14, 2006 1:36 pm
Posts: 240
I am making a script that requires you to be on a specific tile, so that if it is the correct tile they are allowed to do this specific action, any ideas how to do this?




Also how do I(when they double click a deed I want it to ask them for text input) how would I do this?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 24, 2008 10:23 pm 
Offline

Joined: Sat Feb 04, 2006 10:26 pm
Posts: 533
Depends on whether you are looking for a static item or a map tile.
I assume you mean a map tile.
Take a look at this piece of code after you have set a location (eg with Targetcoordinates):
Code:
var info := GetMapInfo(mining_loc.x , mining_loc.y, mining_loc.realm);
if ( IsSwampTile(info.landtile) )
// code for having selected a swamp tile
endif

function IsSwampTile(theobjtype)
   if ( theobjtype >= 0x3d65 and theobjtype <= 0x3ef0 )
      return 1;
   elseif ( theobjtype >= 0x3209 and theobjtype <= 0x324a )
      return 1;
   else
      return 0;
   endif
endfunction


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 24, 2008 11:08 pm 
Offline

Joined: Fri Apr 14, 2006 1:36 pm
Posts: 240
OldnGrey wrote:
Depends on whether you are looking for a static item or a map tile.
I assume you mean a map tile.
Take a look at this piece of code after you have set a location (eg with Targetcoordinates):
Code:
var info := GetMapInfo(mining_loc.x , mining_loc.y, mining_loc.realm);
if ( IsSwampTile(info.landtile) )
// code for having selected a swamp tile
endif

function IsSwampTile(theobjtype)
   if ( theobjtype >= 0x3d65 and theobjtype <= 0x3ef0 )
      return 1;
   elseif ( theobjtype >= 0x3209 and theobjtype <= 0x324a )
      return 1;
   else
      return 0;
   endif
endfunction



Actually I mean a static item


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 24, 2008 11:40 pm 
Offline

Joined: Sat Feb 04, 2006 10:26 pm
Posts: 533
Have you tried using the ListStaticsAtLocation function?

Assuming you are character, and because there can be more than 1 item on your square, you can do something like:

Code:
foreach static in ListStaticsAtLocation(character.x, character.y, character.z, ITEMS_IGNORE_MULTIS, character.realm)
var value := static.objtype
if ( static.z == character.z )
// this is a tile the player is on at the same height ......... do stuff
endif
endforeach


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 24, 2008 11:54 pm 
Offline

Joined: Fri Apr 14, 2006 1:36 pm
Posts: 240
Nevermind got it


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 4 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl