Access Levels

 

Access levels are assigned both to a user and to an event and serve to limit a user's access to only certain events.

 

The default access level is 1 for users that are not listed in the Users list. All users can access level 1 events. The higher a user's access level is, the more events that user can access. You can change the default user level to allow unlisted users to access more commands.

 

User List

In the Users section you can specify a list of users and their access levels using the format:

 

<level1,level2,...,levelN>:<useraddress>

 

3,5,6:nick!user@mirc.com

 

The first level is a general access level, which means that the user can access all levels equal to or less than 3. All the other levels are levels that an event must specifically have to allow a user to access it.

 

If you want to force the first access level to be a specific level instead of a general access level, you can prefix it with an equal sign.

 

=3,5,6:nick!user@mirc.com

 

Now this user has access specifically to level 3, 5, and 6 event and to no other events.

 

Event Format

In general the format of an event is:

 

<prefix> <level>:<event>:<window>:<commands>

 

ctcp 1:HELP:*:/msg $nick No help is available for level 1 users

 

The above ctcp command can be accessed by all users because it is a level 1 command. So if a user with nickname goat sends you a /ctcp yournick HELP, your script will send them the above reply.

 

Only the highest level matching event is triggered for a user.

 

Named Levels

You can also used named levels which work the same way as a specific level but are easier to understand and read than a number.

 

friend:nick!user@mirc.com

 

on @friend:JOIN:#mIRC:/mode $chan +o $nick

 

This treats the word friend as a specific access level and matches the user with the event, and because the user is your friend, you give him ops.

 

Event Prefixes

You can limit access to an event by specifying a special prefix which determines how an event is processed or triggered by users.

 

The me prefix

You can limit an event to trigger only to your actions by using the me prefix. For example, the following event will only trigger when you join a channel:

 

on me:*:JOIN:#:/msg # Hello to one and all!

 

The ^ prefix

You can prevent the default text for an event from being shown by using the ^ prefix in an event definition. See Halting Text for details.

 

The + prefix

You can limit an event to users with a specific access level by using the + prefix.

 

10:nick!user@mirc.com

 

ctcp +5:HELP:*:/msg $nick You have accessed a level +5 event

 

The above user cannot access this ctcp event even though he has an access level higher than 5 because the event is limited only to level 5 users.

 

The * prefix

You can allow any user to trigger an event regardless of their access level by using the * prefix.

 

on *:TEXT:help:#:/msg $nick you have accessed a * level event

 

The ! prefix

You can prevent an event from being triggered if it was initiated by you by using the ! prefix.

 

ctcp !2:HELP:*:/msg $nick You have accessed a level 2 event

 

You would be unable to access the above event regardless of your access level.

 

The @ prefix

You can limit events to being executed only when you have Ops on a channel by using the @ prefix.

 

10:nick!user@mirc.com

 

on @2:JOIN:#mIRC:/mode $chan +o $nick

 

When the above user joins channel #mIRC and you have Ops on #mIRC, the associated /mode command will be executed, in this case giving the user Ops. If you do not have Ops, the event will not trigger.

 

The & prefix

You can prevent an event from being triggered if a previous script used /halt or /haltdef to halt the display of default text for an event by using the & prefix.

 

on &1:TEXT:*:?:/echo this event will not trigger if $halted is true

 

The $ prefix

Indicates that the matchtext section of a definition contains a regular expression.

 

on $*:TEXT:m/regular expression/switches:#:/echo message: $1-

 

The m and the switches are optional. The // are required. If switches are used they must be standard PCRE switches, otherwise the match will fail. You can use switch S to strip control codes from $1-.

 

The = suffix

You can prevent users with higher access levels from accessing all lower access level events by using the = suffix.

 

10:nick!user@mirc.com

 

ctcp 2:HELP:*:/msg $nick You have accessed a level 2 event

ctcp 5:HELP:*:=

 

The above user cannot access any of these events because the level 5 event prevents him from accessing all HELP events with access levels lower than 5.

 

The ! suffix

You can prevent commands for a certain event level from being processed by using the ! suffix.

 

ctcp 5:PING:*:echo PING!

ctcp 5:*:*:!

 

The ! at the end of the line tells the remote to halt any further processing of level 5 commands.

 

Groups

You can create separate groups in scripts by using the # hash prefix.

 

#group1 on

...

[ list of events ]

...

#group1 end

 

You can use the /enable and /disable commands to enable or disable groups. A group that is disabled will be ignored when processing events. A disabled group looks like this:

 

#group1 off

...

[ list of events ]

...

#group1 end

 

You cannot have groups within groups.

 

Order of definitions

Many of the prefixes and controls are sensitive to numerical order of the definitions. The safest thing is to order your definitions starting with the lowest access levels first and increasing numerically down the list, this makes it easier to keep track of which events should trigger first.