mIRC Homepage
hello

to respond to private msg:

hello

I need to do this:

on 1:text:hello:? say hello you too!

but what if I want to respond this prv msg:

hello
how are you?

with a:

I am fine, u?

I mean, how to identify text in more than one continuous lines?

thanks
Code:
on 1:text:[color:red]*[/color]:?:{
if ( hello isin $1- ) { msg $nick hello yourself }
elseif ( how*are*you iswm $1- ) { msg $nick I am great }
elseif ( a/s/l isin $1- ) { msg $nick too old/not enough/nowhere near you lamer }
elseif ( anything isin $1- ) { msg $nick your reply here }
}
To expand on that, it sounds like he wants it to trigger on the second line, only if the first line matched as well. If that's the case, then you'd want to set a variable when the first line matches, then check that variable for the second line.

Example:
Someone says "How are you?" and you don't want it to trigger unless they first said "Hello". If that's the case, you would do something like...

Hello
* set variable stating that Hello was said
How are you?
* check variable to see if Hello was said. If so, respond. If not, do nothing.
Riamus2 exactly

the hello thing was just an example

I want what I state on the title: identify text of multiple lines as a whole

if a line is "hello" AND the next line is "how are you" : do something....
on *:TEXT:*:?:{
if (hello isin $1-) { %hello = 1 }
elseif (%hello) && (how*are*you iswm $1-) { msg $nick I hate you | unset %hello }
}
I'd probably put $strip around the $1- just to avoid color issues.
True
if a line is "hello" AND the next line is "how are you" : do something....


does it matter if its the same person saying it, or is it just a blabber mouth that responds to whatever
Good point. If you care about who says it, then you should tack on the nick to the variable name.

for the set line (after they say hello): set -u60 %hello. $+ $nick 1
for the check line (after they say how are you): if (%hello. [ $+ [ $nick ] ]) { do commands here }

Before anyone says you can combine those using $+(%hello.,$nick) or whatever, I know that... I just seem to have issues making it work 100% of the time, so I just use brackets. Yeah, yeah... I know I should learn, but... well... I guess I'm lazy. Heh. Feel free to explain using it with $+() instead if you really want to. laugh
Here's Riamus' code using $+()

for the set line (after they say hello):
set -u60 $+(%,hello.,$nick) 1
for the check line (after they say how are you):
if $($+(%,hello.,$nick),2) { do commands here }
It's probably that double eval that gets me. Heh.
The use of [ $+ [ something ] ] while working isnt correct method your using [ and ] in ways they werent really ment for. (imho)

heres a real usage

alias ex { echo $null($input($chr(32),o,Press Ok)) You took $calc($ticks - [ $ticks ] ) $!ticks to press ok }

The $null( ) is just a $null passed something so it doesnt return anything (this just dumps the $inputs result)
But your forcing evalaution on the 2nd $ticks before anything else so its done then the $null($input) then first $ticks get evaluated, and thus u have a post $input $ticks minus a pre $input $ticks, giving the resulting time in ticks

a findfile is a good example as well

//echo -a located a total of $findfile( ......... ) file(s) taking $calc($ticks - [ $ticks ] / 1000) seconds.
(i left out the find file criteria, but you know sometimes this takes from ms to 30 seconds depending how much to search)


$ifmatch $v1 and $v2 are also other things that i have needed to use [ ] on

if ($read(file,w,*text*)) { echo -a $iif(%premarkup,**********) found [ $v1 ] $iif(%postmarkup,**********) }

if the [ ] were missed the $v1 value from the IF is lost in the $iif evaluation
you wouldn't need to $strip for an iswm match wink


btk
Quote:

(how*are*you iswm $1-)


As formatted, this will *not* work if $1- is:

04How are you

For that matter, just a:

How are you?

would fail in that situation. Notice where the *'s are.

Finally, let's say that it's:

How are you?

That would fail even if you did *how*are*you* iswm $1- . You should use $strip on $1- to prevent such problems.
thank you for your replies

can you tell me how the script will be?

ofcourse it must work for what others prv msg me, not my sayings

I dont want it to work on color, bold etc stuff, just plain text

thanks
© mIRC Discussion Forums