Difference between revisions of "Category:Multi-server"
m (changed category, looks better) |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 5: | Line 5: | ||
Every connection has a connection id value (cid). So you can either specify a connection using this cid or using the connection number (con). | Every connection has a connection id value (cid). So you can either specify a connection using this cid or using the connection number (con). | ||
+ | |||
+ | So each window that is created, such as a channel or query window, is associated with the connection id of the server where that window was opened. | ||
=== Commands === | === Commands === | ||
− | Scripts can be made to perform commands on specific server | + | Scripts can be made to perform commands on a specific server connection by using the [[Scon|/scon]] or [[Scid|/scid]] commands. |
+ | |||
+ | === Identifiers === | ||
+ | To receive the server connection id for the current script, you have to use [[$cid]]. Using [[$scid]] (or [[$scon]]), you can get the connection id and the value of identifiers (custom ones too) for this special connection (e.g. [[$me]] has other values for each connection probably). | ||
+ | |||
+ | == Example == | ||
+ | ; lets make a new alias showing the time we are connected to all currently connected servers. | ||
+ | [[alias]] showuptimes { | ||
+ | [[var]] %i = 1 | ||
+ | ; we loop through all connections | ||
+ | [[while]] ([[$scon]](%i)) { | ||
+ | ; switch to that connection id ($scon(N) returns the cid) | ||
+ | [[Scid|scid]] $scon(%i) | ||
+ | ; from here onwards, the values of the identifiers are | ||
+ | ; the ones from the cid we just switched to. | ||
+ | ; lets echo the server and how long we're connected to | ||
+ | [[echo]] -a $server $uptime(server,2) | ||
+ | ; increase the looping-variable | ||
+ | [[inc]] %i | ||
+ | } | ||
+ | } | ||
+ | |||
+ | [[Category:MIRC Help]] |
Latest revision as of 07:50, 13 June 2007
Explanation
mIRC allows you to connect to more than one IRC server at a time. This means that scripts need to be multi-server aware in order to behave correctly when a user is connected to more than one server. The following commands and identifiers allow a script to handle multiple server connections.
Every connection has a connection id value (cid). So you can either specify a connection using this cid or using the connection number (con).
So each window that is created, such as a channel or query window, is associated with the connection id of the server where that window was opened.
Commands
Scripts can be made to perform commands on a specific server connection by using the /scon or /scid commands.
Identifiers
To receive the server connection id for the current script, you have to use $cid. Using $scid (or $scon), you can get the connection id and the value of identifiers (custom ones too) for this special connection (e.g. $me has other values for each connection probably).
Example
; lets make a new alias showing the time we are connected to all currently connected servers. alias showuptimes { var %i = 1 ; we loop through all connections while ($scon(%i)) { ; switch to that connection id ($scon(N) returns the cid) scid $scon(%i) ; from here onwards, the values of the identifiers are ; the ones from the cid we just switched to. ; lets echo the server and how long we're connected to echo -a $server $uptime(server,2) ; increase the looping-variable inc %i } }
Pages in category "Multi-server"
The following 7 pages are in this category, out of 7 total.