mIRC Homepage
Posted By: sabbath on text with variables and wildcards - 01/02/08 06:50 AM
What I'm trying to do is to make an on TEXT event trigger on a set value that may appear anywhere in a sentence. I have no real idea about the syntax though. I assumed the syntax would be the same as for identifiers. So what I need is to match like this
Code:
on *:TEXT:*%bword*:#chan:{


I've tried translating from identifiers $(* $bword *) to (ie %(* %bword *)) but can't get that to work. All and any help is appreciated!
Posted By: argv0 Re: on text with variables and wildcards - 01/02/08 06:52 AM
Randomly trying combinations?

You didn't try $(* %bword *)

$() is an identifier, but %bword is still a variable, and will always have the % prefix
Posted By: DJ_Sol Re: on text with variables and wildcards - 01/02/08 08:46 AM
Quote:
I've tried translating from identifiers $(* $bword *) to (ie %(* %bword *)) but can't get that to work. All and any help is appreciated!


Your syntax is incorrect in both examples you show. You used '$bword' and '%( )'. It is '%bword' and '$( )'.

$(* %bword *)


Originally Posted By: "Help File"
$(...)

This identifier can only be used in the text match section of an event definition. It allows you to create a match parameter dynamically. You can use $1- to reference the incoming line.

on 1:TEXT:$(*hello $me $+ *):?:echo hello back!


Posted By: sabbath Re: on text with variables and wildcards - 01/02/08 09:53 AM
Yes I know I used the wrong syntax there. I as just giving an example. What I do currently use is $(* $me *) which is perfectly fine. wink I'll try with the %s again now. Thanks both of you. smile
Posted By: sabbath Re: on text with variables and wildcards - 01/02/08 09:59 AM
Originally Posted By: argv0
Randomly trying combinations?

You didn't try $(* %bword *)

$() is an identifier, but %bword is still a variable, and will always have the % prefix


That was the one! Thanks a bunch! Can't believe I missed that "obvious" combination. laugh
Posted By: XTZGZoReX Re: on text with variables and wildcards - 01/02/08 12:34 PM
Well, grats on making it work. Though, I prefer If-statements instead.
Posted By: DJ_Sol Re: on text with variables and wildcards - 01/02/08 06:50 PM
I tend to use if statements as well, but the nice thing about this style is you can have more than one text event in a file instead of one that handles a bunch of if statements.
Posted By: Mpdreamz Re: on text with variables and wildcards - 01/02/08 07:06 PM
anything in $() is always evaluated though even if it doesn't match, which is quite obvious. So depending on what it holds it might not always be very efficient.

You can always use more then one on text in a file as long as the match text doesn't cancel others out.
Posted By: XTZGZoReX Re: on text with variables and wildcards - 05/02/08 10:52 AM
I'm pretty sure it's faster to have one on TEXT event instead of having multiple events that mIRC must go through, though.
Posted By: foshizzle Re: on text with variables and wildcards - 05/02/08 08:46 PM
if this hasnt aredy been stated, you can use
Code:
on *:TEXT:*:#: {
  if (blah* iswm $1) {
    do blah
  }
}

thats an easy way to do something... i think thats what your asking..
im not really reading what youve posted/ others posts
© mIRC Discussion Forums