mIRC Home    About    Download    Register    News    Help

Print Thread
#137676 17/12/05 12:17 PM
Joined: Dec 2004
Posts: 40
B
bog__ Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Dec 2004
Posts: 40
i have problem, if someone tupe, for example
!lvl some*26
or
!lvl loterdas*3885

mine script will set
%alo some*26
or
%alo loterdas*3885

But how do i split it where is * to

%firstword some
and
%secondword 26

Can someone help me?

#137677 17/12/05 12:34 PM
Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
$asc(*) returns 42

$gettok(loterdas*3885,1,42) returns loterdas
$gettok(loterdas*3885,2,42) returns 3885

Note that empty tokens are ignored, so $gettok(**********loterdas*****3885***,2,42) still returns 3885
More info: /help $gettok

#137678 17/12/05 12:37 PM
Joined: Nov 2005
Posts: 42
A
Ameglian cow
Offline
Ameglian cow
A
Joined: Nov 2005
Posts: 42
Treating your string as a tokenised list, with the * as the separator character use $gettok:

set %firstword $gettok(%alo,1,42)
set %secondword $gettok(%alo,2,42)

#137679 17/12/05 12:56 PM
Joined: Dec 2004
Posts: 40
B
bog__ Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Dec 2004
Posts: 40
it is working, thanks a lot grin

#137680 18/12/05 04:08 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
In addition to the examples with $gettok, it could be a good idea to read up on /tokenize, as it allows you to fill the $N params the way you please.

//tokenize 42 a*b | echo -a 1: $1 -- 2: $2


Gone.

Link Copied to Clipboard