View Single Post
  #1  
Old 04-09-2006, 02:00 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Rar @ 1,000 onActions!

Ok, im working on a Inventory but Ive encountered somewhat of a *problem*. Let me show you:


PHP Code:
... Some script ...

    new 
GuiScrollCtrl"InventoryScroll" ) {
      
height 149width 32 + (32 8)*10;
      
12175;
      
hscrollbar "dynamic";
      
vscrollbar "alwaysOff";
 
      for (
0clientr.Weapons.size(); ++) {
        
tokens clientr.Weapons[i].tokenize(";");
        new 
GuiBitmapButtonCtrl"InventoryButton" i) {
          
16 + (32 8)*i16;
          
width 32height 32;
          
mouseoverbitmap tokens[1];
          
normalbitmap tokens[1];
          
pressedbitmap tokens[1];
        }
      }
    } 

Is there another way to make it check if an icon is pressed rather then doing like this for each slot:

PHP Code:
//UGH!
function InventoryButton0.onAction()
{
  
player.chat "PRESSED 0!";
}

function 
InventoryButton1.onAction()
{
  
player.chat "PRESSED 1!";
}

function 
InventoryButton2.onAction()
{
  
player.chat "PRESSED 2!";
}

etcetc.. 

I just HATE alot of basicly exactly the same functions!
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote