By your example of /blacklist NICK...

NICK would be $1 and not $2.


About the example, I'll try to explain it in an easier to understand fashion.

Firstly, we are using the $gettok identifier (short for Get Token), which takes 3 parameters.

The first parameter is the text string.

The second parameter is the token number.

The third parameter is the ascii value of the separating character.



I will use the same mask for this example of: John!Doe@JD.users.gamesurge.net

If you look at that mask, you might see that there are many ways of splitting it apart. One way, for example would be to split it by periods. Doing so would result in the following 4 tokens:

The . has an ascii value of 46 - //echo -a $asc(.)

1: John!Doe@JD - //echo -a $gettok(John!Doe@JD.users.gamesurge.net,1,46)
This is everything to the left of the first period in the mask.

2: users - //echo -a $gettok(John!Doe@JD.users.gamesurge.net,2,46)
This is everything between the first and second periods in the mask.

3: gamesurge - //echo -a $gettok(John!Doe@JD.users.gamesurge.net,3,46)
This is everything between the second and third periods in the mask.

4: net - //echo -a $gettok(John!Doe@JD.users.gamesurge.net,4,46)
This is everything to the right of the last period in the mask.

Another way would be to split it by the exclamation point which would result in the 2 tokens:

The ! has an ascii value of 33 - //echo -a $asc(!)

1: John - //echo -a $gettok(John!Doe@JD.users.gamesurge.net,1,33)
This is everything to the left of the exclamation point in the mask.

2: Doe@JD.users.gamesurge.net - //echo -a $gettok(John!Doe@JD.users.gamesurge.net,2,33)
This is everything to the right of the exclamation point in the mask.

Lastly, we can split it by the @ character, which also results in two tokens:

The @ has an ascii value of 64 - //echo -a $asc(@)

1: John!Doe - //echo -a $gettok(John!Doe@JD.users.gamesurge.net,1,64)
This is everything to the left of the @ in the mask.

2: JD.users.gamesurge.net - //echo -a $gettok(John!Doe@JD.users.gamesurge.net,2,64)
This is everything to the right of the @ in the mask.


So, given that information if you look at the code you see that $gettok is used twice.

The inner-most $gettok returns the second token separated by an @ character, which going by the example mask would be JD.users.gamesurge.net

Then the outer $gettok is used on JD.users.gamesurge.net to grab the first token separated by a period, which is JD.

Then I used $+() which concatenates *!*@ to the left side of JD and .* to the right. The final result is *!*@JD.*