the connection variable contrains a 0, for not connection, and a 2 when you connected as client.
Now, in com, the engine starts up as client, and tries to connect, if it fails
the engine start as usual as singleplayer.
You can not run script before the client tries to connect, and as far as I know, no variable stores
a "missed" connection attemt.
but if you can run the game as singleplayer also, I dont really know why you want
to handle it different to a normal singleplayer start?
In case you want to post a message "no server found" within the engine, you could
use a trick.
You create a starter program for 3dgs. This starter program (can be written in
3dgs also) can start a client, together with the commands -ip xxx and -cl, or start as normal singleplayer
This instance also then saves data to a textfile, stating that is just tried to
start as client.
if the 3dgs instance starts, and has a connection of 0, it checks the textfile.
From its information it can determine your previous attempt.
then you erase, or overwrite this textfile.
----
Its one of the possible workarounds....