View Single Post
  #2  
Old 11-29-2010, 10:58 PM
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 MrOmega View Post
Here's the script

PHP Code:
//#CLIENTSIDE

function onCreated()
{

  
client.targetCoor NULL;
  
client.targetMode 7;
  
  new 
GuiWindowCtrl"Varia_Targetting")
  {
  
    
clearControls();
    
    
extent = { 256128};
    
position = { screenwidth this.width0};
    
    
text "Targetting Control";
    
profile "GuiWindowProfile";
    
profile.bitmap "guivaria_window.png";
    
    
visible =
    
canMove =
    
canClose =
    
canResize =
    
canMinimize =
    
canMaximise false;
    
    for ( 
temp.0temp.8temp.++)
    {
 
      new 
GuiRadioCtrl"Varia_Targetting_" temp.i
      { 
       
        
extent = { 12822};
        
position = { 10 + ( temp.3this.width0), 25 this.height * ( temp.4)};
        
profile "GuiRadioProfile";
        
profile.bitmap "guivaria_radio.png";
        
profile.fontcolor = { 4717732255};
        
profile.fillcolor = { 477732255};
        
profile.fontcolorhl = { 02000255};
        
profile.fillcolorhl = { 0900255};
        
groupnum 1;
        
text 
          
temp.== 0"Move To Here"
          
temp.== 1"Look/Study":  
          
temp.== 2"Open":  
          
temp.== 3"Read"
          
temp.== 4"Speak to"
          
temp.== 5"Attack"
          
temp.== 6"Close"
          
"Do Nothing";
         
        
checked temp.== 7truefalse;
          
        
thiso.catcheventname"onAction""onChangeAction");
      
      }
    }
  }
}

function 
GraalControl.onMouseDown()
{

  
client.targetCoor = { intmousex), intmousey)};
  
Varia_Targetting.visible true;

  
with findImg0))
  {
  
    
client.targetCoor0] - 2;
    
client.targetCoor1] - 2;
    
    
image "varia_targetting.gif";
    
    
TargetAction();
  
  }
}

function 
GraalControl.onRightMouseDown()
{

  if ( 
client.targetCoor != NULL)
  {
  
    
Varia_Targetting.visible false;
    
hideimg0);
    
client.targetCoor NULL;

  }
}

function 
onChangeAction()
{

  
client.targetMode params0].substring171);
  
TargetAction();
  
}

function 
TargetAction()
{

  switch ( 
client.targetMode)
  {

    case 
0:

      
temp.dist getDistplayer.xplayer.yclient.targetCoor0], client.targetCoor1]);

    break;
    
    case 
1:
    break;
    
    case 
2:
    break;
    
    case 
3:
    break;
    
    case 
4:
    break;
    
    case 
5:
    break;
    
    case 
6:
    break;
    
    case 
7:
    break;

  }
}


function 
getDisttemp.x1temp.y1temp.x2tempy2)
{

  
temp.dist int(((( temp.x2 temp.x1) ^ 2) + (( temp.y2 temp.y1) ^ 2)) ^ 0.5);
  echo( 
temp.dist SPC params);
  return 
temp.dist;


Here's the issue. on the getDist function it's not getting the correct params that I am sending it's getting the params of whatever last function was used.

So when I click the first radio button it echoes " 33 Varia_Targetting_0, "
If I just click around after that I get the params of onMouseDown(). and the dist always seems to be 33. What the hell am I doing wrong?
I believe this would be caused as a result of calling "TargetAction" inside with(findImg( 0)){}, it should probably be "thiso.TargetAction" or just called outside of that bracket.
Reply With Quote