From WikiChip
Difference between revisions of "mirc/groups"
< mirc

 
(2 intermediate revisions by the same user not shown)
Line 13: Line 13:
 
Effectively disables the '''myalias''' alias. The keyword that can appear after the #group_name on top are "on" to enable it or "off", to disable it. At the bottom the keyword is always "end".
 
Effectively disables the '''myalias''' alias. The keyword that can appear after the #group_name on top are "on" to enable it or "off", to disable it. At the bottom the keyword is always "end".
  
You can use {{mIRC|/enable}} #group and {{mIRC|/disable}} #group to enable/disable a group, you can use {{mIRC|$group}} to get the state of a group, its name, and the file in which the group can be found.
+
You can use {{mIRC|/enable}} #group and {{mIRC|/disable}} #group to enable/disable a group, you can use {{mIRC|$group}} to get the state of a group, its name, and the file in which the group can be found. You can use {{mIRC|/groups}} to list the groups.
{{mirc guide}}
+
 
 +
'''Note''': You cannot nest groups. Using /disable or /enable implies mIRC writes to the file to change the keyword above, to either on or off.
 +
 
 +
Groups are useful for speeding mIRC overall with your scripts, if you use if statement as an on/off %variable to ignore code, mIRC still has to trigger you code:
 +
 
 +
on *:text:*:#:{
 +
  if (%enabled) {
 +
  ;some code
 +
  }
 +
}
 +
vs
 +
 
 +
#group on
 +
  on *:text:*:#:{
 +
  ;some code
 +
}
 +
#group end 
 +
 
 +
On a channel with a lot of activity and/or if you have a lot on text event, in the first code, mIRC will trigger the on text event for all messages, which means running the scripting engine, which means a lot of processing for no reason.
 +
 
 +
For the second code with the group, after you disable the group mIRC never execute the on text event. Groups also do not require a ressource like a %variable.

Latest revision as of 13:59, 17 August 2018


Inside the script editor, you can use group to disable/enable a whole piece of code, an alias, an on text event, a menu, a dialog etc.

#group_name off
alias myalias {
  echo -a hey!
}
#group_name end

Effectively disables the myalias alias. The keyword that can appear after the #group_name on top are "on" to enable it or "off", to disable it. At the bottom the keyword is always "end".

You can use /enable #group and /disable #group to enable/disable a group, you can use $group to get the state of a group, its name, and the file in which the group can be found. You can use /groups to list the groups.

Note: You cannot nest groups. Using /disable or /enable implies mIRC writes to the file to change the keyword above, to either on or off.

Groups are useful for speeding mIRC overall with your scripts, if you use if statement as an on/off %variable to ignore code, mIRC still has to trigger you code:

on *:text:*:#:{
 if (%enabled) {
 ;some code
 }
}

vs

#group on
 on *:text:*:#:{
 ;some code
}
#group end  

On a channel with a lot of activity and/or if you have a lot on text event, in the first code, mIRC will trigger the on text event for all messages, which means running the scripting engine, which means a lot of processing for no reason.

For the second code with the group, after you disable the group mIRC never execute the on text event. Groups also do not require a ressource like a %variable.