Game Development Community

Schedule for CommandToServer

by Jeff Trier · in Torque Game Engine · 07/08/2003 (12:06 pm) · 4 replies

Hi all,

I am attempting to start a schedule for a server command like this:

%obj.ailoop = %obj.schedule(500, commandToServer('ActivateOrder', %obj, %attitude, %order));

but when I run the engine, it will do the schedule once after it gives me this error:
"fps/server/scripts/UnitSpawn.cs (206): Call to commandToServer in serverCmdSpawnUnit uses result of void function call."

What would be the proper way to do this? I can't seem to find any examples of Schedules for Server Commands.


Thanks guys and gals... :)

-Jeff

About the author

Originally a Classical/Metal musician, I've always been attracted to anything involving computers, including: Networking, PC Building and Repair, software design and coding. I've been involved with game design and development for over 10 years.


#1
07/08/2003 (2:44 pm)
Well... a quick workaround on this would be to move the commandToServer into a separate function and have the schedule call the function, which then handles the commandToServer.

As for what's wrong... Hm. I've never tried what you are doin' either :-)
#2
07/08/2003 (4:16 pm)
Thanks Davis!

I will see about that work around if what I am trying isn't possible.

Still plugging away...

-Jeff
#3
07/08/2003 (6:49 pm)
You are calling schedule wrong.
%obj.ailoop = schedule( ... );

should work..
You only do %obj.schedule when you are acting on that object. So for instance:
function Player::aSchedule(%this, %somePlayer)
{
   if(%somePlayer.threadCount < 3)
   {
      %somePlayer.threadCount += 1;
      %somePlayer.thread = %somePlayer.schedule(500, aSchedule, %somePlayer);
   }
   else
   {
      cancel(%somePlayer.thread);
      %somePlayer.threadCount = 0;
   }
}

schedule is acting on the Player object. Where as using schedule like this does not:
function aSchedule(%somePlayer)
{
   if(%somePlayer.threadCount < 3)
   {
      %somePlayer.threadCount += 1;
      %somePlayer.thread = schedule(500, aSchedule, %somePlayer);
   }
   else
   {
      cancel(%somePlayer.thread);
      %somePlayer.threadCount = 0;
   }
}

So, since you are using commandToServer you should use schedule and not %obj.schedule.
#4
07/09/2003 (6:11 am)
Oh I think I see... thanks Robert. :)

I assume that %somePlayer is the actual object? And that in the lower example, the schedule isn't really attached to the object, but rather just using the objects ID as part of its own handle ID?


Thanks again!
-Jeff