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.

mute

Help for those learning Tcl or writing their own scripts.
Post Reply
E
Ecimo
Voice
Posts: 5
Joined: Tue Dec 27, 2005 10:19 am

mute

Post by Ecimo »

Code: Select all

set mutedhosts ""

bind join -|- * myavoice
bind PUB -|- !mute mymute
bind PUB -|- !demute demute2

proc myavoice {n u h c} {
  if {![string equal -nocase $c "#game-fair.dk"]} {return}
  global mutedhosts
  if {[lsearch -exact $mutedhosts $u] == 1} {
    puthelp "PRIVMSG $c :\002$n\002 (\002*!*$u\002) have been a bad boy, You have to wait 2 mins."
  } else { pushmode $c +v $n }
}

proc mymute {n u h c a} {
  if {![string equal -nocase $c "#game-fair.dk"] || ![isop $n $c]} {return}
  global mutedhosts
  foreach v [split $a] {
    if {[onchan $v $c]} {
      lappend mutedhosts [set uh [getchanhost $v $c]]
      pushmode $c -v $v
      utimer 120 [list demute $v $uh $c]
    }
  }
}

proc demute2 {n u h c a} {
  if {![string equal -nocase $c "#game-fair.dk"] || ![isop $n $c] || ![onchan $a $c]} {return}
  foreach v [split $a] {
  demute $v [getchanhost $v $c] $c
  }
}

proc demute {n h c} {
  global mutedhosts
  if {[set pos [lsearch -exact $mutedhosts $h]] == -1} {return}
  while {[set pos [lsearch -exact $mutedhosts $h]] != -1} {
    set mutedhosts [lreplace $mutedhosts $pos $pos]]
  }
  if {[onchan $n $c]} {
    pushmode $c +v $n
    } {
    foreach curuser [chanlist $c] {
      if {[getchanhost $curuser] == $h && ![isvoice $curuser $c]} {pushmode $c +v $curuser}
    }
  }
}
Bug 1:
«20:49:00» {@Mulle^:#game-fair.dk} !mute fishbot
«20:49:01» « Mode » {[Game-Fair]} sets {-v fishbot}
«20:49:04» « Kick » {fishbot} was kicked by {Mulle^} {{me off is one of your skills @ 27th}}
«20:49:07» « {fishbot} has been invited to join {#game-fair.dk}
«20:49:07» « Join » {fishbot} {fish@go.moo.oh.yes.they.do} {Clones: 0 @ n/a}
«20:49:07» » fishbot:#game-fair.dk m00s contentedly at Mulle^.
«20:49:14» « Mode » {[Game-Fair]} sets {+v fishbot}

it didnt msg the channel it sould do

Bug 2:
«20:11:53» {@Mulle^:#game-fair.dk} !mute [S]CZukini`bnc fishbot
«20:12:02» « GM highlighted you in #tcl: loc-: i was talking to Mulle^
«20:12:15» « Mode » {[Game-Fair]} sets {-vv [S]CZukini`bnc fishbot}
«20:13:54» « Mode » {[Game-Fair]} sets {+v [S]CZukini`bnc}

why dont it voice both?

now i looked over it for like 7-8 hours cant find the bug!
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

if {[lsearch -exact $mutedhosts $u] == 1} {
This means if $u is the 2nd element in the list $mutedhosts then perform... I guess you mean

Code: Select all

if {[lsearch -exact $mutedhosts $u] != -1} {
this means if $u exists in $mutedhosts then ...
E
Ecimo
Voice
Posts: 5
Joined: Tue Dec 27, 2005 10:19 am

Post by Ecimo »

Code: Select all

proc myavoice {n u h c} {
  if {![string equal -nocase $c "#game-fair.dk"]} {return}
  global mutedhosts
  if {[lsearch -exact $mutedhosts $u] == -1} {
    pushmode $c +v $n
  } else { puthelp "PRIVMSG $c :\002$n\002 (\002*!*$u\002) have been a bad boy, You have to wait 2 mins." }
}
somehow it just started to work (i had tryed that one befor)

but i still wish to sold Bug 2:
«11:15:43» {@Mulle^:#game-fair.dk} !mute l0rn|Mortar^off l0rn|RR^Off
«11:15:44» « Mode » {[Game-Fair]} sets {-vv l0rn|Mortar^off l0rn|RR^Off}
«11:17:43» « Mode » {[Game-Fair]} sets {+v l0rn|Mortar^off}
Post Reply