View Single Post
  #2  
Old 02-11-2012, 11:21 AM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Quote:
Originally Posted by scriptless View Post
So I am trying to pass a variable with an event.. Not sure if it's possible? Or if I am way wrong on how to do it? I am planning to have let's say 10 images, and clicking on them will make the player chat the number of the image it clicked on..

PHP Code:
//#CLIENTSIDE
function onCreated() {
  for ( 
010i++ ) {
    new 
GuiShowImgCtrl("test" i) {
      
55;
      
50 40;
      
image "block.png";
      
thiso.catchevent(this"onMouseDown""onSelect"i); 
    }
  }
}
function 
onSelect() {
  
player.chat "a" SPC params[0];

Didn't work.

Removing i from catchevent(), however, shows the name of the Control.
The parameter received is actually the GUI object rather than its name. You can just write this. variables to the GUI object itself then use the object as reference:

PHP Code:
//#CLIENTSIDE
function onCreated() {
  for ( 
010i++ ) {
    new 
GuiShowImgCtrl("test" i) {
      
55;
      
50 40;
      
image "block.png";
      
this.num i;
      
thiso.catchevent(this"onMouseDown""onSelect"i); 
    }
  }
}
function 
onSelect(temp.gui) {
  
player.chat temp.gui.num;

Reply With Quote