mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2003
Posts: 257
A
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Nov 2003
Posts: 257
I need a simple alias to check if I'm connected to a server.

Joined: Oct 2004
Posts: 72
C
Babel fish
Offline
Babel fish
C
Joined: Oct 2004
Posts: 72
Good question! I allways use

íf ($server) {
...I am connected....
}

But if there is a better way ....

Joined: Nov 2003
Posts: 257
A
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Nov 2003
Posts: 257
I figured it out.
alias checkconnection {
if ($status == connected) {
.server -m $$?="other server to connect to?"
}
if ($status == Not Connected) {
.server $$?="server to connect to?"
}
}

Joined: Jan 2005
Posts: 75
Z
Babel fish
Offline
Babel fish
Z
Joined: Jan 2005
Posts: 75
//echo -a $scid($activecid).status

so like
checkserver { if ($scid($activecid).status = connected) { do stuff }

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
//echo -a $scid($activecid).status


Thats pointless as $activecid on a direct command is the current windows cid so you might as well just do //echo -a $status

Quote:
checkserver { if ($scid($activecid).status = connected) { do stuff }


This well produce all types of results, you could be connected on server one and trip an event such as ON TEXT, but be in a window on server two which is not connected, and it well result in no acton as the $scid($activecid).status is disconnected.


To the matter at hand.
Quote:
I need a simple alias to check if I'm connected to a server.


Here is something that well return a $true or $false result for the exact question that was asked, however I think he was more than likely just wanting to check for if the server the event/timer/script what ever was tripped for was connected or not, which is $status, he didnt actually ask that tho, rather if hes conencted to A server.

usage $connected
results $true / $false
alias connected { var %connected = $false | scon -at1 $+(var %,connected = $true) | return %connected }

Joined: Jan 2005
Posts: 75
Z
Babel fish
Offline
Babel fish
Z
Joined: Jan 2005
Posts: 75
checkserver { if ($scid($activecid).status = connected) { do stuff }
was just an example

echo -a $scid($activecid).status will show 'disconnected' on a disconnected server, so if it was like for a custom toolbar or whatever, he could use that to show a 'disconnected' icon or a 'connected' icon, instead of having both on the toolbar

Code:
     if ($scid($activecid).status = connecting || $scid($activecid).status = connected ) { scid $activecid disconnect }
    else {
      scid $activecid server
    }
do something here
do something here too
    scid $activecid window -a "status window"
  } 

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
echo -a $scid($activecid).status will show 'disconnected' on a disconnected server, so if it was like for a custom toolbar or whatever, he could use that to show a 'disconnected' icon or a 'connected' icon, instead of having both on the toolbar


Thats about all its usefull for, since all it tells you is if the active window is on a connected server, not if you are on a server or not


Quote:
Code:
     if ($scid($activecid).status = connecting || $scid($activecid).status = connected ) { scid $activecid disconnect }
    else {
      scid $activecid server
    }
do something here
do something here too
    scid $activecid window -a "status window"
  }


I dont really see what this codes ment to represent, it has one more } than { was there something missing from it?

Joined: Jan 2005
Posts: 75
Z
Babel fish
Offline
Babel fish
Z
Joined: Jan 2005
Posts: 75
it was a small piece from my custom toolbar on *:dialog:toolbar:sclick:1: {

i didn't paste the whole lot as it wasn't needed, either way what i've been using on the toolbar works.

when i click over to a disconnected window then the connect icon will show up.

Last edited by ztnaraM; 21/04/05 06:39 PM.

Link Copied to Clipboard