Here's the script
PHP Code:
//#CLIENTSIDE
function onCreated()
{
client.targetCoor = NULL;
client.targetMode = 7;
new GuiWindowCtrl( "Varia_Targetting")
{
clearControls();
extent = { 256, 128};
position = { screenwidth - this.width, 0};
text = "Targetting Control";
profile = "GuiWindowProfile";
profile.bitmap = "guivaria_window.png";
visible =
canMove =
canClose =
canResize =
canMinimize =
canMaximise = false;
for ( temp.i = 0; temp.i < 8; temp.i ++)
{
new GuiRadioCtrl( "Varia_Targetting_" @ temp.i)
{
extent = { 128, 22};
position = { 10 + ( temp.i > 3? this.width: 0), 25 + this.height * ( temp.i % 4)};
profile = "GuiRadioProfile";
profile.bitmap = "guivaria_radio.png";
profile.fontcolor = { 47, 177, 32, 255};
profile.fillcolor = { 47, 77, 32, 255};
profile.fontcolorhl = { 0, 200, 0, 255};
profile.fillcolorhl = { 0, 90, 0, 255};
groupnum = 1;
text =
temp.i == 0? "Move To Here":
temp.i == 1? "Look/Study":
temp.i == 2? "Open":
temp.i == 3? "Read":
temp.i == 4? "Speak to":
temp.i == 5? "Attack":
temp.i == 6? "Close":
"Do Nothing";
checked = temp.i == 7? true: false;
thiso.catchevent( name, "onAction", "onChangeAction");
}
}
}
}
function GraalControl.onMouseDown()
{
client.targetCoor = { int( mousex), int( mousey)};
Varia_Targetting.visible = true;
showimg( 0, "varia_targetting.gif", client.targetCoor[ 0] - 2, client.targetCoor[ 1] - 2).layer = 3;
TargetAction();
}
function GraalControl.onRightMouseDown()
{
if ( client.targetCoor != NULL)
{
Varia_Targetting.visible = false;
hideimg( 0);
client.targetCoor = NULL;
}
}
function onChangeAction()
{
client.targetMode = params[ 0].substring( 17, 1);
TargetAction();
}
function TargetAction()
{
switch ( client.targetMode)
{
case 0:
temp.dist = getDist( player.x, player.y, client.targetCoor[ 0], client.targetCoor[ 1]);
break;
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
case 6:
break;
case 7:
break;
}
}
function getDist( temp.x1, temp.y1, temp.x2, tempy2)
{
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?