View Single Post
  #4  
Old 04-11-2006, 02:45 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
It might also be easier if you assign a variable to the object containing the number of the control.

For example:
PHP Code:
new GuiBitmapButtonCtrl( "InventoryButton" @ i) { 
  
x = 16 + (32 + 8)*i, y = 16; 
  
width = 32, height = 32; 
  
mouseoverbitmap = tokens[1]; 
  
normalbitmap = tokens[1]; 
  
pressedbitmap = tokens[1];

  
// ** Added
  
this.buttonnumber = i;

  
thiso.catchevent(this, "onAction", "onButtonPressed"); 
}

// ** Modified
function onButtonPressed(obj) { 
  
player.chat = "Button Number: " @ obj.buttonnumber @ " pressed!"; 
} 
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote