| View previous topic :: View next topic |
| Author |
Message |
bryanwny Voice
Joined: 09 Sep 2012 Posts: 24
|
Posted: Sun Sep 09, 2012 10:57 pm Post subject: Voice/Devoice script |
|
|
I'm not sure if maybe I'm just missing something that's already built into eggdrop (I haven't messed with one in 10+ years), but what I'm looking to do is:
Voice users (NOT just based off of nick; but *!*ident@host or *!*@host) upon joining with a certain flag (+v). The problem I seem to be having with using +v/autovoice or +g is that it won't let me devoice them. Even as the bot owner, it just re-voices them right away like there's a +bitchvoice mode enabled. Am I missing something, or do I need to find a script to handle this? Ideally, I'd like it to devoice them after 60 minutes of inactivity, but I did find a script to accomplish that already. |
|
| Back to top |
|
 |
bryanwny Voice
Joined: 09 Sep 2012 Posts: 24
|
Posted: Mon Sep 10, 2012 4:30 pm Post subject: |
|
|
I seem to have made it work by using timevoice.tcl and changing from:
| Code: | | if {$avchan == "" && [botisop $chan]} { |
to:
| Code: | | if {$avchan == "" && [botisop $chan] && [matchattr $hand v|v $chan]} { |
and from:
| Code: | | if {$i == $chan && [botisop $chan]} { |
to
| Code: | | if {$i == $chan && [botisop $chan] && [matchattr $hand v|v $chan]} { |
Not sure if that's the best way to handle it or not, but at least it's working. If someone else has a better method, I'm all ears!  |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Wed Sep 12, 2012 8:03 am Post subject: |
|
|
Upon joining a +autovoice channel any guest that matches a +v user (on that channel or +g that means globally) he will be automatically voiced by the bot's internal function that was designed especially for this.
The +bitchvoice channel flag will re-voice the +v users right away as this is the purpose of the flag. From what I understand you wish to stop this behavior. I think that a bind mode on a -v with a return should stop this. Haven't tested anything so let me know if it works or it doesn't.
| Code: |
bind mode "% -v" bitch:voice
proc bitch:voice {nick uhost hand chan victim} {
if {[channel get $chan +bitchvoice]} return 1
}
|
In order to test my theory just set a temporary channel to +autovoice and +bitchvoice, create a temporary user that has the +v flag, add a host to it, join the channel, let the bot voice it then devoice the user and see what happens.
If all work as you wanted then you can remove the timevoice.tcl script, that is anyway poorly written.
here is a cleaner version of the above code. the only difference from this and the already built-in funcion (the +autovoice) is that has a random delay in executing the +v mode change, that's all.
| Code: |
bind join - * sv:join
proc sv:join {nick host hand chan} {
global sv
if {[isbotnick $nick] || ![botisop $chan]} return
if {[lsearch -nocase $chan $sv(avchan)] == -1} return
if {![isvoice $nick $chan]} {
utimer [rand [expr $sv(maxdelay) + 1]] [list pushmode $chan +v $nick]
}
}
|
PS: Haven't tested anything so let me know if you get any errors.
Edit: fixed minor type. It should be -nocase, not --nocase. _________________ Once the game is over, the king and the pawn go back in the same box.
Last edited by caesar on Mon Sep 17, 2012 12:25 am; edited 1 time in total |
|
| Back to top |
|
 |
bryanwny Voice
Joined: 09 Sep 2012 Posts: 24
|
Posted: Sat Sep 15, 2012 11:41 pm Post subject: |
|
|
OK, I'm not sure if I'm doing it correctly, but I created 'bitchvoice.tcl' and pasted your first chunk of code in it, and added it to my bots config, and verified it is loading because I added a 'putlog' line at the bottom.
When I added a temp channel, I was able to set it to +autovoice, but not +bitchvoice. I get the following error:
| Code: | | "Error trying to set +bitchvoice for #testing123, invalid mode." |
Was your second code to replace what was in the timevoice.tcl script? |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sun Sep 16, 2012 1:25 pm Post subject: |
|
|
Don't know what's with the error you get.. what version of eggdrop are you using?
As for the second code it's meant to replace the timevoice.tcl. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
bryanwny Voice
Joined: 09 Sep 2012 Posts: 24
|
Posted: Sun Sep 16, 2012 5:54 pm Post subject: |
|
|
Running v1.6.21. Is there really such a thing as +bitchvoice? lol. I thought I was just making that up because that's how it's acting  |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Sep 17, 2012 12:30 am Post subject: |
|
|
Meh.. I should get a break from work. You get that error cos there isn't a +bitchvoice channel flag.
Could you paste the channel modes of the channel you have issues with devoicing a user known to the bot, where it voices back that user? _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
bryanwny Voice
Joined: 09 Sep 2012 Posts: 24
|
Posted: Tue Sep 18, 2012 10:49 am Post subject: |
|
|
[10:47am] <bot> Protect modes (chanmode): +tn
[10:47am] <bot> Idle Kick after (idle-kick): DON'T!
[10:47am] <bot> stopnethack: DON'T!
[10:47am] <bot> aop-delay: 0:0
[10:47am] <bot> revenge-mode: 0
[10:47am] <bot> ban-type: 2
[10:47am] <bot> ban-time: 120
[10:47am] <bot> exempt-time: 60
[10:47am] <bot> invite-time: 60
[10:47am] <bot> Other modes:
[10:47am] <bot> -inactive -statuslog -secret +shared
[10:47am] <bot> -greet -seen +cycle +dontkickops
[10:47am] <bot> -protectops -protectfriends -revenge -revengebot
[10:47am] <bot> -bitch -autoop -autovoice -nodesynch
[10:47am] <bot> -enforcebans +dynamicbans +userbans -autohalfop
[10:47am] <bot> -protecthalfops -static
[10:47am] <bot> +dynamicexempts +userexempts +dynamicinvites +userinvites |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Wed Sep 19, 2012 12:16 am Post subject: |
|
|
It shouldn't re-voice any user, so this means you must have some other script that's doing this stuff. Could you unload all your scripts then see if this behavior still happens? _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
bryanwny Voice
Joined: 09 Sep 2012 Posts: 24
|
Posted: Fri Sep 21, 2012 4:47 pm Post subject: |
|
|
Even without ANY scripts loaded, whether i do chattr +g to a user on an -autovoice channel, or chattr +v on an +autovoice channel, it won't let me devoice them. It gives it right back.
AllProtection is the main script I use, but I commented it out in the .conf and .rehash'd the bot.
<bot> [16:43:41] AllProtection v4.7 successfully unloaded...
Still does it.
EDIT: It DOES load the following tcl's, but they came with the eggdrop and I figured they weren't an issue:
source scripts/alltools.tcl
source scripts/action.fix.tcl
source scripts/dccwhois.tcl |
|
| Back to top |
|
 |
vigilant Halfop
Joined: 05 Jan 2006 Posts: 48
|
Posted: Sat Jun 06, 2015 1:06 pm Post subject: |
|
|
[12:01:47 pm] <leet> [19:01:41] Tcl error [automode:join]: can't read "sv(maxdelay)": no such variable
Can anyone tell me how to fix this error?
The whole script is below:
| Code: | proc automode:join { nick uhost handle chan } {
global sv
if {[channel get $chan "op"] && [isop $::botnick $chan]} {
pushmode $chan +o $nick
} elseif {[channel get $chan "voice"] && [isop $::botnick $chan]} {
utimer [rand [expr $sv(maxdelay) + 1]] [list push $chan $nick]
} else {
return 0
}
}
proc push {chan nick} {
if {![botisop $chan]} return
if {[isvoice $nick $chan]} return
pushmode $chan +v $nick
} |
I am trying to a random delay. I want between 10 and 30 seconds. This I assume adds any random delay, but I Don't know what's the min and max. I hope someone can fix this script. _________________ Anser Quraishi
Website: http://www.anserq.com |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sat Jun 06, 2015 3:42 pm Post subject: |
|
|
As the error clearly states: can't read "sv(maxdelay)": no such variable
Set that variable in the global namespace to stop that error...
| Code: |
set sv(maxdelay) 10
proc automode:join { nick uhost handle chan } {
global sv
if {[channel get $chan "op"] && [isop $::botnick $chan]} {
pushmode $chan +o $nick
} elseif {[channel get $chan "voice"] && [isop $::botnick $chan]} {
utimer [rand [expr $sv(maxdelay) + 1]] [list push $chan $nick]
} else {
return 0
}
}
proc push {chan nick} {
if {![botisop $chan]} return
if {[isvoice $nick $chan]} return
pushmode $chan +v $nick
} |
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
vigilant Halfop
Joined: 05 Jan 2006 Posts: 48
|
Posted: Sat Jun 06, 2015 4:28 pm Post subject: |
|
|
I had to comment out the global sv and I had put the set sv(maxdelay) 10
inside the proc for it to work.
Thanks for the help. _________________ Anser Quraishi
Website: http://www.anserq.com |
|
| Back to top |
|
 |
|