mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
OP Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Hi there,

I was trying to return the word that actually matched the IF statement, but wasn't able to smirk I tried a few $identifers, such as $ifmatch, $v1 and $v2, but nothing. I've also tried $matchkey, although I couldn't reproduce it's funcion nor understand it, based on the help file.

Eg:
alias test {
if (*test* iswm $$1-) { echo -ag * Yes: [color:red]<matched word>
}
else { echo -ag * No }
}
[/color]

If $$1- is 'This is me testing' then <matched word> should be 'testing'

Thanks,
Zyzzyx smile

Edit: thanks milosh - typo

Last edited by Zyzzyx26; 01/09/04 10:08 PM.
Joined: Dec 2003
Posts: 259
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Dec 2003
Posts: 259
How can $$1 be "'This is me testing"?

Joined: Feb 2004
Posts: 714
Z
Hoopy frood
OP Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Typo there. The post has been edited, thanks smile

Joined: Dec 2003
Posts: 259
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Dec 2003
Posts: 259
I know grin Just kidding grin
So:
Code:
alias test {
  var %i = 1
  :start
  var %mword = $ $+ %i
  if (*test* iswm %mword) { echo -ag * Yes: %mword | goto end }
  else { echo -ag * No | goto end }
  goto start
  :end
}

Not tested!

Joined: Feb 2004
Posts: 714
Z
Hoopy frood
OP Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
lol :P

There is an /inc %i missing in the code, plus an $eval I think. I was actually looking for an identifier of some kind, because the script it is going to be used in already has its quota of loops.

Zyzzyx smile

Joined: Dec 2003
Posts: 259
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Dec 2003
Posts: 259
lol? Don't expect help from me next time. There's probably many many of them that will help, so it's not some loss. I was just trying to give some ideas as fast as I can...
Note: If you know what's missing, good for you... add it by yourself.

Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
alias test {
if ($matchtok($$1-,test,1,32)) echo -a Matched word: $v1
else echo -a nothing...
}

Joined: Feb 2004
Posts: 714
Z
Hoopy frood
OP Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
I tend to answer/reply the posts in the order they came..

Quote:
I know grin Just kidding grin
Answer -> lol :P

<code></code> the result of the test I ran.

I don't look for fights in places people help other people, a thing that is becoming rare thing in these days.. Sorry if it cause any misunderstanding, I'll try to be clearer next time.

Joined: Dec 2003
Posts: 259
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Dec 2003
Posts: 259
Sorry, friend.

Joined: Feb 2004
Posts: 714
Z
Hoopy frood
OP Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Dont worry smile

Joined: Feb 2004
Posts: 714
Z
Hoopy frood
OP Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
I hadn't thought about $matchtok or $wildtok, thanks smile

Joined: Feb 2004
Posts: 2,013
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Feb 2004
Posts: 2,013
Quote:
How can $$1 be "'This is me testing"?


It's perfectly possible for the parameter $1 to be filled with multiple tokens. It all depends on the delimiter.

//tokenize 44 one two,three four | echo -a $1 will show you "one two", which is actually 2 words.

Greets

Joined: Jan 2003
Posts: 2,973
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Jan 2003
Posts: 2,973
.echo -q $test(This is me testing)


Link Copied to Clipboard