mIRC Home    About    Download    Register    News    Help

Print Thread
help with gettok matchtok ect.. #133134 17/10/05 04:53 PM
Joined: Jan 2004
Posts: 133
W
WarlockW Offline OP
Vogon poet
OP Offline
Vogon poet
W
Joined: Jan 2004
Posts: 133
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 ?

Re: help with gettok matchtok ect.. #133135 17/10/05 05:21 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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)


Invision Support
#Invision on irc.irchighway.net
Re: help with gettok matchtok ect.. #133136 17/10/05 07:45 PM
Joined: Jan 2004
Posts: 133
W
WarlockW Offline OP
Vogon poet
OP Offline
Vogon poet
W
Joined: Jan 2004
Posts: 133
you rock smile

were i find a list of what ,32 ,58 ect mean ?

Re: help with gettok matchtok ect.. #133137 17/10/05 07:47 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
alias ascii var %a = 0 | while (%a < 256) { echo -a %a -> $chr(%a) | inc %a }


Gone.
Re: help with gettok matchtok ect.. #133138 17/10/05 08:17 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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).


Invision Support
#Invision on irc.irchighway.net
Re: help with gettok matchtok ect.. #133139 17/10/05 08:48 PM
Joined: Jan 2004
Posts: 133
W
WarlockW Offline OP
Vogon poet
OP Offline
Vogon poet
W
Joined: Jan 2004
Posts: 133
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

Re: help with gettok matchtok ect.. #133140 18/10/05 01:24 AM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Quote:
//echo -a $asc(#)
* /echo: insufficient parameters


//echo -a $asc($?)


Gone.
Re: help with gettok matchtok ect.. #133141 18/10/05 04:40 AM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
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
}

Re: help with gettok matchtok ect.. #133142 18/10/05 01:05 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
FiberOPtics, that's great! laugh

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


Invision Support
#Invision on irc.irchighway.net