Game Development Community

isClientOnline()

by Desmond Fletcher · in Torque Game Engine · 06/02/2002 (1:54 pm) · 6 replies

I'm trying to determine if the client is online via script using the isClientOnline function in \game\net\netDispatch.cc:
if (isClientOnline())
  gotoWebPage(%cleanurl);
else
  ...

I get the console error that Torque is "unable to find the function" so I must not be using it correctly.

Any ideas?

--------------------------------------------
Also, could someone explain what the JournalWriting stuff is about?

#1
06/02/2002 (6:08 pm)
- You can't call any arbitrary piece of engine code from the scripts. You can only call functions that have been exported using ConsoleFunction, ConsoleMethod, or Con::addCommand.

- Journalling is used to record a session so that you can replay it later. It is essential for debugging. If you don't know about journalling yet, you should experiment with the -jSave and -jPlay command line parameters. (While developing you should always, always be saving a journal any time you run your game app.)

- I don't think that isClientOnline is going to do anything interesting for you. It looks like it used to be used to check in with the authorization server; now, of course, there is no authorization server.
#2
06/03/2002 (9:55 am)
Thanks Joel,
I'll definately check out journaling today!!!!! Are these commands (-jSave and -jPlay) available via console or just command line?

On the isClientOnline issue, do you think that if the console code was added that this function could be used to detect whether a client in connected to the net or not? I would like to redirect the client to a local webpage if they are not connected.
#3
06/03/2002 (2:59 pm)
> Are these commands (-jSave and -jPlay) available via
> console or just command line?

Just the command line. A journal has to record every event from the very start of the program, otherwise it would be difficult to exactly re-create the session in playback.


> On the isClientOnline issue, do you think that if the
> console code was added that this function could be
> used to detect whether a client in connected to the
> net or not?

Well, like I said, it currently doesn't do anything because everything related to the auth server has been ripped out of the engine. You could export it to the scripting but it wouldn't serve any purpose to call it.

If you want some code that checks to see if the client has an active net connection available, you'll have to write it yourself I'm afraid.
#4
06/03/2002 (9:05 pm)
so I guess the real answer is that this is defunct code and should be ripped out?
#5
06/03/2002 (9:40 pm)
The engine has a callback function for a disconnection event. What you can do is set client.connected = true on the connection event and set client.connected = false when they disconnect (not sure if the client is automatically deleted though). Then simply create a client member function which returns that value.

I think the events are onConnect and onDisconnect (onDrop maybe?) sorry I don't have the engine here. And they're either scripted as members of the Server or Client class.
#6
06/04/2002 (12:34 pm)
Those callbacks are related to connecting and disconnecting to a game server, not to being online or offline.