Game Development Community

Scripting Questions

by DavidRM · in Torque Game Engine · 03/16/2002 (2:42 pm) · 4 replies

I've been going through all of the provided scripts, just making sure I understand what each function is doing, and picking up how the scripting language works.

Here are a couple of questions that I haven't been able to turn up satisfactory answers for:

1. In "torque\example\common\server\clientConnection.cs", in the function "GameConnection::onConnect( %client, %name )" there are the following lines:

$instantGroup = ServerGroup;
   $instantGroup = MissionCleanup;

My question is: What do those 2 lines *do*? I know (more or less) what ServerGroup and MissionCleanup are for. My question is what do these assignments accomplish?

I've found several references to $instantGroup throughout the scripts, but most often only as an assignment like above. And nothing ever seems to actually *use* $instantGroup.


2. While I'm here, in the same function, the hosting player is automatically made superadmin of the server:

// if hosting this server, set this client to superAdmin
   if (%client.getAddress() $= "local") {
      %client.isAdmin = true;
      %client.isSuperAdmin = true;
   }

However, just a few lines later:

// Set admin status
   %client.isAdmin = false;
   %client.isSuperAdmin = false;

Is this the bug that it appears to be? Because regardless of the player's "local" status, and having been made superadmin earlier, these last lines always execute.


Thanks for your help!

-David
Samu Games
The Journal

#1
03/17/2002 (10:35 pm)
I think the second one is a mistake. I changed it the other way around since I needed the superadmin checks. As for the first question the only place I see it used is in the AI editor which doesn't work the part where it does the assignments one right after the other is pointless. It might also be a mistake or a hack..not sure what the purpose of the variable is.

-Tim aka Spock
#2
03/18/2002 (12:59 am)
I saw that the other night and wondered about the double assignment.

Ah well, not to worry, there's always going to be some oddities in code like this.

Phil.
#3
03/18/2002 (12:38 pm)
Ok. So these aren't evidence of bizarre-but-useful features of the scripting language. That's what I needed to know. ;)

Thanks.

-David
Samu Games
The Journal
#4
03/28/2002 (2:35 pm)
$instantGroup defines the group that objects will be added to when you create them.

I believe that the ServerGroup contains all objects. MissionCleanup is one of the subgroups of ServerGroup, which contains objects created during the course of the game.

But yeah, setting $instantGroup to one thing and then instantly setting it to another thing means that the first of those two statements has no effect. Must have been one of those situations where there used to be other code between the two statements, and that code got deleted, and whoever was doing the deletion missed that first $instantGroup assignment or didn't know what it was for.