This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Fun Script

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
d
dohko2006
Voice
Posts: 8
Joined: Sun Mar 19, 2006 2:16 pm

Fun Script

Post by dohko2006 »

small request (i thing), im looking for after a forum search (maybe im not good searching, sorry)


when ops (+o) or voices (+v) (only this two) type: !rock nick ... the bot respond
* Bot throws a rock in the head of Nick

a tiny example (nicks: Bot, +Nick, AnotherNick)

<+Nick>!rock AnotherNick
* Bot throws a rock in the head of AnotherNick
<AnotherNick> lol
<AnotherNick> !rock Nick
<AnotherNick> wtf... not work!
<+Nick> lol...only voices and ops :P

and antiflood ... 4 or 5 respond total in 90-120 sec ... thx a lot.

Regards.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

bind pub - !rock rock

proc rock {nick uhost hand chan arg} {
 global afrock
 if {![isvoice $nick $chan] && ![isop $nick $chan]} {return 0}
 if {![info exists afrock([set nickchan [string tolower $nick:$chan]])]} {
  set afrock($nickchan) [list [unixtime] 0]
 }
 foreach {t o} $afrock($nickchan) {break}
 if {[unixtime]-$t > 120} { set t [unixtime]; set o 0 }
 if {[incr o] > 5} { return 0 }
 set afrock($nickchan) [list $t $o]
 putserv "privmsg $chan :\001ACTION throws a rock in the head of [lindex [split $arg] 0]\001"
}
d
dohko2006
Voice
Posts: 8
Joined: Sun Mar 19, 2006 2:16 pm

Post by dohko2006 »

Great work Sir_Dz :D Working Ok... but...

If AnotherNick dont exists ... the command
!rock AnotherNick it would not have to work; and if type only "!rock" the bot say "* Bot throws a rock in the head of"

Example (Only 3 Users in the channel: Bot, +Nick, Nick2)
<+Nick>!rock Nick2
* Bot throws a rock in the head of Nick2
<Nick2>lol
<+Nick>!rock Nick3
<Nick2> Nick3? who is?
<+Nick> lol, the user Nick3 dont exist in the channel, good bot :p
<+Nick>!rock
<Nick2> nothing happen
<+Nick> of course, not type nick :p

My bot only have one channel, but have 100 -300 users daily in the channel.

Regards :)
a
astriK
Voice
Posts: 5
Joined: Thu Mar 23, 2006 9:51 pm

Post by astriK »

dohko2006 wrote:Great work Sir_Dz :D Working Ok... but...

If AnotherNick dont exists ... the command
!rock AnotherNick it would not have to work; and if type only "!rock" the bot say "* Bot throws a rock in the head of"

Example (Only 3 Users in the channel: Bot, +Nick, Nick2)
<+Nick>!rock
<Nick2> nothing happen
<+Nick> of course, not type nick :p
Regards :)
that example is meaning the Bot fine.
maybe u wana say it
<+Nick>!rock
<BoT> Bot throws a rock in the head of"
isn't?
DomDom DomDom
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

bind pub - !rock random:rock

proc random:rock {nick uhost hand chan arg} {
  if {![isop $nick $chan] || ![isvoice $nick $chan]} return
  foreach user [chanlist $chan] {
    if {[isbotnick $user] || [isvoice $user $chan] || [isop $user $chan]} continue
    lappend list $user
  }
  if {[set len [llength $list]] < 2} {
    putserv "PRIVMSG $chan :This game needs more than two users on the channel, currently I see only [expr {$len==1?"1 player":"$len players"}]."
    return
  }
  putserv "PRIVMSG $chan :\001ACTION throws a rock in the head of [lindex $list [rand $len]]\001"
}
Once the game is over, the king and the pawn go back in the same box.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

This should fix it

Code: Select all

bind pub - !rock rock

proc rock {nick uhost hand chan arg} {
 global afrock
 if {![isvoice $nick $chan] && ![isop $nick $chan]} {return 0}
 if {![info exists afrock([set nickchan [string tolower $nick:$chan]])]} {
  set afrock($nickchan) [list [unixtime] 0]
 }
 foreach {t o} $afrock($nickchan) {break}
 if {[unixtime]-$t > 120} { set t [unixtime]; set o 0 }
 if {[incr o] > 5} { return 0 }
 set afrock($nickchan) [list $t $o]
 if {[onchan [set rocked [lindex [split $arg] 0]] $chan]} {
  putserv "privmsg $chan :\001ACTION throws a rock in the head of $rocked\001"
 }
}
d
dohko2006
Voice
Posts: 8
Joined: Sun Mar 19, 2006 2:16 pm

Post by dohko2006 »

Works OK Now 8) ... thx a lot Sir ^^
Post Reply