| View previous topic :: View next topic |
| Author |
Message |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sat Apr 25, 2015 5:09 am Post subject: set instant voice after activity |
|
|
i found this tcl and it works fine only it has a delay when setting voice i want it to set voice instant and not devoice on idle only to set voice if user has said something
| Code: | ##############################################
### Start configuring variables from here! ###
##############################################
#Set the channels you would like this script to work on.
#USAGE: [1/2] (1=User defined channels, 2=All channels the bot is on)
set autovoice(chantype) "2"
### SET THIS ONLY IF YOU HAVE SET THE PREVIOUS SETTING TO '1' ###
#Set the channels below on which this script should work. Each channel
#must separated by a space in between to create a list-like structure.
#USAGE: set autovoice(channels) "#channel1 #channel2 #mychannel"
#set autovoice(chans) "#BuG #LoL"
#Set the 'number of lines' here after which a user will be voiced for being
#an ACTIVE CHATTER. Only channel messages will be counted for activity.
set autovoice(lines) "1"
#Set the time here in 'minutes' after which you would like to devoice idlers (UNACTIVE
#CHATTERs). Users idling for more than this number of minute(s) will be devoiced.
######################################################################################
#If you wish yo disable this setting, set it to: "0"
#USAGE: Any numerical integer value.
set autovoice(dvtime) "0"
### SET THIS ONLY IF YOU HAVE ENABLED (UNACTIVE CHATTER) DEVOICING FOR IDLERS ###
#Set the time here in 'minutes' after which you would continuously like to check
#channel voices for idling. It is better to set this value low for good accuracy.
#USAGE: Any numerical integer value.
set autovoice(dvcheck) "2"
### ACTIVE-CHATTER (VOICE) EXEMPT NICKS ###
#Set the list of nicks here which you would like to be exempted from being
#autovoiced by the script. Place separate each entry by placing it in a new line.
##################################################################################
#If you do not have any nick to exempt, then: set autovoice(avexempt) {}
set autovoice(avexempt) {
Melkor:#LoL
dopehead:#LoL
jeck:#LoL
Kushina:#BuG
}
### UNACTIVE-CHATTER (DEVOICE) EXEMPT NICKS ###
#Set the list of nicks here which you would like to be exempted from being
#devoiced by the script. Place separate each entry by placing it in a new line.
################################################################################
#If you do not have any nick to exempt, then: set autovoice(dvexempt) {}
set autovoice(dvexempt) {
alhoceima:#alhoceima
Prince:#alhoceima
ScanServ:#alhoceima
Shamsdeen:#alhoceima
Cservices:#alhoceima
Quiz:#alhoceima
}
### SET THE TEXT TO DISPLAY IN THE +V (VOICING) MODE ###
#Set the text to display while voicing the active chatters. This text will be
#displayed when removing the channel key (mode: -k). Control codes such as
#color/bold/underline/reverses can also be used in the string.
#Please see: http://tclhelp.net/#faqcolor for more information on control codes.
################################################################################
set autovoice(voicemode) "3A2ctive.chatter"
### SET THE TEXT TO DISPLAY IN THE -V (DE-VOICING) MODE ###
#Set the text to display while devoicing the idle chatters. This text will be
#displayed when removing the channel key (mode: -k). Control codes such as
#color/bold/underline/reverses can also be used in the string.
#Please see: http://tclhelp.net/#faqcolor for more information on control codes.
################################################################################
set autovoice(devoicemode) "6U5nactive.c6h5atter"
#############################################################
### Congratulations! Script configuration is now complete ###
#############################################################
##############################################################################
### Don't edit anything else from this point onwards even if you know tcl! ###
##############################################################################
set autovoice(auth) "\x61\x77\x79\x65\x61\x68"
set autovoice(ver) "v3.80.b"
bind pubm - "*" autovoice:users
bind join - "*" autovoice:erase:record
if {$autovoice(dvtime) > 0} {bind time - "*" autovoice:devoice:idlers}
proc autovoice:users {nick uhost hand chan text} {
global autovoice voice
if {($autovoice(chantype) == 1) && ([lsearch -exact [split [string tolower $autovoice(chans)]] [string tolower $chan]] == -1)} { return 0 }
if {[isbotnick $nick] || [isop $nick $chan] || [isvoice $nick $chan]} { return 0 }
set exemptlist [list]
foreach nickchan $autovoice(avexempt) {
lappend exemptlist $nickchan
}
if {[llength $exemptlist] > 0} {
foreach nickchan $exemptlist {
if {[string equal -nocase $nickchan $nick] || ([string equal -nocase [lindex [split $nickchan :] 0] $nick] && [string equal -nocase [lindex [split $nickchan :] 1] $chan])} {
return 0
}
}
}
set user [split [string tolower $nick:$chan]]
if {![info exists voice($user)] && ![isvoice $nick $chan] && ![isop $nick $chan]} {
set voice($user) 0
} elseif {[info exists voice($user)] && ([expr $voice($user) + 1] >= $autovoice(lines)) && ![isop $nick $chan] && ![isvoice $nick $chan]} {
utimer 3 [list autovoice:delay $nick $chan]
unset voice($user)
} elseif {[info exists voice($user)]} {
incr voice($user)
}
}
proc autovoice:delay {nick chan} {
global autovoice voice
set user [split [string tolower $nick:$chan]]
if {[botisop $chan] && [onchan $nick $chan] && ![isop $nick $chan] && ![isvoice $nick $chan]} {
pushmode $chan +v $nick
set voiced($user) 1
}
if {[info exists voiced($user)]} {
pushmode $chan -k $autovoice(voicemode)
flushmode $chan
}
}
proc autovoice:erase:record {nick uhost hand chan} {
global autovoice voice
if {($autovoice(chantype) == 1) && ([lsearch -exact [split [string tolower $autovoice(chans)]] [string tolower $chan]] == -1)} { return 0 }
if {[isbotnick $nick]} { return 0 }
set user [split [string tolower $nick:$chan]]
if {[info exists voice($user)]} { unset voice($user) }
}
proc autovoice:devoice:idlers {m h d mo y} {
global autovoice voice
if {([scan $m %d]+([scan $h %d]*60)) % $autovoice(dvcheck) == 0} {
switch -exact $autovoice(chantype) {
1 { set chans [split $autovoice(chans)] }
2 { set chans [channels] }
default { return 0 }
}
foreach chan $chans {
set chan [string tolower $chan]
foreach user [chanlist $chan] {
set user [split [string tolower $user]]
if {[info exists exempt]} { unset exempt }
if {[botonchan $chan] && ![isbotnick $user] && ![isop $user $chan] && [isvoice $user $chan]} {
set exemptlist [list]
foreach nickchan $autovoice(dvexempt) {
lappend exemptlist $nickchan
}
if {[llength $exemptlist] > 0} {
foreach nickchan $exemptlist {
if {[string equal -nocase $nickchan $user] || ([string equal -nocase [lindex [split $nickchan :] 0] $user] && [string equal -nocase [lindex [split $nickchan :] 1] $chan])} {
set exempt 1; break
}
}
}
if {[botonchan $chan] && ![info exists exempt] && ([getchanidle $user $chan] >= $autovoice(dvtime))} {
pushmode $chan -v $user
if {![info exists devoice($chan)]} {
set devoice($chan) 1
}
} else {
continue
}
} else {
continue
}
}
if {[info exists devoice($chan)]} {
pushmode $chan -k $autovoice(devoicemode)
flushmode $chan
}
}
}
}
if {![string equal "\x61\x77\x79\x65\x61\x68" $autovoice(auth)]} { set autovoice(auth) \x61\x77\x79\x65\x61\x68 }
putlog "\002Active Chatter $autovoice(ver)\002 by \002$autovoice(auth)\002 has been loaded successfully." | [/quote] |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Sat Apr 25, 2015 10:50 am Post subject: Re: set instant voice after activity |
|
|
| simo wrote: |
i found this tcl and it works fine only it has a delay when setting voice i want it to set voice instant and not devoice on idle only to set voice if user has said something
...
|
I think that this time, you should forget the script that you found.
Sometimes it can be a good idea to modify and existing script. It can be a good way to learn some very basic things.
I think that this is best when you only need minor changes.
Based on your request above, what you want this time is very simple. There is no need to start with some other script. In this case, that method just complicates it.
I think this would be an excellent little script for you to do on your own, to get you started learning how to write TCL scripts for your bot.
Start here:
| Quote: |
i want it to set voice instant and not devoice on idle only to set voice if user has said something
|
That's a good start. You have a clear idea of what you want.
Let's find the things you need, based on what you said.
Go here:
http://www.eggheads.org/support/egghtml/1.6.21/tcl-commands.html
and text seach to find:
binds pubm
A pubm bind reacts "if user has said something".
Next, also in tcl-commands.doc, find:
pushmode
and read what it does.
It is one way to have the bot send out a mode change, and that is what voicing a nick is - a mode change.
Based on what you requested, those two things are what you need for the basis of your script.
Now is the time to give it some more thought though. The above is your basic idea, which is "When somebody posts in a chan, voice them".
But we really don't want or need the bot to be trying to voice nicks that are already voiced do we? Think about it - that's a LOT of mode changes sent by the bot - it would be sending mode changes on EVERY post in a chan !
So, now we realize that we need a way to check to see if the nick is already voiced, and if he is, then no need to try to voice him again.
Back to tcl-commands.doc ....
Find:
isvoice
You need to learn how to use the isvoice command with an
if
command.
Here is your reference for the if command:
http://www.tcl.tk/man/tcl8.5/TclCmd/if.htm
( Bookmark this for your future use, as it is the main page there:
http://www.tcl.tk/man/tcl8.5/TclCmd/contents.htm )
Using the isvoice command to find out if the nick is already voiced, you can have the if command control whether or not the mode change is sent out or not.
Now you have the parts.
You need to assemble them.
Again, this is a good one to learn some basics with, because it is simple and straightforward, yet lets you use a couple different things.
Go ahead and write it, and test it.
If, after trying to debug what you write, you still can't get it, post the whole thing that you write here. Somebody will look at it with you.
If you get it to work to suit you, please post it here anyway!
We'd like to see it. Somebody might even have a suggestion for you.
I hope this helps. _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sun Apr 26, 2015 6:49 am Post subject: |
|
|
i was wondering how to stack voice to push as much as possibe and not have it do each one seperate. Pushmode will do 5 at a time i believe while server allow 15 in 1 go
| Code: | proc atleasthalfop {nick chan} { if {[matchattr [nick2hand $nick] fmo|fmo $chan]} { return 0 }; foreach type {op halfop admin owner voice} { if {[is$type $nick $chan]} { return 0 } }; return 1 }
bind pubm - "*" autovoice:users
proc autovoice:users {nick uhost hand chan text} {
global autovoice voice
if {![atleasthalfop $nick $chan]} { return 1 }
if {[isbotnick $nick] || [isop $nick $chan] || [isvoice $nick $chan]} { return 0 }
putnow "MODE $chan +v $nick"
return 0
}
|
|
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Sun Apr 26, 2015 8:03 am Post subject: |
|
|
Is this the code that you wrote since your original post? _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sun Apr 26, 2015 8:19 am Post subject: |
|
|
yes and i wanted to excempt channel owner / admin / op / halfop / voice
and also to make sure nick is still on channel |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Sun Apr 26, 2015 8:22 am Post subject: |
|
|
That's odd then, because it is exactly the same code that I saw somebody else write, five days ago in an eggdrop #channel. _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Wed Apr 29, 2015 9:35 pm Post subject: |
|
|
Yes willyw, that is very odd:)
You really can't stack these +v mode changes easily, as they are just triggered by someone saying something...
How long would you wait around for someone else to speak before voicing the first person? _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Wed Apr 29, 2015 10:29 pm Post subject: |
|
|
| SpiKe^^ wrote: | Yes willyw, that is very odd:)
|
| Quote: |
You really can't stack these +v mode changes easily, as they are just triggered by someone saying something...
How long would you wait around for someone else to speak before voicing the first person? |
( I'd forgotten this thread. )
I suppose that depends on the activity level in the channel that it is used in.
You have a valid point, in that there won't be anything to stack, if he has bot trigger instantly on each post.
However, that is what he asked for ....
This could be one of those things that once he gets exactly what he asked for, he finds out it is not what he wants after all. _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Wed Apr 29, 2015 10:41 pm Post subject: |
|
|
| SpiKe^^ wrote: |
...
How long would you wait around for someone else to speak before voicing the first person? |
I use a script to do this - voice everybody after xx lines posted. It is not something that I am overly thrilled with - I inherited the channel from someone else, and it was in use for ages already. For continuity's sake, I keep it.
I didn't try to re-invent the wheel. Just kept using the script that was there when I came along.
http://www.egghelp.org/tclhtml/3478-4-0-0-1-activechatter.htm
Currently, it is set to voice after nick posts five lines. I'd have to go examine it to see if those five lines must be posted within some amount of time, or not. _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Thu Apr 30, 2015 12:28 am Post subject: |
|
|
willyw very interesting this code to apprentices like me.
The only thing I did not understand was the theme of mode - k in channels.
In my network,channels +k modes, it means that the channel has password, that is, to enter the channel you have to enter a key.
In the code you've shared, that role does the -k mode? _________________ If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks  |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Thu Apr 30, 2015 7:27 am Post subject: |
|
|
| juanamores wrote: |
...
In the code you've shared, that role does the -k mode?
|
As far as I know, you are correct - the "k" mode is for implementing a channel password.
I don' t know why the person that wrote this script including those lines of code.
You could try to email him or use some of the other contact info that he provided, to ask him about it. _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Thu Apr 30, 2015 12:55 pm Post subject: |
|
|
| willyw wrote: |
I don' t know why the person that wrote this script including those lines of code.
You could try to email him or use some of the other contact info that he provided, to ask him about it. |
Thanks willyw, it was out of curiosity and to learn that I asked.  _________________ If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks  |
|
| Back to top |
|
 |
|