Gettype();
by Gavin Beard · in Torque Game Builder · 03/28/2005 (10:51 am) · 3 replies
Hey ya,
when i do a dump() for a fxtilelayer2d i i see a command call gettype, which isnt documented, there is a gettiletype documented but they both seem to do the same thig, return 0.
can n e one confirm if
function sceneWindow2D::onRightMouseUp( %this, %modifier, %worldPosition, %mouseClicks )
{
echo($baselayer.gettype($baselayer.picktile(%worldposition));
}
or
function sceneWindow2D::onRightMouseUp( %this, %modifier, %worldPosition, %mouseClicks )
{
echo($baselayer.gettiletype($baselayer.picktile(%worldposition));
}
should actually work? as i just get 0.
thanks
when i do a dump() for a fxtilelayer2d i i see a command call gettype, which isnt documented, there is a gettiletype documented but they both seem to do the same thig, return 0.
can n e one confirm if
function sceneWindow2D::onRightMouseUp( %this, %modifier, %worldPosition, %mouseClicks )
{
echo($baselayer.gettype($baselayer.picktile(%worldposition));
}
or
function sceneWindow2D::onRightMouseUp( %this, %modifier, %worldPosition, %mouseClicks )
{
echo($baselayer.gettiletype($baselayer.picktile(%worldposition));
}
should actually work? as i just get 0.
thanks
#2
edit Figured it, not sure what it was i just deleted the function and re did it, now it returns all the correct tile numbers, so i know what each tile is (i.e i get "static tileset 3") so i know it is tile number 3 from my tileset, now i have a function that when the map is loaded it scans all the tiles in the layer and adds custom tile info used for my path finding :)
03/28/2005 (1:02 pm)
Kinda, lol. there is a tile there as the baselayer is completely covered in tiles, picktile i already checked and is returning the correct tile, cant really see what is wrong, but hey, as you say, must be something else :Sedit Figured it, not sure what it was i just deleted the function and re did it, now it returns all the correct tile numbers, so i know what each tile is (i.e i get "static tileset 3") so i know it is tile number 3 from my tileset, now i have a function that when the map is loaded it scans all the tiles in the layer and adds custom tile info used for my path finding :)
Associate Melv May
If you look in "simBase.h" (class SimObject: public ConsoleObject), you will find the sub-object that is part of all T2D objects.
Your second function would return any tile info (the first one doesn't make sense). You should really check on the return values of "pickTile()" before feeding them into other functions, this is just safe practice. You will of course get nothing if there is no tiles defined under worldposition.
This does work because it is what the tile-editor uses to select tiles so something else must be going wrong here.
Hope this helps,
- Melv.