On input

From Scriptwiki
Revision as of 10:56, 12 April 2008 by Albie (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The on INPUT event triggers when you enter text in an editbox and press enter.

on <level>:INPUT:<*#?=!@>:<commands>

The location of this event can be:

  • * is everything
  • # is a channel
  •  ? is a query window
  • = is a dcc window
  •  ! is a fileserver window
  • @ is a custom window

You can also specify a specific channel/window name instead of *#?=!@.

Note that if you /halt this event, you can prevent mIRC itself from processing your message.

Note that this event has no matchtext-field. You have to use if-statements to make more restrictions.

Note that you should only use one on input event in your remote as having more will make problems because of "double echo"'s.


The following example will connumerate your written characters and words.

; Whenever you say something, this even will trigger.
on *:INPUT:*: {
 ; set variable %allchars to the total amount of characters you have written.
 set %allchars $calc(%allchars + $len($1-))
 ; set variable %allwords to the total amounts of words you have written. 
 set %allwords $calc(%allwords + $numtok($1-,32))

The next, more complex, example will replace all "moo"'s with "moo00oo00" in your text.

on *:INPUT:*: {
  ;nothing will change if you press control + enter or the first character is the command prefix     
  ;character you have specified in your mIRC options (usually "/").
  if (($ctrlenter) || ($left($1,1) == $readini(mirc.ini,text,commandchar))) { return }
  else {
   ; send the "new" text to the channel (but hidden)
   .msg $active $replace($1-,moo,moo00oo00)
   ; echo the "new" text in your current window (as it's the window you have just typed it)
   echo -t $active < $+ $me $+ > $replace($1-,moo,moo00oo00)
   ; stop the usual output

See Also

  • On Text Event to trigger to incoming text (PRIVMSG, "normal text").
  • $inpaste find out if the data thats being input is from a paste.