View Single Post
  #13  
Old 05-11-2008, 05:13 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
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.
__________________
Reply With Quote