From WikiChip
Editing mirc/commands/signal

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help pages.

Latest revision Your text
Line 1: Line 1:
{{mirc title|/signal Command}}
+
Signals are a simple way of triggering signal events in multiple scripts at the same time. Once set up to listen for the signal event, either directly or indirectly (using a '''*''' wildcard), your scripts can each perform their own duties based on the signal you've provided.
The '''/signal''' command is used to send a signal to all loaded script, if one of them has a matching {{mIRC|on signal}} event, it triggers. Signals are a simple way of triggering signal events in multiple scripts at the same time.
+
== Signal Command ==
 
+
Signals have a very simple syntax:
== Synopsis ==
 
 
<syntaxhighlight lang="mirc">/signal [-n] <name> [parameters]</syntaxhighlight>
 
<syntaxhighlight lang="mirc">/signal [-n] <name> [parameters]</syntaxhighlight>
  
== Switches ==
+
=== Flags ===
* '''-n''': This flag tells the ''/signal'' command to fire immediately instead of waiting for the end of the whole current script processing, this implies nested call to signal event and also recursion can be made, though the maximum you can get is 24 iterations. If you don't provide the -n switch, mIRC waits for the end of the whole current script processing and then triggers any matching events.
+
'''-n''': This flag tells the ''/signal'' command to fire immediately, rather than wait for all other listening scripts to finish executing their events.
  
== Parameters ==
+
=== Examples ===
* '''<name>''' - the name of a signal event
 
* '''[parameters]''' - the optional parameter passed to the signal event
 
 
 
== Examples ==
 
 
Let's check out an example of a signal command below:
 
Let's check out an example of a signal command below:
 
<syntaxhighlight lang="mirc">/signal mysignal Signal information!</syntaxhighlight>
 
<syntaxhighlight lang="mirc">/signal mysignal Signal information!</syntaxhighlight>
  
Once you've executed this command, it will send a '''signal''' named ''mysignal'' to all scripts in your mIRC remotes. Any script files that have signal event listening for that signal will trigger, and perform whatever tasks they have been set to perform.
+
Once you've executed this command, it will send a '''signal''' named ''mysignal'' to all scripts in your mIRC remotes. Any script files that have signal event listeners listening for the event will trigger, and perform whatever tasks they have been set to perform.
 +
 
 +
How do the other scripts listen for a signal event? That's a great question, which brings us to our next section regarding these listeners.
 +
 
 +
== Signal Event Listener ==
 +
<syntaxhighlight lang="mirc">ON *:SIGNAL:name:command</syntaxhighlight>
 +
''Note:'' The script that called /signal is triggered first, and then all other scripts are triggered.
  
<syntaxhighlight lang="mirc">ON *:SIGNAL:mysignal:echo -s rcvd: $signal : $1-</syntaxhighlight>
+
=== Parameters ===
 +
<span style="display: inline-block; width: 85px;">''name''</span>A unique name given to your signal which is usually related to its purpose.
 +
 
 +
<span style="display: inline-block; width: 85px;">''command''</span>This is a command, or a set of commands, which can be executed when the signal event is triggered.
 +
 
 +
You can also specify a wildcard within the signal name. For example, review the following:
 +
<syntaxhighlight lang="mirc">ON *:SIGNAL:*nick:echo -a I just got a signal from $signal $+ !</syntaxhighlight>
 +
 
 +
The above code will listen for any signals that end in ''nick''. Let's take a look at a basic command to trigger this signal event:
 +
<syntaxhighlight lang="mirc">/signal endsIn-nick Here is some info!</syntaxhighlight>
 +
 
 +
The signal event we are listening for triggers on this command because the signal name we've given ''/signal'' ends in ''nick''. Below is the result of executing the above signal:
 +
 
 +
<pre>I just got a signal from bestSignal!</pre>
  
 
== Identifiers ==
 
== Identifiers ==
* '''$signal''' - Returns the signal name of the signal which triggered the current event.
+
<span style="display: inline-block; width: 85px;">''$signal''</span>Returns the signal name of the signal which triggered the current event.
* '''$1-''' - Returns any optional parameters that have been passed along with the signal.
+
 
 +
<span style="display: inline-block; width: 85px;">''$1-''</span>Returns any optional parameters that have been passed along with the signal.
  
 
== Example Script ==
 
== Example Script ==
Line 67: Line 82:
  
 
== Compatibility ==
 
== Compatibility ==
{{mIRC compatibility|6.0}}
+
Added: mIRC v6.0
 +
 
 +
Added On: 03/02/2002
  
 
== See also ==
 
== See also ==
Line 73: Line 90:
 
* [[List of identifiers - mIRC|List of identifiers]]
 
* [[List of identifiers - mIRC|List of identifiers]]
 
* [[On events - mIRC|ON Events]]
 
* [[On events - mIRC|ON Events]]
{{mIRC command list}}
 
  
[[Category:mIRC commands|signal command - mIRC]]
+
[[Category:mIRC commands]]

Please note that all contributions to WikiChip may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see WikiChip:Copyrights for details). Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)