mIRC Homepage
Posted By: WarlockW help with gettok matchtok ect.. - 17/10/05 04:53 PM
alias get-info {
window -alkC @ALL-INFO
if $sline($active,1) {
var %info = $strip($sline($active,1))
var %info1 = $matchtok(%info,said:*,1,32)
var %info2 = $wildtok(%info,said:*,1,32)
}
echo $me info1
echo $me info2
}

tring to get all info AFTER the SAID:
in a custom window from the selected line

Any help ?
Posted By: Riamus2 Re: help with gettok matchtok ect.. - 17/10/05 05:21 PM
Are there colons before "said:"? If not, then you can use:

$gettok(%info,2,58)

Or, if you always have the same number of words before the "said:"

Riamus said: hi
WarlockW said: hey

Then, you could do $gettok(%info,3-,32)
Posted By: WarlockW Re: help with gettok matchtok ect.. - 17/10/05 07:45 PM
you rock smile

were i find a list of what ,32 ,58 ect mean ?
Posted By: FiberOPtics Re: help with gettok matchtok ect.. - 17/10/05 07:47 PM
alias ascii var %a = 0 | while (%a < 256) { echo -a %a -> $chr(%a) | inc %a }
Posted By: Riamus2 Re: help with gettok matchtok ect.. - 17/10/05 08:17 PM
Lol. laugh

Besides getting a list like the script above, you can also do:

//echo -a $chr(N)

Replace N with the number you're looking for. So, //echo -a $chr(58) as an example.

The reverse of that is $asc. So, if you need the ascii code rather than the character, you can use:

//echo -a $asc(N)

Replace N with the character you want the number for.

So, if I want to see what the ascii code for A is, I'd type //echo -a $asc(A). Remember that "A" and "a" have different ascii codes.

Certain mIRC commands (such as the token commands) need you to use the ascii code instead of the letter. And, sometimes, you need to use the $chr identifier for certain characters to display in a script. For example, if you want to do:

$gettok(Hey, that's cool,1,32)

... the comma in the text would cause a problem because commas are used to separate the parts of the identifier. You could put that text into a variable and use that, or you could replace the comma with $chr(44), which is a comma as well -- type //echo -a $chr(44) . In this case, 32 is a space. 1 is just which token you want.

Just as one last note... using $asc(N) won't always work. Certain characters aren't possible in there, such as commas and parentheses. In those cases, you can either look up an ascii table, or you can mess around with characters near what you're looking for...

//echo -a $asc(#)
* /echo: insufficient parameters

//echo -a $asc($)
36

So, I'd guess $ and # would be close in number...

//echo -a $chr(35)
#

In that case, it was easy... just one number off. It's not always that easy, but if you want to avoid looking it up in an ascii table, you can do this and usually find it quickly. Eventually, you memorize all the main ascii codes (space, comma, period, parentheses, #, and if you're using sockets, <>'s).
Posted By: WarlockW Re: help with gettok matchtok ect.. - 17/10/05 08:48 PM
Nice thanks for all the help !

you guys sure know your Stuff smile

I am Such a hack lol but usely can make things work ..

Thanks agin !

BTW - new post ! help ! lol
Posted By: FiberOPtics Re: help with gettok matchtok ect.. - 18/10/05 01:24 AM
Quote:
//echo -a $asc(#)
* /echo: insufficient parameters


//echo -a $asc($?)
Posted By: MikeChat Re: help with gettok matchtok ect.. - 18/10/05 04:40 AM
a handy alias to have so you dont have to guess is along these lines
Code:
alias asciilist {
  var %num = 33
  var %pos = 1
  var %string = ""
  while (%num &lt;= 126) {
    if (%pos &gt; 5) { echo -a %string | var %pos = 1 | var %string = "" } 
    var %string = %string $+($,chr,$chr(40),%num,$chr(41)) $chr(%num)
    inc %num
    inc %pos
  }
  echo -a %string
}
Posted By: Riamus2 Re: help with gettok matchtok ect.. - 18/10/05 01:05 PM
FiberOPtics, that's great! laugh

I was trying to escape it using ! ... didn't think to try ?. smile
© mIRC Discussion Forums