PHP Code:
new GuiShowImgCtrl( "InvItem_0" )
{
image = "x.png";
width = 32;
height = 32;
x = 10;
y = 10;
this.itemName = "Guns/KABOOM!!!111!!";
thiso.catchevent( name, "onMouseDown", "onItemSelected" );
}
and later something like this:
PHP Code:
function onItemSelected( obj )
{
for(temp.i=0;temp.i<player.weapons.size();temp.i++;)
{
if(player.weapons[temp.i].name == obj.itemName)
{
player.selectedweapon = temp.i;
return;
}
}
}
I believe that will work.