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.

Voice/Devoice script

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
b
bryanwny
Voice
Posts: 24
Joined: Sun Sep 09, 2012 10:35 pm

Voice/Devoice script

Post by bryanwny »

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.
b
bryanwny
Voice
Posts: 24
Joined: Sun Sep 09, 2012 10:35 pm

Post by bryanwny »

I seem to have made it work by using timevoice.tcl and changing from:

Code: Select all

 if {$avchan == "" && [botisop $chan]} {
to:

Code: Select all

  if {$avchan == "" && [botisop $chan] && [matchattr $hand v|v $chan]} {
and from:

Code: Select all

  if {$i == $chan && [botisop $chan]} {
to

Code: Select all

  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! :D
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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: Select all

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. :roll:

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: Select all

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.
Last edited by caesar on Mon Sep 17, 2012 12:25 am, edited 1 time in total.
Once the game is over, the king and the pawn go back in the same box.
b
bryanwny
Voice
Posts: 24
Joined: Sun Sep 09, 2012 10:35 pm

Post by bryanwny »

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: Select all

"Error trying to set +bitchvoice for #testing123, invalid mode."
Was your second code to replace what was in the timevoice.tcl script?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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.
b
bryanwny
Voice
Posts: 24
Joined: Sun Sep 09, 2012 10:35 pm

Post by bryanwny »

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 :D
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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.
b
bryanwny
Voice
Posts: 24
Joined: Sun Sep 09, 2012 10:35 pm

Post by bryanwny »

[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
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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.
b
bryanwny
Voice
Posts: 24
Joined: Sun Sep 09, 2012 10:35 pm

Post by bryanwny »

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
v
vigilant
Halfop
Posts: 48
Joined: Thu Jan 05, 2006 12:06 am

Post by vigilant »

[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: Select all

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
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

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: Select all

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
.
v
vigilant
Halfop
Posts: 48
Joined: Thu Jan 05, 2006 12:06 am

Post by vigilant »

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
Post Reply