mIRC Home    About    Download    Register    News    Help

Print Thread
Replacing $address with *!*@host.* #151766 22/06/06 12:01 AM
Joined: Oct 2005
Posts: 5
O
OsTrailYa Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
O
Joined: Oct 2005
Posts: 5
is there anyway it is possible for me to get $address($nick,?) (? == wildcard) to display as *!*@host.*

Im on GameSurge and they use authsystem which replaces your host with Account.title.gamesurge

i want my ban script to ban *!*@Account.* so that people cant join unless they register a new auth account, this way even if they change there TITLE they still get banned via my ban script

If this is possible can you help me?


ive currently tried a replace and it does $replace($address($me,2),gamesurge,*) -> *!*@account.title.* and that doesnt really help, because people just change there title and they can reconnect.

Thanks in advanced

Re: Replacing $address with *!*@host.* #151767 22/06/06 12:39 AM
Joined: Aug 2005
Posts: 525
S
schaefer31 Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
mode $chan +b $+(*!*@,$gettok($gettok($address($nick(#Channel,N),2),2,64),1,46),.*)

Broken down with an example.

We have the following mask: John!Doe@JD.users.gamesurge.net

$gettok($address($nick(#Channel,N),2),2,64)

This will grab the 2nd token in the address that is separated by an @ characters (ascii value 64).

The result is: JD.users.gamesurge.net

The outer $gettok then takes from the previous token, the 1st token that is separated by a . character (ascii value 46).

The result is: JD

$+() is then used to concatenate everything together. At the beginning it starts with *!*@, followed by the code obtaining the account, then .*

Last edited by schaefer31; 22/06/06 02:46 AM.
Re: Replacing $address with *!*@host.* #151768 22/06/06 01:55 AM
Joined: Oct 2005
Posts: 5
O
OsTrailYa Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
O
Joined: Oct 2005
Posts: 5
that didnt seem to work =/

that does *!*@.*

**EDIT**

got it working smile

thanks for the starter

Last edited by OsTrailYa; 22/06/06 02:10 AM.
Re: Replacing $address with *!*@host.* #151769 22/06/06 04:55 AM
Joined: Oct 2005
Posts: 5
O
OsTrailYa Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
O
Joined: Oct 2005
Posts: 5
Quote:
mode $chan +b $+(*!*@,$gettok($gettok($address($nick(#Channel,N),2),2,64),1,46),.*)

Broken down with an example.

We have the following mask: John!Doe@JD.users.gamesurge.net

$gettok($address($nick(#Channel,N),2),2,64)

This will grab the 2nd token in the address that is separated by an @ characters (ascii value 64).

The result is: JD.users.gamesurge.net

The outer $gettok then takes from the previous token, the 1st token that is separated by a . character (ascii value 46).

The result is: JD

$+() is then used to concatenate everything together. At the beginning it starts with *!*@, followed by the code obtaining the account, then .*



so if i wanted to ban $2 using /blacklist NICK i'd just do this,


$+(*!*@,$gettok($gettok($address($2,2),2,64),1,46),.*) ??? or what?

lol, u lost me when u did the example text,

i got it working for myself, but it doesnt work for $2

i did echo -a $+(*!*@,$gettok($gettok($address($me,2),2,64),1,46),.*) and it replied with *!*@OsTrailYa.*

Last edited by OsTrailYa; 22/06/06 04:56 AM.
Re: Replacing $address with *!*@host.* #151770 22/06/06 05:22 AM
Joined: Aug 2005
Posts: 525
S
schaefer31 Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
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.*