Game Development Community

Script updating problems..

by Simon Jensen · in Torque Game Builder · 01/23/2007 (9:27 am) · 3 replies

So I have a basic multiplayer chat running, where the client sends a string to the server, the server then prepends the client's playername and then sends the final string to be displayed to all the clients.

The problem is, I had the script working where it was just sending the message string back to the client as an early test. Now, however, any changes I make to the server script are not being run.

It's like its stuck using the old version of the script somehow and just keeps sending the plain message string back!

I've run the cleanDSO.bat and made sure the script is getting recompiled and there are no errors. I changed the execution point of the script. I've changed the function's name and even the name of the script file.

Anyone have any Idea on how to fix this?

Here are the functions:

myServer.cs
function clientCmdSetupChatMessage(%client, %textMessage)
{   // gets a chat message from a client and then passes it to all the
clients
    // get the name of person who sent message
   %name = "-error no name found-";
   switch(%client)
   {
      case $myGame.Player1Client:
         %name = $myGame.Player1Name;
      case $myGame.Player2Client:
         %name = $myGame.Player2Name;
      case $myGame.Player3Client:
         %name = $myGame.Player3Name;
      case $myGame.Player4Client:
         %name = $myGame.Player4Name;
   }
   //append Name > to message2
   %textMessage2 = %name SPC ">" SPC %textMessage;
   
   //pass message along
   commandToClient($myGame.Player1Client , 'SetupChatMessage', %textMessage2 );
   commandToClient($myGame.Player2Client , 'SetupChatMessage', %textMessage2 );
   commandToClient($myGame.Player3Client , 'SetupChatMessage', %textMessage2 );
   commandToClient($myGame.Player4Client , 'SetupChatMessage', %textMessage2 );
   
}//function clientCmdSetupChatMessage(%client, %textMessage)

myClient.cs
function Client::SendSetupChatMessage()
{  // this sends a chat message during game setup.
   %message = ChatTextEntryBox.getValue();
   commandToServer('SetupChatMessage', %message);
   ChatTextEntryBox.setValue("");   
}//function Client::SendSetupChatMessage()


function serverCmdSetupChatMessage(%server,%messageContents)
{  // recieves a messag from the server and updates the gui.
   warn ("From Server" SPC%server SPC "I got:" SPC %messageContents);
   MPgameSetup::updateChatText(%messageContents);
}//function serverCmdSetupChatMessage(%server,%messageContents)

#1
01/23/2007 (10:27 am)
The way to see if your script is indeed recompiling (or not):

1. run the project (this makes sure all scripts are compiled)
2. exit the project
3. change one little thing in your script file (add a space to the end of a line?)
4. run the project (should detect the newer version of the file)
5. bring down the console AFTER the code that exec your script has been run
6. look for the console output saying it is exec-ing that script
7. look for some gray print (the rest should be black) right near there that says it is compiling your script

If that gray print is there you can be sure your script was updated. If not, you can be sure it wasn't (or you're looking in the wrong place). I recommend putting an error message right above the line where you exec the script. Error messages print to the console in red so you can scan the console output quickly to find the red output and look for the gray output just below it.

#2
01/23/2007 (7:02 pm)
Found the problem... stupid mistake #2,346

commandToServer('SetupChatMessage', %message);

Calls the function:

serverCmdSetupChatMessage(%server,%messageContents)

which was the client function.

which was then calling the function

clientCmdSetupChatMessage(%client, %textMessage)

Lesson Leaned:
serverCmdXXX are the commands ON the server NOT FROM the server... and vice versa for the client.

sigh.
#3
01/23/2007 (7:36 pm)
Cool man, glad you're up and running!

...until stupid mistake #2,347...

We all make them. My stupid mistake counter has gone so high it overflowed into negatives!

;)