Page 1 of 1

Finding out what tile your standing on

Posted: Thu Jan 24, 2008 3:01 pm
by Poi
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?

Posted: Thu Jan 24, 2008 6:23 pm
by OldnGrey
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: Select all

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

Posted: Thu Jan 24, 2008 7:08 pm
by Poi
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: Select all

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

Posted: Thu Jan 24, 2008 7:40 pm
by OldnGrey
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: Select all

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

Posted: Thu Jan 24, 2008 7:54 pm
by Poi
Nevermind got it