mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2006
Posts: 307
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Feb 2006
Posts: 307
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

Joined: Mar 2003
Posts: 612
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
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 }
}


billythekid
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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.


Invision Support
#Invision on irc.irchighway.net
Joined: Feb 2006
Posts: 307
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Feb 2006
Posts: 307
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....

Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
on *:TEXT:*:?:{
if (hello isin $1-) { %hello = 1 }
elseif (%hello) && (how*are*you iswm $1-) { msg $nick I hate you | unset %hello }
}


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
I'd probably put $strip around the $1- just to avoid color issues.


Invision Support
#Invision on irc.irchighway.net
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
True


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
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

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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


Invision Support
#Invision on irc.irchighway.net
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
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 }

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
It's probably that double eval that gets me. Heh.


Invision Support
#Invision on irc.irchighway.net
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
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

Joined: Mar 2003
Posts: 612
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
you wouldn't need to $strip for an iswm match wink


btk


billythekid
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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.


Invision Support
#Invision on irc.irchighway.net
Joined: Feb 2006
Posts: 307
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Feb 2006
Posts: 307
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


Link Copied to Clipboard