Posted: Thu Jan 24, 2008 7:01 pm Post subject: Finding out what tile your standing on
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?
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
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
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