Code: Select all
foreach chan [split $voice_chans1] {
This had no affect whatsoever . As far as the other option you mentioned, i am not sure i understanding correctlycaesar wrote:Split the list before you use the foreach. I mean, use:Code: Select all
foreach chan [split $voice_chans1] {
Please re-read my original post. This problem only happens when the bot is started, restarted. and yes, The user is on THAT channel. As i said, it only happens to the first channel in the list of voice_chans1., and only after the bot is restarted. Rehash doesnt cause the problem. i can rehash all day long without any probsstdragon wrote:How many times did you .rehash your bot? Every time you do it, the script is reloaded and will voice the person another time. Try .restart and see if the problem still exists. Also, you should make sure the user is *on* those channels before you send the mode hehe. (Hint: use the "onchan" command.)
Ok, here is what I did.KnightHawk wrote:Please re-read my original post. This problem only happens when the bot is started, restarted. and yes, The user is on THAT channel. As i said, it only happens to the first channel in the list of voice_chans1., and only after the bot is restarted. Rehash doesnt cause the problem. i can rehash all day long without any probsstdragon wrote:How many times did you .rehash your bot? Every time you do it, the script is reloaded and will voice the person another time. Try .restart and see if the problem still exists. Also, you should make sure the user is *on* those channels before you send the mode hehe. (Hint: use the "onchan" command.)
Code: Select all
set voice_chans1 "#chan1 #chan2 #chan3"
set voice_chans2 "#chan1 #chan2 #chan3"
bind join *|* * join_autovoice
proc join_autovoice {nick host hand chan} {
global voice_chans1 voice_chans2
foreach chan $voice_chans1 {
putlog "Putquick mode +v for $nick on $chan"
}
foreach chan $voice_chans2 {
putlog "Putquick mode +v for $nick on $chan"
}
}
This is exactly what one would expect from your code: the bot joins the channel itself and sends out a +v for itself on *EACH* of the channels defined in the variables voice_chans1 and voice_chans2. (note that my bot is only on *ONE* active channel, all other channels are set +inactive).[16:28] Putquick mode +v for eggheadbot on #chan1
[16:28] Putquick mode +v for eggheadbot on #chan2
[16:28] Putquick mode +v for eggheadbot on #chan3
[16:28] Putquick mode +v for eggheadbot on #chan1
[16:28] Putquick mode +v for eggheadbot on #chan2
[16:28] Putquick mode +v for eggheadbot on #chan3
Correct, that is what i expect to happen, and i like it that way :0)Egghead wrote: "This is exactly what one would expect from your code: the bot joins the channel itself and sends out a +v for itself on *EACH* channel."
Yes, that is what a person would expect to happen, but is not the case on mine. If the bot resides on either 2 chans or 6, it still produces exatcly 17 (i recounted) messages. The messages are always for the same channel, which is the first channel listed in the voice_chans1 list, regardless of the name of that chan.Egghead wrote:
So, if your bot is on 10 channels, and all those 10 channels are also defined in the voice_chans1 variable, there will be 10 * 10 = 100 "mode +v" sent out.
I was under the impression that bind *|* would tell it to bind to all channelsEgghead wrote:
A bind join is for 1 channel only, so you need to send out one +v for that channel.
I agree, i do need those, as it would probably solve the problem, but, i dont know exactly how to go about it. I do appreciate the suggestions on the fact the checks are needed, but the method of actually creating those checks as suggested above is what i dont understand.Egghead wrote:
Besides that you need to implement a couple of checks (as indicated previously), like: is the bot on the channel, does the nick to be voiced already have voice, has the bot ops.
Can't confirm that. I tried it with my bot on 3 active channels. What eggdrop version are you running on what OS?KnightHawk wrote:Egghead wrote:
So, if your bot is on 10 channels, and all those 10 channels are also defined in the voice_chans1 variable, there will be 10 * 10 = 100 "mode +v" sent out.
Yes, that is what a person would expect to happen, but is not the case on mine. If the bot resides on either 2 chans or 6, it still produces exatcly 17 (i recounted) messages. The messages are always for the same channel, which is the first channel listed in the voice_chans1 list, regardless of the name of that chan.
Actually the binding you created is valid for all channels. So for any channel the bot monitors, a user joining that channel will trigger that binding.KnightHawk wrote:Egghead wrote:
A bind join is for 1 channel only, so you need to send out one +v for that channel.
I was under the impression that bind *|* would tell it to bind to all channels
insert in your code in the appropriate place(s):KnightHawk wrote:Egghead wrote:
Besides that you need to implement a couple of checks (as indicated previously), like: is the bot on the channel, does the nick to be voiced already have voice, has the bot ops.
I agree, i do need those, as it would probably solve the problem, but, i dont know exactly how to go about it. I do appreciate the suggestions on the fact the checks are needed, but the method of actually creating those checks as suggested above is what i dont understand.
Code: Select all
if { ![botisop $chan] } { continue }
if { [isvoice $nick $chan] } { continue }
if { [isop $nick $chan] } { continue }
Using putlogs you should be able to see what the bot does:KnightHawk wrote: Yes, that is what a person would expect to happen, but is not the case on mine. If the bot resides on either 2 chans or 6, it still produces exatcly 17 (i recounted) messages. The messages are always for the same channel, which is the first channel listed in the voice_chans1 list, regardless of the name of that chan.
Code: Select all
set voice_chans1 "#chan1 #chan2 #chan3"
set voice_chans2 "#chan4 #chan5 #chan6"
bind join *|* * join_autovoice
proc join_autovoice {nick host hand chan} {
global voice_chans1 voice_chans2
putlog "Autovoice triggered by $nick joining $chan"
putlog "Entering loop 1 for $voice_chans1"
foreach chan $voice_chans1 {
putlog "Putquick mode +v for $nick on $chan"
}
putlog "Entering loop 2 for $voice_chans2"
foreach chan $voice_chans2 {
putlog "Putquick mode +v for $nick on $chan"
}
}
KnightHawk, either:KnightHawk wrote:Ok, tell ya what, in best interest of saving everyones time and headaches , if someone can suggest the proper coding, by all means do so. I am willing to remove the entire script and start from scratch. Bassically, all i want it do is auto voice every user that joins certain chans, including the bot itself, and have the ability to easily add and remove the chans that the auotvoice happens on. I nt eh mean time, i will try the suggestion from egghelp on using the putlogs. Will get back to ya shortly with the results
My apologies, i didnt mean to waste anyone time, merely save it for your/their benefits. I have been troubleshooting this for a few months myself, so it isnt going to hurt me personally to try a few more days.egghead wrote:KnightHawk, either:KnightHawk wrote:Ok, tell ya what, in best interest of saving everyones time and headaches , if someone can suggest the proper coding, by all means do so. I am willing to remove the entire script and start from scratch. Bassically, all i want it do is auto voice every user that joins certain chans, including the bot itself, and have the ability to easily add and remove the chans that the auotvoice happens on. I nt eh mean time, i will try the suggestion from egghelp on using the putlogs. Will get back to ya shortly with the results
- you come here to ask someone to write a script for you (in which case I would have ignored your posting right away)
or
- you start writing your own code and come to this forum when you have some problems debugging your code.
But you deciced, halfway to switch from the second to the first and subsequently indeed wasted my time.