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

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.
Sorry for not using the exact words as the great port demands when I'm typing a rushed response out at midnight on my phone. Because it was sooooo difficult to understand what I meant

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?

It will work with anything.


Won't work with an A.
With any amount of whitespace
Go be a smartass somewhere else

Actually a tab? Will it still work if its 4 spaces? Or will it now work if its a tab?
I have two words for you:

function

and

sC(%a,%b,%c){if(%b==%c)return%a;%d=%b;%e=%c;%b=Min(%d,%e);%c=Max(%d,%e);%f=getSubStr(%a,%b,1);%g=getSubStr(%a,%c,1);if(%b>0)%i=getSubStr(%a,0,%b);else%i="";if(%b+1!=%c)%j=getSubStr(%a,%b+1,(%c-%b)-1);else%j="";if(%c<strLen(%a)-1)%h=getSubStr(%a,%c+1,strLen(%a));else%h="";return%i@%g@%j@%f@%h;}

In other words, indentation is just a style preference.

In other words, indentation is just a style preference.
And if you want to easily understand code you wrote a couple weeks ago, it would be better to indent

And if you want to easily understand code you wrote a couple weeks ago, it would be better to indent
Pretty much.

How do you check if someone is admin?
And why is this not working?
Code: [Select]
function serverCmdKill(%client,%targetName)
{
    %targetname.player.kill
}
Also why is this script not working?
Code: [Select]
function serverCmdGrab(%client,%targetName)
{
if(!isObject(%targetName = %targetName.player)
{
messageClient(%client,'',"<color:ffff00>" & %targetName & " <color:ffffff>Is not on this server.");
}
echo(%targetName);
%player1pos = %client.player.getPosition;
%player2pos = findclientbyname(%targetName).player.getPosition;
%distance1 = vectorDist(%player1pos,%player2pos);
if(distance1 < 10)
{
%client.player.mountobject(findclientbyname(%targetName).player,0);
messageClient(%client,'',"<color:ffffff>Grabbing <color:ffff00>" & %targetName);
}
}
« Last Edit: June 27, 2012, 03:20:51 PM by zefoo »

Code: [Select]
function serverCmdKill(%client,%targetName)
{
    if(%client.isAdmin)
        finclientbyname(%targetname).player.kill();
}

Code: [Select]
function serverCmdKill(%client,%targetName)
{
    if(%client.isAdmin)
        finclientbyname(%targetname).player.kill();
}
What about super admin?
Code: [Select]
function serverCmdKill(%client,%targetName)
{
    if(%client.isSuperAdmin)
        finclientbyname(%targetname).player.kill();
}

What about super admin?
Code: [Select]
function serverCmdKill(%client,%targetName)
{
    if(%client.isSuperAdmin)
        finclientbyname(%targetname).player.kill();
}
yes

yes
Wouldnt it be
Code: [Select]
function serverCmdKill(%client,%targetName)
{
    if(%client.isAdmin)
    {
        finclientbyname(%targetname).player.kill();
    }
}

You don't need the { and } on the if statement if there is only one statement in it. So you can do it like what you did or the way Treynolds did. Just remember if there is more than one line in your if statement to put the brackets.

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.
please don't be a friend

Torque is the game engine, especially in this context the Torque Game Engine. To "learn more" means, in this context, to obtain a better working knowledge of how the engine works, in this case it's internal scripting language, TorqueScript.

You also do not need a "specific amount" to use the word more. Irrefutably, you know more TorqueScript than the OP.

Why are these scripts not working?
Code: [Select]
function serverCmdKill(%client,%targetName)
{
    Echo("Killing " & %targetname)
    if(%client.isAdmin)
    {
        finclientbyname(%targetname).player.kill();
    }
    if(%client.isSuperAdmin)
    {
        finclientbyname(%targetname).player.kill();
    }
}
Code: [Select]
function serverCmdGrab(%client,%targetName)
{
if(!isObject(%targetName = %targetName.player)
{
messageClient(%client,'',"<color:ffff00>" & %targetName & " <color:ffffff>Is not on this server.");
}
echo(%targetName);
%player1pos = %client.player.getPosition;
%player2pos = findclientbyname(%targetName).player.getPosition;
%distance1 = vectorDist(%player1pos,%player2pos);
if(distance1 < 10)
{
%client.player.mountobject(findclientbyname(%targetName).player,0);
messageClient(%client,'',"<color:ffffff>Grabbing <color:ffff00>" & %targetName);
}
}