Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-29-2010, 10:54 PM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
Lost at an Unexpected Action

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;

  
showimg0"varia_targetting.gif",  client.targetCoor0] - 2client.targetCoor1] - 2).layer 3;

  
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?
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
  #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
  #3  
Old 11-29-2010, 10:58 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quick look over..

function getDist( temp.x1, temp.y1, temp.x2, tempy2)

should be

function getDist( temp.x1, temp.y1, temp.x2, temp.y2)
__________________
Quote:
Reply With Quote
  #4  
Old 11-29-2010, 11:01 PM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
Quote:
Originally Posted by ffcmike View Post
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.
I did that but still get the issue.

Quote:
Originally Posted by fowlplay4 View Post
Quick look over..

function getDist( temp.x1, temp.y1, temp.x2, tempy2)

should be

function getDist( temp.x1, temp.y1, temp.x2, temp.y2)
Wow one those moments where I feel stupid, it has somewhat fixed it... It returns the proper dist now, but it still doesn't echo the proper params... oh well.
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
  #5  
Old 11-29-2010, 11:12 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Had you used your own specified params instead of taking the quick route you would have noticed. :P
__________________
Quote:
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:49 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.