Originally Posted By: sparta
I'm new to $gettok, not everyone can the scripting language at once.


You've been here since 2003, and I've lost count of how many times people have told you about the mIRC help file. I understand that you might've forgotten how to script, but you can learn in the same way you could 3/4 years ago: by reading the help file.

Perhaps if you don't understand something, you should post the script and ask how to find the answers for yourself? That way you'll learn as well as be pointed in the right direction.

In this case, to figure out what was wrong, all you had to do was check what character has the ascii number of 48 by typing //echo -a $chr(48). How did you come up with the number 48 in the first place? I'm guessing you typed //echo -a $asc(/), and then memorised the wrong number in your head.

$gettok() is incredibly simple. It simply splits a string into pieces at each point where the character specified is found, and then returns the Nth piece.

$gettok(a.b.c.d,1,46)

mIRC will split the string into four tokens:

a
b
c
d

This is because you've specified 46 as the final parameter, which is the asc number for a dot: .

Now, mIRC will return the 1st token in that list, because you specified 1 in the second parameter. The first token is 'a'

Similar examples:

$gettok(a!b c!d e f!g,3,33)

Tokens:

a
b c
d e f
g

This is because 33 is the ascii number for an exclamation point: !

mIRC returns 'd e f' because that is the third token.

However, if you were to supply 32 as the ascii number instead (a space), the tokens would be:

a!b
c!d
e
f!g

It's not really mindblowing stuff, and the help file explains it in-depth. I'm not sure what you couldn't work out from the help file, are you sure you read it thoroughly, more than once?

Originally Posted By: sparta

48 replaced with 47 did the trick.

$gettok($did(3).sel,1,47)


Do you not think this is something you could've worked out yourself from the start? If something isn't working properly, echo each of the parameters you're passing to the identifier just to make sure you're passing what you're supposed to. If you're passing things like ascii numbers as parameters, then try finding out what their character is by typing //echo -a $chr(<ascii number>) - that will at the very least let you know whether you're using the right number or not. What you need to do is learn how to debug your own scripts.