jHIKa - Slaps Back It

By jHIKa on Mar 28, 2012

Please your copy this code in your remote Mirc for enjoy :D

on *:action:*:#:{
  if ($me isin $1-) && (!%fl) {
    inc -u10 %fl
    .timer 1 2 describe # $replace($1-,$me,$nick,$chr(36),$+($chr(36),!),$chr(37),$+($str($chr(2),2),$chr(37)),|,$+($str($chr(2),2),|))
  }
}

Comments

Sign in to comment.
fraguk   -  Mar 31, 2012

Nice 1 Meta :)

 Respond  
Spoof   -  Mar 30, 2012

Meta you have way too much free time... lol

 Respond  
Meta   -  Mar 29, 2012

First, I think I see what you are attempting to do with the long $replace, and I'll show you a trick I learned to make your job so much easier:

$!decode( $encode($reptok($strip($1-),$me,$nick,0,32),m) ,m)

*

The spaces here are necessary, as is the ! in $!decode, so don't omit them. What this will do is first encode the raw input with whatever encryption the m switch provides**, then decode that once the timer executes, returning the original string with nothing evaluated.

*I've decided to use $reptok rather than $replace, and I'll explain why later on.

**there was a specific reason for this, I think it has to do with parentheses and other such characters...

Second, the 'isin' check is an inefficient method for something like this because it runs the risk of false positives:

Say, for example, your nick is 'ger', and three other people in the channel are named "liger' 'gerbil' and 'lingerer'. (or something, I don't know)... If somebody, e.g., 'mel', slaps liger, gerbil, or lingerer, the script will trigger and you will slap mel for no reason...

Let me make a minor adjustment to that.

Because your script uses $replace, it will take any instance of 'ger' (or - your nick) in the string and replace it with 'mel'... So when mel slaps gerbil, the script will react and you will slap some person named melbil for no reason. Poor melbil! He/she's not even in the channel!

The best way to avoid these problems is to use something that only matches your nick exactly. Token identifiers work well, as can regex. Here's one regex-free way to do this:

on *:ACTION:*slaps*:#: {
  if ($istok($strip($1-),$me,32)) && (!%f1) {
    inc -u10 %f1
    .timer 1 2 describe # $!decode( $encode($reptok($strip($1-),$me,$nick,0,32),m) ,m)
  }
}

This should work for our purpose, and problems will only arise if your nick happens to be 'slaps'. However, it requires that your nick be a token exactly as is, so if you want to take it a step further, you can use regex - replace the $istok(...) with:

$regex($1-,/(?<![][}{a-z0-9^`|-])(Q $+ $me $+ E)(?![][}{a-z0-9^`|-])/gSi)

and the $reptok can be replaced with a similar $regsubex:

$regsubex($1-,/(?<![][}{a-z0-9^`|-])(Q $+ $me $+ E)(?![][}{a-z0-9^`|-])/gSi,$nick)

What these will do is not only check to see if your nick is a token within the string, but also match if your nick is immediately surrounded by characters that can't be used in nicks (at least according to someone).

So the code becomes something like this - (And I'll set a var to the regex match pattern to make things shorter):

on *:ACTION:*slaps*:#: {
  var %rgx /(?<![][}{a-z0-9_^`|-])(Q $+ $me $+ E)(?![][}{a-z0-9_^`|-])/gSi
  if ($regex($1-,%rgx)) && (!%f1) {
    inc -u10 %f1
    .timer 1 2 describe # $!decode( $encode($regsubex($1-,%rgx,$nick),m) ,m)
  }
}
 Respond  
KilllerX   -  Mar 29, 2012

Truly it will go off, whenever someone does a
/me [text] $me ($me being the bots nick) or having the text after $me.

So they could be welcoming you back, hugging, slapping, kissing, or whatever. As long as your name is included in a /me line, it will activate.

on *:action:*slap*:#:{
  if ($me isin $1- && slap isin $1- && !%fl) {
    inc -u10 %fl
    .timer 1 2 describe # $replace($1-,$me,$nick,$chr(36),$+($chr(36),!),$chr(37),$+($str($chr(2),2),$chr(37)),|,$+($str($chr(2),2),|))
  }
}

something like this would check for the slap. granted, there are better ways, of checking. as you could also

on *:action:*slap*:#:{
  if ($me isin $1- && !%fl) {
    inc -u10 %fl
    .timer 1 2 describe # $replace($1-,$me,$nick,$chr(36),$+($chr(36),!),$chr(37),$+($str($chr(2),2),$chr(37)),|,$+($str($chr(2),2),|))
  }
}

Just a couple ways. checking for the slap would help prevent spam, and unneeded triggers.

that is without stripping the colors. If you want to do that. look it up. I don't need it for myself, as the place I use it, doesn't allow, colored text.

 Respond  
blackvenomm666   -  Mar 28, 2012

if this is supposed to be a slap revenge script.first off you should be stripping colors with it second off you don't have a check for slap. this will go off if someone just does /me hugs yournickhere

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.