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.

script for multivoice

Old posts that have not been replied to for several years.
j
jam

script for multivoice

Post by jam »

hello everybody

i'm looking for a tcl script which can be used to do multivoices (!v nick1 nick2).
does it exist or what could be the lines of code to do that kind of things?


thanks!!

:D
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

have you looked in the tcl-archive?
I'm sure there is a script that does this in there
Elen sila lúmenn' omentielvo
j
jam

Post by jam »

i didn't find anything, unfortunetely, are you sure ??
thank you
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 o|o !v pub:v

proc pub:v {nick host handle channel arg} {
  global botnick
  if {[llength $arg] > 0} {
    putserv "NOTICE $nick :\002Usage:\002 !v <nick1> [nick2] [nick3] .. etc."
  return 0 }
  if {![botisop $channel]} {
    putserv "NOTICE $nick :I'm not oped in $channel."
  return 0 }
  set arg [string tolower $arg]
  foreach user $arg {
    if {![onchan $user $channel] || ![isop $user $channel] || ![isvoice $user $channel] || $botnick == $user} { continue }
    pushmode $channel +v $user
  }
}
I haven't tested it, but should work fine.
Once the game is over, the king and the pawn go back in the same box.
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

caesar wrote:

Code: Select all

bind pub o|o !v pub:v

proc pub:v {nick host handle channel arg} {
  global botnick
  if {[llength $arg] > 0} {
    putserv "NOTICE $nick :\002Usage:\002 !v <nick1> [nick2] [nick3] .. etc."
  return 0 }
  if {![botisop $channel]} {
    putserv "NOTICE $nick :I'm not oped in $channel."
  return 0 }
  set arg [string tolower $arg]
  foreach user $arg {
    if {![onchan $user $channel] || ![isop $user $channel] || ![isvoice $user $channel] || $botnick == $user} { continue }
    pushmode $channel +v $user
  }
}
I haven't tested it, but should work fine.
Maybe it is better if you tested it first, before posting it. On a first glance I counted about 5 serious mistakes.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

from:

Code: Select all

    putserv "NOTICE $nick :\002Usage:\002 !v <nick1> [nick2] [nick3] .. etc." 
to:

Code: Select all

    putserv "NOTICE $nick :\002Usage:\002 !v <nick1> \[nick2\] \[nick3\] .. etc."
and from:

Code: Select all

    if {![onchan $user $channel] || ![isop $user $channel] || ![isvoice $user $channel] || $botnick == $user} { continue }
to:

Code: Select all

if {![onchan $user $channel] || [isop $user $channel] || [isvoice $user $channel] || $botnick == $user} { continue } 
I think I have resolved the typo mistakes. I knew that I did something wrong but I'm tired so skiped the usual check it out first. My appologies.
Last edited by caesar on Fri Mar 07, 2003 6:08 pm, edited 1 time in total.
Once the game is over, the king and the pawn go back in the same box.
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

caesar wrote: I think I have resolved the typo mistakes. I knew that I did something wrong but I wa to tired to check it out first.. My appologies.
3 down, 2 to go.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

tolower botnick and channel? only this 2 just pop'ed in my head.

Code: Select all

set channel [string tolower $channel]
set botnick [string tolower $botnick]
Once the game is over, the king and the pawn go back in the same box.
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

try splitting $arg before doing list commands on it...
Elen sila lúmenn' omentielvo
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

from:

Code: Select all

 foreach user $arg { 
to:

Code: Select all

 foreach user [split $arg] { 
Once the game is over, the king and the pawn go back in the same box.
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

caesar wrote:from:

Code: Select all

 foreach user $arg { 
to:

Code: Select all

 foreach user [split $arg] { 
You did [string tolower $botnick] before comparing it to the $user, which is 1 problem solved.
Papillon wrote: try splitting $arg before doing list commands on it...
The question for caesar is: when did you use the first list command?

Once you have done the [split $arg] at the correct spot, you can move the [string tolower $arg] above that.

After that, you can clean up the code, and start wondering if all this [string tolower] business is really needed... is it really needed to compare the $user with the $botnick? Or is there already a test that [botisop] and a second test which will not voice a user that if he/she already [isop]?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I haven't understood what you meant to say. I've tested it and works fine as it is after the changes are made. If you are talking about to remove the "set arg [string tolower $arg]" is correct to remove it.
Once the game is over, the king and the pawn go back in the same box.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Also, if you are talking about the 'if {![onchan $user $channel] || [isop $user $channel] || [isvoice $user $channel] || $botnick == $user} { continue }' line it's correct. he wants a multivoice thing and this calls for this checks. Already oped, voiced or not in channel and the bot must be skiped.. I consider this correctly..
flames]If you don't consider them then do yourself the code.[/flames] :)
Once the game is over, the king and the pawn go back in the same box.
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

caesar wrote: flames]If you don't consider them then do yourself the code.[/flames] :)
Such flames are very nice, but certainly out of place. And the smiley next to it makes it even more ambiguous. Also, it is a lousy practise to first post code (with errors) and then refuse to listen to comments on it.

With my initial posting I suspected this would (again) end up in a long and dreadfull iterating on your code, as it usually does. But I've of lost my appetite for doing that.

First, my question was plain and simple:
egghead wrote: The question for caesar is: when did you use the first list command?
How difficult is that question? You refused to read and properly answer the question.
You are using [llength] on a string. Such error has been told you at least 10 times before on this forum. And it even is treated in the FAQ question.

Second: your check for $botnick == $user is silly. First you check if the bot is op and if the bot is op, you continue the proc. Then you check from the list of users if the user has ops. If it has ops, it is not voiced. At that point the bot will not be voiced, because it has ops. So, there is no need to check for the $botnick == $user. And subsequently there is no need for all the [string tolower], which you always seem to throw in because you fail to understand properly what is going on.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

My appologies.. I've finaly understood what you meant to say about the '$botnick == $user' check. He get checked at the [isop] thing. As for your 'simple' question, I haven't understood what you mean by that. I admit that I don't know even don't have a clue sometimes when I must put that 'tolower' thing.

About the 'flame', this was just a lil joke. I'm sorry if isn't funny.
Once the game is over, the king and the pawn go back in the same box.
Locked