mIRC Home    About    Download    Register    News    Help

Print Thread
#116516 05/04/05 08:55 PM
Joined: Apr 2005
Posts: 2
Q
Bowl of petunias
OP Offline
Bowl of petunias
Q
Joined: Apr 2005
Posts: 2
I need some help here, i want to make a reply script, just like this:

Code:
 
  on *:TEXT:!example:#: {
  /notice $nick blablabla example.  


but i want to make it so that the script does NOT reply if chatters keep typing !example
So i want a protection that it can only reply once in 10 seconds or something like that.

I hope someone knows how to do this, thanks

#116517 05/04/05 09:09 PM
Joined: Feb 2005
Posts: 681
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Feb 2005
Posts: 681
on *:TEXT:!example:#: {
if (%did.example) return
set -u10 %did.example $true
notice $nick blablabla example
}

#116518 05/04/05 09:13 PM
Joined: Apr 2005
Posts: 2
Q
Bowl of petunias
OP Offline
Bowl of petunias
Q
Joined: Apr 2005
Posts: 2
i love u mIRCManiac wink laugh :tongue: cool

#116519 05/04/05 09:29 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
On *:Text:!example:#: {
  if ($hget(example,$nick)) { return }
  hadd -mu10 example $nick $true
  msg $chan This is an example.
}


10 seconds per nickname.

Last edited by SladeKraven; 05/04/05 09:30 PM.
#116520 05/04/05 09:32 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Seems you posted before me hehe, I tried to do what you did and it wouldn't work. I remembered I switched off remotes. mad

So I tried with hash tables instead.

#116521 05/04/05 11:39 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
just thought id show another way, it only works for blocking in total, not per nick, but makes ya code look real complexe smile It also isnt defeated by color codes etc

Code:
On *:Text:$($iif(($+(%example.blocker,!example) == $strip($1-)),$1-)):#channel: {
  set -su10 %example.blocker $cr
  msg $chan This is an example.
}

Since you cant send $cr $+ !example if %example.blocker still exists the $1- can never match it, thus the $iif fails and there is no match string.
$cr could also have been ctrl-k (aka ctrl-c) ctrl-r or ctrl-u as the strip removes them


That was just a little add on to what i have been using lately for getting around color codes which was where that method originated from

say you have
on *:text:!blah *:{ ... }
on *:text:!blob *:{ ... }

if you have to deal with bold/underlines/reverse & colorized text, you can do this
Code:
on *:text:& *:#channel: { 
 tokenize 32 $strip($1-)
 if ([color:blue]!blah *[/color] iswm $1-) { ... }
 elseif ([color:blue]!blob *[/color] iswm $1-) { ... }
}


but as we all know that then sucks up all the ON TEXT events

these well just attract the wanted event, and no others (ignoring BURKO codes)

on *:text:$($iif((!blah * iswm $strip($1-)),$1-)):#channel: { ... }
on *:text:$($iif((!blob * iswm $strip($1-)),$1-)):#channel: { ... }

Im sure some regex guru might be able to show me one that does that also, but i couldnt work one out, no matter how hard i tried.

I would have loved if you could have made it $nick and $chan specific, but nether of them have any value inside that $( ) frown so you cant check against specifci user flags like $($+(%,block.,$nick),2) which is a shame. I might go make that as a suggestion now.

#116522 06/04/05 01:01 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Yeah, hehe. smile

#116523 06/04/05 06:12 AM
Joined: Feb 2004
Posts: 206
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Feb 2004
Posts: 206
Quote:
on *:TEXT:!example:#: {
if (%did.example) return
set -u10 %did.example $true
notice $nick blablabla example
}


or?
Code:
  
on *:TEXT:!example:#: {
if (!%did.example) {
set -u10 %did.example $true
notice $nick blablabla example
}
} 


which reduces the number of return points from the routine.

Cheers,

DK


Darwin_Koala

Junior Brat, In-no-cent(r)(tm) and original source of DK-itis!
#116524 06/04/05 07:37 AM
Joined: Aug 2003
Posts: 314
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2003
Posts: 314
Another neat method I haven't come across before, one small thing about it though

Since the target part of the event hasn't been reached, that $() is evaluated for every channel/query text that your client receives, not just for ones specific to #channel. Just some extra processing that could be avoided by putting an if statement in the actual event

As for the regex in the matchtext:

Code:
on $*:text:/^!blah /iS:#channel:{


The 'S' modifier makes it ignore control codes in the string when looking for a match


Link Copied to Clipboard