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

Could you do something like this
Code: [Select]
Findclientbyname(%targetname).player.setmusic(AfteSchoolSpecial)or this
Code: [Select]
Findclientbyname(%targetname).player.setPos(Findclientbyname(%targetname).player.pos.X + 1, Findclientbyname(%targetname).player.pos.Y + 1, Findclientbyname(%targetname).player.pos.Z + 1)?

And how can you check if a say String1 is in String2?
I know that the last code you posted is definitely wrong.
It should go like this, if I am correct:
findClientByName(%targetname).player.Position(Findclientbyname(%targetname).player.Position += (5.1,1,1);

I know that the last code you posted is definitely wrong.
It should go like this, if I am correct:
findClientByName(%targetname).player.Position(Findclientbyname(%targetname).player.Position += (5.1,1,1);

Oh god.

Oh god.
Lol.

New question.
How do you save/make a text document?

Lol.

New question.
How do you save/make a text document?
In torque? If not that's just sad.


Well obviously in Blockland;)

First before you do things around stuff with FileObjects and that stuff, you need to grasp basic syntax me thinks.

Some more questions.
how do you make a loop?
Ex:
Code: [Select]
Do while done = false
{
   
}
how do you send a chat message that everyone can see?
« Last Edit: June 27, 2012, 05:49:02 PM by zefoo »

Some more questions.
how do you make a loop?
Ex:
Code: [Select]
Do while done = false
{
   
}
how do you send a chat message that everyone can see?

Doing a loop is easy. I suggest using the while loop.
while(%i=1,(end loop),(what is being changed in the loop));
  {

  }

A chat message that everyone can see.
chatMessageAll("%");
bottomPrintAll("%");
centerPrintAll("%");
talk("%");

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.

there's still nothing preventing him from speaking correctly without obscure nicknames, slangs and expressions

Doing a loop is easy. I suggest using the while loop.
while(%i=1,(end loop),(what is being changed in the loop));
  {

  }

A chat message that everyone can see.
chatMessageAll("%");
bottomPrintAll("%");
centerPrintAll("%");
talk("%");

Thanks now how can you check if a say String1 is in String2?
Oh and could you show me an example loop?
« Last Edit: June 27, 2012, 05:58:12 PM by zefoo »

Thanks now how can you check if a say String1 is in String2?

You know how to compare numeric values. You can find the position of String1 in String2 with strPos(String2, String1) (striPos for case insensitivity). Figure out the rest.

You know how to compare numeric values. You can find the position of String1 in String2 with strPos(String2, String1) (striPos for case insensitivity). Figure out the rest.
Thanks
Now for the other question...
How do you get a list of everyone on the server?
Could you do something like
Code: [Select]
for each player in server
{
    Echo(%playername);
}
?
« Last Edit: June 27, 2012, 06:08:42 PM by zefoo »

Thanks

Oh, I forgot to mention that they return -1 if it isn't found.

How do you get a list of everyone on the server?

There's a group of gameConnection objects called clientGroup which (as all groups do) has the functions getCount() and getObject(index), which returns the amount of clients and a specific client, respectively. IIRC for loops have been demonstrated before in this topic.

Oh, I forgot to mention that they return -1 if it isn't found.

There's a group of gameConnection objects called clientGroup which (as all groups do) has the functions getCount() and getObject(index), which returns the amount of clients and a specific client, respectively. IIRC for loops have been demonstrated before in this topic.
Sorry but could you please just show me an example of code that could echo the list one name at a time until its done?

Sorry but could you please just show me an example of code that could echo the list one name at a time until its done?

Code: [Select]
%count = clientGroup.getCount();

for ( %i = 0 ; %i < %count ; %i++ )
{
        %client = clientGroup.getObject( %i );
        echo( %client.getPlayerName() );
}