Author Topic: Need help scripting.  (Read 6308 times)

Read the last page/last reply from me.
« Last Edit: June 27, 2012, 05:14:20 PM by zefoo »

You need to learn more torque

Here's your fixed code:
Code: [Select]
function serverCmdGrab(%client,%targetName)
{
    %client.player.mountobject(findclientbyname(%targetName).player,0);
}
This is all you need

You need to learn more torque

Here's your fixed code:
Code: [Select]
function serverCmdGrab(%client,%targetName)
{
    %client.player.mountobject(findclientbyname(%targetName).player,0);
}
This is all you need
Thanks lol yea im a noob.

So I just started blockland scripting and here is my script.
Code: [Select]
function serverCmdGrab(%client, %Args)
{
  %name1 = %text;
  echo(%text);
  %client.player.mountobject((Findclientbyname(%name1)),Nodenumber);
}
function Grab()
{
  %client.player.mountobject((Findclientbyname(%name1)),Nodenumber);
}
function reloadsg()
{
  exec("Add-Ons/Script_Grab/server.cs")
}
I want to be able to type in /grab (Playername) and have them mount to one of my hands.
I know how to do that but I don't know how to get whats after the word grab.
So if i type in /grab (Playername)
How do I get the player name into my script?

You have a lot of things wrong, here is what it should look like:

Code: [Select]
function serverCMDGrab(%client,%player)
{
%player = findclientbyname(%player);

if(!isObject(%player = %player.player))
{
//Tell them there is no player with that name on
return 0;
}

%client.player.mountobject(%player,1);
return true;
}

You need to learn more torque

please use terminology properly

Torque is the engine series (e.g. Torque Game Engine, iTorque 2D).
TorqueScript is the internal scripting language they use.

You also cannot have "a specific amount" of TorqueScript.

How would you have the script say something. Like a message but only to the player.
Like in events you can do OnActivate|Client|ChatMsg|[bla bla bla].
Also how would you see how close the target player is to you?

1. TorqueScript is the internal scripting language they use.

2. You also cannot have "a specific amount" of TorqueScript.
1. On this forum, torque is short for torquescript, you're taking that too literally.
2. He meant gain more knowledge for/about using torquescript. That should be common sense.

1. On this forum, torque is short for torquescript, you're taking that too literally.
2. He meant gain more knowledge for/about using torquescript. That should be common sense.

1. No, not really, it isn't.
2. Clearly, but he should have said that then.

How would you have the script say something. Like a message but only to the player.

messageClient(%client,'',"TEXT!");

Also how would you see how close the target player is to you?

Make sure you have both of the player objects, then you can do:

Edit: Oops, Port caught me!

vectorDist(%player1.position,%player2.position);

« Last Edit: June 27, 2012, 12:25:05 AM by elm »

messageClient(%client,'',"TEXT!");
If you did messageClient(%client,'',"<color:ffff00>TEXT!"); would the text be yellow?

Make sure you have both of the player objects, then you can do:

vectorDist(%player1,%player2);

You'll have to find their position (getPosition member function) and compare those values, not the object IDs.

If you did messageClient(%client,'',"<color:ffff00>TEXT!"); would the text be yellow?

Yes, but you can use \c3 instead to change the color to yellow. As a super admin, type /colorTest to see all the number/color combinations for that.

How do I write an if statment lol?
Im used to something like...
If playerdis < 10 then
    echo("Its ok to grab");
end if

How do I write an if statment lol?
Im used to something like...
If playerdis < 10 then
    echo("Its ok to grab");
end if


Code: [Select]
if(%playerdis < 10)
{
    echo("Its ok to grab");
}

Code: [Select]
if(%playerdis < 10)
{
    echo("Its ok to grab");
}
Thanks
how would I check if the player is on the server?
And is this
Code: [Select]
if(%playerdis < 10)
{
These 4 spaces right here>   echo("Its ok to grab");
}
Actually a tab? Will it still work if its 4 spaces? Or will it now work if its a tab?
« Last Edit: June 27, 2012, 12:37:00 AM by zefoo »