Insult Script (Random Insult Generator)

By ES on Jul 07, 2009

My first script where i experimented with writeini and readini
Seemed to have worked out pretty well :D
Pulls insults from http://www.randominsults.net/
If you have any improvements at all please post

!insult = Insult Your self xD
!insult = Insult that person

Eg:

<~ES> !insult
<~^o0^> • ES: Save your breath... you'll need it to blow up your date. • [Times Insulted: 12]
<~ES> !insult ^o0^
<^o0^> • ^o0^: Your face reminds me of a movie star. Lassie! • [Times Insulted: 1]

on *:TEXT:!insult*:#: {
  sockopen insulter www.randominsults.net 80
  if ($rand(1,10) == 1) set %insultee $nick
  elseif ($2) set %insultee $2-
  else set %insultee $nick
  set %insulterchan $chan
  writeini insult.ini insults %insultee $calc($readini(insult.ini,insults,%insultee) + $chr(49))
  set %timesinsul $readini(insult.ini,insults,%insultee)
} 
on *:sockopen:insulter: {
  sockwrite -n $sockname GET / HTTP/2.0
  sockwrite -n $sockname Host: www.randominsults.net
  sockwrite -n $sockname Connection: close
  sockwrite -n $sockname $crlf
} 
on *:sockread:insulter: {
  sockread %insulterpage
  if (<i> isin %insulterpage) {
    set %insulterquote $nohtml(%insulterpage)
  } 
}
on *:sockclose:insulter: {
  msg %insulterchan 10•04 %insultee $+ $chr(58)  %insulterquote 10• 14[Times Insulted: %timesinsul $+ $chr(93)
}
alias nohtml {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;)
  return %x
}

Comments

Sign in to comment.
element01   -  May 29, 2011

Thanks for this fix:

on 1:TEXT:!insult*:#: {
if ($2 == $null) { notice $nick Please add a nickname after !insult | halt }
if ($2 ison #) {
sockopen insulter www.randominsults.net 80
if ($rand(1,10) == 1) set %insultee $nick
elseif ($2) set %insultee $2
elseif set %insultee $nick }
else { msg $chan $nick Do you see $2 in here anywhere? Try again! | halt }
set %insulterchan $chan
writeini insult.ini insults %insultee $calc($readini(insult.ini,insults,%insultee) + $chr(49))
set %timesinsul $readini(insult.ini,insults,%insultee)
}

I'm playing around with pulling insults from http://www.insultbox.com/

I'll let you know if I get it working.

 Respond  
Jethro   -  Mar 28, 2011

Sharky_Dude, if your browser cannot access a website, don't expect a socket script to be able to.

:P I can't speak for napa182, but I'd say he's pretty darn good. I haven't seen him comment much lately except for today. lol I know he's around and all. I hope life treats him well.

 Respond  
Sharky_Dude   -  Mar 28, 2011

ah makes sense, damn it sounds like he's a good coder too.

 Respond  
Jethro   -  Mar 28, 2011

Sharky_Dude, the website napa used doesn't work as of now. It refuses to load. That is why the socket script can't retrieve the info.

 Respond  
Sharky_Dude   -  Mar 28, 2011

I tried this and love it but I couldn't seem to get napa's to work. I only hope that one day I will become a good coder myself.

 Respond  
ReapTheChaos   -  Jan 15, 2011

Works pretty well, but if its going to count total insults, it should be nickname specific, so if someone types a nickname that’s not on the channel its rejects it. As it is now you can type in any random name and it will insult it. People typically call one another by shortened versions of their nick, or even by their first name, the count isn’t going to be accurate unless you make it so they have to type in the full nick.

Also line 4 has $2- at the end. The - after the $2 allows you to enter a random number after the nick, that number will then be added onto the total insults.

Replace the first section of the code with this to correct both issues:

Code:

on 1:TEXT:!insult*:#: {
if ($2 == $null) { notice $nick Please add a nickname after !insult | halt }
if ($2 ison #) {
sockopen insulter www.randominsults.net 80
if ($rand(1,10) == 1) set %insultee $nick
elseif ($2) set %insultee $2
elseif set %insultee $nick }
else { msg $chan $nick Do you see $2 in here anywhere? Try again! | halt }
set %insulterchan $chan
writeini insult.ini insults %insultee $calc($readini(insult.ini,insults,%insultee) + $chr(49))
set %timesinsul $readini(insult.ini,insults,%insultee)
}

 Respond  
napa182   -  Aug 24, 2010

when you add @ in the on text event all you are doing is making sure the client running the snippet is +o in the chan not the users triggering it.

on $@*:text:/^@insult\s(\S+)$/iS:#: {

to make it for +o users to trigger only

if ($nick isop # && !%f && $regml(1) ison #) {
 Respond  
Mensa_Reject   -  Aug 24, 2010

Superb stuff

Is there anyway to make either of these codes work for channel ops only?
When I try to add this" on @*:text: it stops working for the second insult generator.
Cheers

 Respond  
napa182   -  Jul 31, 2010

=P

 Respond  
Jethro   -  Jul 31, 2010

And that's brought to you by napa182's socket production, Inc. lol Nice one as always.

 Respond  
napa182   -  Jul 31, 2010

[size=14]heres one for real foul insults ;x Just don't use it in +G rooms[/size]

on $*:text:/^@insult\s(\S+)$/iS:#: {
  if (!%f && $regml(1) ison #) {
    inc -u4 %f
    if ($sock(ins)) sockclose ins
    sockopen ins www.beleaguer.com 80
    sockmark ins $+($regml(1),$chr(44)) msg #
  }
}

on *:sockopen:ins: {
  sockwrite -nt $sockname GET / HTTP/1.1
  sockwrite -nt $sockname Host: $+($sock(ins).addr,$str($crlf,2))
}
on *:sockread:ins: {
  var %ins | sockread %ins
  if ($regex(%ins,/<span class="b">(.+)<\/span><br>(.+)<\/span><\/td>/)) {
    $gettok($sock(ins).mark,2-,32) $regml(1) $gettok($sock(ins).mark,1,32) $regml(2)
    sockclose ins
  }
}
 Respond  
Manyman   -  Jul 31, 2010

Tis rather laggy though.

 Respond  
VinX   -  Mar 23, 2010

really appreciate this script <3

 Respond  
uneek   -  Jul 08, 2009

Works as described..I also really like the keeping track of times insulted.

Thanks

 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.