Author Topic: Loop Through Clients and Get BL_ID's  (Read 3456 times)

Do I need to pass %client to the function at all to access ClientGroup? Or is it only needed so I can test if the client who called the function is an admin?

The only case where %client is used is for functions starting with "serverCmd" which can be reached through chat.
If you're making a function intended for usage through other code or the console, there's no need.

The only case where %client is used is for functions starting with "serverCmd" which can be reached through chat.
If you're making a function intended for usage through other code or the console, there's no need.
Thanks for the info!

Does anyone know why the script won't function on a dedicated server (hosted on my machine) but will if I use the "start a game" option from the title screen?

Thanks.

Does anyone know why the script won't function on a dedicated server (hosted on my machine) but will if I use the "start a game" option from the title screen?

I can't really see anything that's wrong with it.
This is probably obvious, but are there actually people on the dedicated server?
If there isn't, then the for loop body will never run, of course.

I run it while I'm logged onto the server so my ID should pop up yet it doesn't but does when I use the non-dedicated server option.

:[

@MARBLE MAN
Thanks for the going into so much detail I appreciate it. Although BluetoothBoy is correct I am familiar with programming basics however I was confused with how some of the code worked which you have helped cleared up for me.

I do however have a question:
Do I need to pass %client to the function at all to access ClientGroup? Or is it only needed so I can test if the client who called the function is an admin?

Thanks!

Edit:
Ok I've solved an issue but run into a problem. I'm attempting to host a server from my computer with a batch file which works fine. However although I can load my custom script  with exec("script path"); I can't access the function in game or from the console... However if I host a game from within Blockland, aka by hitting the "Start a Game" button from the title screen, the function runs just fine. What gives?

Thanks again.
Did you get the link I PMed you? It has the TorqueScript syntax.

Just checked I have 0 New Messages.

I run it while I'm logged onto the server so my ID should pop up yet it doesn't but does when I use the non-dedicated server option.

:[

Make sure you are executing and using the function in the dedicated server cmd, not the client one

Edit:
Ok I've solved an issue but run into a problem. I'm attempting to host a server from my computer with a batch file which works fine. However although I can load my custom script  with exec("script path"); I can't access the function in game or from the console... However if I host a game from within Blockland, aka by hitting the "Start a Game" button from the title screen, the function runs just fine. What gives?

It sounds like you are entering the command into your client console, not the server console.

%local
$global
object

all objects are global if you refer to them from ID's (%object.getID()) or their names (%object.getName())

ClientGroup is just a named object, some functions like .getDatablock() refer to the IDs

For efficiency:
You don't want to use %object.getDatablock() == MyData.getID(), but instead use %object.getDatablock() == nameToID("MyData");

Also, strings that aren't objects default to 0, so when you want to compare strings, use $=