Difference between revisions of "Haltdef"

From Scriptwiki
Jump to: navigation, search
(you -> use)
(fixed typo and added example for events that do not want the ^ prefix)
Line 8: Line 8:
 
You can check if a script has already halted the default text by using the $halted identifier; it returns $true if a user has used /halt or /haltdef in a ^ event, and $false if not.
 
You can check if a script has already halted the default text by using the $halted identifier; it returns $true if a user has used /halt or /haltdef in a ^ event, and $false if not.
  
The ^ event prefix currently works only on the following types of events: [[On_action|ACTION], [[On_ban|BAN]], [[On_chat|CHAT]], [[On_dehelp|DEHELP]], [[On_deop|DEOP]], [[On_devoice|DEVOICE]], [[On_help|HELP]], [[On_invite|INVITE]], [[On_join|JOIN]], [[On_kick|KICK]], [[On_mode|MODE]], [[On_nick|NICK]], [[On_notice|NOTICE]], [[On_op|OP]], [[On_open|OPEN]], [[On_part|PART]], [[On_ping|PING]], [[On_text|TEXT]], [[On_unban|UNBAN]], [[On_usermode|USERMODE]], [[On_voice|VOICE]], [[On_quit|QUIT]], [[On_serv|SERV]], [[On_servermode|SERVERMODE]], [[On_snotice|SNOTICE]], [[On_topic|TOPIC]], [[On_wallops|WALLOPS]].
+
The ^ event prefix currently works only on the following types of events: [[On_action|ACTION]], [[On_ban|BAN]], [[On_chat|CHAT]], [[On_dehelp|DEHELP]], [[On_deop|DEOP]], [[On_devoice|DEVOICE]], [[On_help|HELP]], [[On_invite|INVITE]], [[On_join|JOIN]], [[On_kick|KICK]], [[On_mode|MODE]], [[On_nick|NICK]], [[On_notice|NOTICE]], [[On_op|OP]], [[On_open|OPEN]], [[On_part|PART]], [[On_ping|PING]], [[On_text|TEXT]], [[On_unban|UNBAN]], [[On_usermode|USERMODE]], [[On_voice|VOICE]], [[On_quit|QUIT]], [[On_serv|SERV]], [[On_servermode|SERVERMODE]], [[On_snotice|SNOTICE]], [[On_topic|TOPIC]], [[On_wallops|WALLOPS]].
  
 
Though, you can use haltdef for [[:Category:Raws|raws]] too, stopping their default output.
 
Though, you can use haltdef for [[:Category:Raws|raws]] too, stopping their default output.
Line 15: Line 15:
  
 
== Example ==
 
== Example ==
  On ^*:Text:*fuck*:*: {
+
  on ^*:TEXT:*fuck*:*: {
  haltdef
+
  haltdef
 
  }
 
  }
 
This would stop mIRC showing a sentence containing the word "fuck", both in a channel or in private.
 
This would stop mIRC showing a sentence containing the word "fuck", both in a channel or in private.
  
  
  on ^1:OPEN:?:*: {
+
  on ^*:OPEN:?:*: {
  if ([[$istok]](Spam1 Spam2 eriowj,$nick,32)) {
+
  if ([[$istok]](Spam1 Spam2 eriowj,$nick,32)) {
  halt
+
    halt
  }  
+
  }
 
  }
 
  }
This example would pretend mIRC opening a chat window if someone called "Spam1", "Spam2" or "eriowj" queries you.
+
This example would prevent mIRC opening a query window if someone called "Spam1", "Spam2" or "eriowj" queries you.
 +
 
 +
on *:[[On_input|INPUT]]:*: {
 +
  if (![[$ctrlenter]] && [[$left]]([[$1|$1-]],1) != [[$readini]](mirc.ini,text,commandchar)) {
 +
    haltdef
 +
    echo $color(Own) -tam ( $+ $me $+ ) $1-
 +
    .msg $active $1-
 +
  }
 +
}
 +
 +
on ^*:TABCOMP:*: {
 +
  haltdef
 +
}
 +
The two above examples allow you to halt the default mIRC actions, note the lack of ^ prefix.
 +
The first example changes the look of the text you type and the second halts the tab auto-complete functionality.
  
 
[[Category:Commands]]
 
[[Category:Commands]]

Revision as of 18:59, 30 July 2006

Stops mIRCs default text for various types of IRC Server events.

/haltdef

To stop mIRCs default text, you need to use the ^ event prefix in the specific event. So you can either use haltdef, that only halts the default text without halting the entire script, or halt, that stops the entire script.

Note that the ^ event doesn't replace your existing event. Your normal event is independent and is still processed whether there is a ^ event in a script or not.

You can check if a script has already halted the default text by using the $halted identifier; it returns $true if a user has used /halt or /haltdef in a ^ event, and $false if not.

The ^ event prefix currently works only on the following types of events: ACTION, BAN, CHAT, DEHELP, DEOP, DEVOICE, HELP, INVITE, JOIN, KICK, MODE, NICK, NOTICE, OP, OPEN, PART, PING, TEXT, UNBAN, USERMODE, VOICE, QUIT, SERV, SERVERMODE, SNOTICE, TOPIC, WALLOPS.

Though, you can use haltdef for raws too, stopping their default output.

Note that halting the default text for an event affects how mIRC displays the most basic information about IRC events to a user, so it should be used carefully.

Example

on ^*:TEXT:*fuck*:*: {
  haltdef
}

This would stop mIRC showing a sentence containing the word "fuck", both in a channel or in private.


on ^*:OPEN:?:*: {
  if ($istok(Spam1 Spam2 eriowj,$nick,32)) {
    halt
  }
}

This example would prevent mIRC opening a query window if someone called "Spam1", "Spam2" or "eriowj" queries you.

on *:INPUT:*: { 
  if (!$ctrlenter && $left($1-,1) != $readini(mirc.ini,text,commandchar)) { 
    haltdef
    echo $color(Own) -tam ( $+ $me $+ ) $1-
    .msg $active $1-
  }
}

on ^*:TABCOMP:*: {
  haltdef
}

The two above examples allow you to halt the default mIRC actions, note the lack of ^ prefix. The first example changes the look of the text you type and the second halts the tab auto-complete functionality.