/slap - Reinvented

Platform:  mIRC
Published  Feb 10, 2009
Updated  Jun 14, 2011
This snippet slaps a user with anything but a large trout.

Syntax: /slap NickName

If a user is not provided, it slaps the user(s) selected in the nicklist. If no user is selected/provided then nothing happens.

If you use this in a window that is not a channel/query/chat window, do not say it has a bug. You are simply just retarded.

EDIT: 14 JUN 2011
FIXED: 31 OCT 2010
FIXED: 26 MAY 2009 ;Slapper
;napalm - 14 JUN 2011

alias slap {
var %n $iif($1,$1,$$snicks)
if ($sock(slap)) sockclose slap
sockopen slap www.watchout4snakes.com 80
sockmark slap $active %n
}

alias slap.error echo $color(kick) -at /SLAP: Sock $+ $2 Error. $sock($1).wsmsg

on *:sockopen:slap:{
if ($sockerr) || ($sock($sockname).status != active) { slap.error $sockname open | return }
sockwrite -n $sockname GET /CreativityTools/RandomWord/RandomPhrase.aspx HTTP/1.1
sockwrite -n $sockname Host: www.watchout4snakes.com
sockwrite -n $sockname User-Agent: mIRC $version
sockwrite -n $sockname $crlf
}

on *:sockread:slap:{
var %r | sockread %r | tokenize 32 %r
if ($sockerr) || ($sock($sockname).status != active) { slap.error $sockname read | return }
elseif ($regex(%r,main_lblPhrase.+>(.+)</span>)) {
tokenize 32 $sock($sockname).mark $regml(1)
describe $1 slaps $2 around a bit with $+(a,$iif($regex($left($3,1),[aeiou]),n)) $3-
return
}
elseif ($1 == </HTML>) sockclose $sockname
}

;EOF

Comments

Sign in to comment.
chachin   -  Dec 17, 2011
THANK YOU NAPALM 10/10 :D
 Respond  
Helixx   -  Nov 20, 2011
Can someone make this script so that whenever someone slaps me, it slaps them back using some phrase, so, I don't have to type /slap
Thanks
 Respond  
napalm`   -  Nov 17, 2011
I'll look into it this weekend.
 Respond  
gasak   -  Nov 16, 2011
it doesn't work anymore
 Respond  
irchainscriptz   -  Jun 30, 2011
yeah when he has a huge boredom episode lol.
 Respond  
napalm`   -  Jun 29, 2011
I just cleaned up a few things.

napa182 - Yeah, I peer in from time to time.
 Respond  
Alrac   -  Jun 15, 2011
my avatar is more OLD school...lol
 Respond  
Jethro   -  Jun 15, 2011
It's funny you two gentlemen use the Hannibal Lecter avatars. :P

If you don't mind my asking, what is the latest update, napalm?
 Respond  
Alrac   -  Jun 15, 2011
thanx jaytea, that suppressed the error i was getting.
 Respond  
jaytea   -  Jun 15, 2011
Alrac, that error shouldn't prevent it from working, since the (single) long line in the page source does not contain the random phrase. mIRC will throw the error then re-trigger the event with the next line ready to be read.

if you want to suppress the error, you can add :error | if (line too long isin $error) reseterror to the bottom of the code, above the last '}'.
 Respond  
napa182   -  Jun 15, 2011
napalm`, about time you updated this =P jk. nice to see you still linger around this site. lol
 Respond  
Alrac   -  Jun 15, 2011
i wish sum1 would update sprjukebox but i'ts beyond my know how.
 Respond  
blackvenomm666   -  Jun 15, 2011
update the code? or find someone who can?
 Respond  
Alrac   -  Jun 15, 2011
i use sprjukebox as my mp3 server script, it works best with 6.21
 Respond  
blackvenomm666   -  Jun 15, 2011
i just tested it and it works fine on 6.32
 Respond  
blackvenomm666   -  Jun 15, 2011
and why can't you upgrade alrac?
 Respond  
Alrac   -  Jun 15, 2011
* /tokenize: line too long (line 25, slap_Reinvented.mrc)
is the error i get and fyi, i can't upgrade from 6.21
 Respond  
napalm`   -  Jun 14, 2011
Edited.
 Respond  
Jethro   -  Apr 07, 2011
RangerMan, you're encouraged to upgrade to the latest mIRC version. You're using a version that's almost 5 years old. The latest build patched various security bugs, fixes, and enhancements. I have no issue running napalm`'s script here using mIRC 7.19.

If, for whatever reason, you refuse to upgrade, at least use v6.35 and try running the script again.
 Respond  
RangerMan   -  Apr 07, 2011
i get this error when i run the /slap
* /tokenize: line too long (line 24, slap_Reinvented.mrc)
-
* /tokenize: line too long (line 24, slap_Reinvented.mrc)
this is the line in question,
var %r | sockread %r | tokenize 32 %r


using mirc 6.21
 Respond  
Jethro   -  Mar 29, 2011
Yes, the site has been back to life, but it was dead for a brief period of time.
 Respond  
napalm`   -  Mar 29, 2011
Code still works. :)
 Respond  
Jethro   -  Feb 18, 2011
Yes OnJohnNo, that website's fried now.
 Respond  
OhJohnNo   -  Feb 18, 2011
I feel I should point out that the site the script pulls the words from is down for now (message about a server error coming up). I was wondering why my script wasn't working, and then figured it out.

At least, I hope that's the explanation. It's either that or my mIRC "is epic failure".
 Respond  
napalm`   -  Nov 21, 2010
http://watchout4snakes.com/CreativityTools/RandomWord/RandomPhrase.aspx is the site the 'phrases' are grabbed from. If you will notice the phrases are in the format: <adjective> <noun>

I doubt you are getting verbs. However, if you are, email the administrator of the aforementioned website to inform him that his 'Creativity Tool' has a bug.
 Respond  
chef-   -  Nov 21, 2010
www.watchout4snakes.com isn't giving me nouns.... it's giving me verbs.

i tried to rewrite it using a different site, but i dont know what im doing.

www.desiquintans.com/noungenerator.php is the site i wanted to use
 Respond  
Ghost-writer   -  Oct 04, 2009
/me takes out gun - give me the cookies :|
 Respond  
hsushoe   -  Jul 16, 2009
Thank you sooooo much Jethro_!!!
 Respond  
Dodge   -  Jul 14, 2009
Works Fine. Good One Nap -_- 9/10
 Respond  
Jethro   -  Jul 13, 2009
is there a way where someone else in the chatroom can use that slap command??
@hsushoe:Yes, all you have to do is change this section of code:
alias slap {
var %n $iif($1,$1,$$snicks)
if ($sock(slap)) sockclose slap
sockopen slap www.watchout4snakes.com 80
sockmark slap $active %n
}

To this one:
Code
 
Then the usage is for someone else in the channel to type: !slap Nickname
If no nickname is specified, the highlighted (selected) nickname will be slapped.

P.S You can also keep the alias slap without changing it but to add the on text event.
 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.