Difference between revisions of "On open"

From Scriptwiki
Jump to: navigation, search
 
m
 
(2 intermediate revisions by the same user not shown)
Line 14: Line 14:
 
== Example ==
 
== Example ==
 
  on *:Open:?:*: {
 
  on *:Open:?:*: {
   [[echo]] -a $target has just opened a query window with you!
+
   [[echo]] -a $nick has just opened a query window with you!
 
  }
 
  }
 
This example reacts on every opening query and echos it to the active window.
 
This example reacts on every opening query and echos it to the active window.
Line 21: Line 21:
  
 
  on ^*:Open:?:*: {
 
  on ^*:Open:?:*: {
   [[if]] ([[$target]] == idiot) {
+
   [[if]] ([[$nick]] == idiot) {
 
   [[halt]]
 
   [[halt]]
 
   }
 
   }
Line 28: Line 28:
  
 
== See Also ==
 
== See Also ==
To trigger on the closing of a window, check the [[On_close|On close event]].
+
* [[On_close|On close event]] to trigger on the closing of a window.
  
 
[[Category:Events]]
 
[[Category:Events]]

Latest revision as of 10:01, 2 July 2007

The on OPEN events trigger for various events relating to the opening of a window.

on <level>:OPEN:<?|@|=|!|*>:<matchtext>:<commands>


The matchtext can be a wildcard match or even a regular expression. To use regular expressions as matchtext, you need the $-Prefix.

Read access levels to get more info about the <level> field.

The location where this event occurrs can be either a channel (#), a query (?), a DCC-window (=) or a fileserver-window (!) or everything (*).

Note that in the case of dcc sessions, it is trigger when a dcc connection has opened.

Example

on *:Open:?:*: {
 echo -a $nick has just opened a query window with you!
}

This example reacts on every opening query and echos it to the active window.


on ^*:Open:?:*: {
 if ($nick == idiot) {
  halt
 }
}

This example also reacts on every opening query but before the window has opened, checks if the nick is idiot and if it is, halts the opening.

See Also