mIRC Home    About    Download    Register    News    Help

Print Thread
#128650 27/08/05 11:52 PM
Joined: Aug 2003
Posts: 66
B
bynw Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Aug 2003
Posts: 66
Here is my current script:

Code:
  

on *:SNOTICE:*is doing a /whois on you*:{
  echo 4 -at You have been WHOIS'ed by $left($1,($pos($1,$chr(40),1)-1))
}



And this is the exact syntax of the SNOTICE:
[18:50:47] -chat.psionics.net- Martine(~Martine@ool-435221b7.dyn.optonline.net) is doing a /whois on you.

But the echo just returns:
[18:50:47] You have been WHOIS'ed by

I want it to return the nick of the user ... but cant get it to do that

Thanks

#128651 27/08/05 11:56 PM
Joined: Feb 2005
Posts: 681
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Feb 2005
Posts: 681
on *:SNOTICE:*is doing a /whois on you*: {
echo 4 -at You have been WHOIS'ed by $gettok($1,1,40)
}

~ Edit ~
If you really want to do it your way with $left & $pos,
the only reason yours didn't work was you left out $calc.

Yours: $left($1,($pos($1,$chr(40),1)-1))
Correct: $left($1,$calc($pos($1,$chr(40),1)-1))

Last edited by mIRCManiac; 28/08/05 12:07 AM.
#128652 28/08/05 12:05 AM
Joined: Aug 2003
Posts: 66
B
bynw Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Aug 2003
Posts: 66

Thanks, that does work great ... now I just want to understand it.

#128653 28/08/05 09:28 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Read up on Token Identifiers

/help Token Identifiers

#128654 29/08/05 02:03 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
$gettok($1,1,40)

Here's an explanation... I'll explain it backwards because that will probably make the most sense. smile

The final parameter (40) is how we're splitting the text up. $chr(40) is (. So, this will split your $1 into parts everywhere there is a (. These parts are called tokens.

An easy way to look at it is with $gettok(this is a test,1,32)

$chr(32) is a space, so "this is a test" would be broken up at every space. That means there are 4 tokens (words).

The second parameter (1) is the token we want to use.

And, the first is the text we're examining.

So, if we look at your snotice:

[18:50:47] -chat.psionics.net- Martine(~Martine@ool-435221b7.dyn.optonline.net) is doing a /whois on you.

Then, the $1 is the actual notice (that doesn't include the timestamp or the person who noticed you).

So, $1 is:

Martine(~Martine@ool-435221b7.dyn.optonline.net) is doing a /whois on you.

If we break it apart at the $chr(40)'s, then we get 2 tokens:

Martine
~Martine@ool-435221b7.dyn.optonline.net) is doing a /whois on you.

We want token #1 (Martine).

I hope that makes sense to you. smile

As a final note, whatever $chr you are breaking your tokens apart at will *not* be included anywhere in your final ouput. Just like with words, you split them at the spaces and the spaces are not attached to the words after you split the sentence up... you just have words. That's why you don't see a ( on the two tokens above.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard