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.

little modification

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
R
Rob
Voice
Posts: 25
Joined: Thu Aug 01, 2002 1:21 pm

little modification

Post by Rob »

Hi, i am in need of a little modification

We currently run a channel on quakenet which averages between 15-30 users. We currently have it set to +m moderated and have this voice all but script by drn loaded on our eggdrop so we can control who gets voiced and who doesnt then on join.

But what we would like now is to be able to switch the script on and off like *vab off - to switch off
or
*vab on - to switch it back on

The script is here:-
http://www.egghelp.org/cgi-bin/tcl_arch ... oad&id=613

Any help would be well apprechiated.
Many thanks.

Merry xmas and happy new year to all who reads this too
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

paste the script (I'd guess it's not too long); most people, including me, won't bother to d/l and unzip
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
R
Rob
Voice
Posts: 25
Joined: Thu Aug 01, 2002 1:21 pm

Post by Rob »

Sorry here is the script complete.

Code: Select all

#         Script : VoiceAllBut v1.02 by David Proper (Dr. Nibble [DrN])
#                  Copyright 2002 Radical Computer Systems
#                             All Rights Reserved
#
#       Testing
#      Platforms : Linux 2.2.16   TCL v8.3 (Patch level 8.3.1)
#                  Eggdrop v1.6.2
#                  Eggdrop v1.6.6
#            And : SunOS 5.8      TCL v8.3
#                  Eggdrop v1.5.4
#
#    Description : VoiceAllBut is an auto-voice script with an exceptions
#                  list. You can add/remove people from the no-voice list
#                  via a channel command. VAB will voice all users who 
#                  join except users on the no-voice list.
#                  Good for botchannels who are +m and want the talker
#                  bots to just shut up. :)
#
#      Requested : UTAKER@DALnet of BotCentral.net and #BotCentral
#
#        History : 02/10/2002 - First Release
#                  03/25/2002 - v1.01
#                              o Modified sitemask definition to make a
#                                more normal mask. (Instead of full domain)
#                              o Will now de-voice user if they are voiced
#                                when added to the novoice list and voice
#                                them when removed. (Suggested by UTAKER)
#                  06/21/2002 - v1.02
#                              o Added subst command to see if that'd help
#                                with nicks using | and [censored].
#                              o Added list of channels to voice on.
#                                (Requested by UTAKER@DALnet)
#                              o Added public commands to add/del/list VAB
#                                channel list.
#                              o Saves channel list to datafile. Will only
#                                use VAB(chans) list if no datafile is found
#
#
#   Future Plans : Fix Bugs. :)
#                 o Only active on defined channels
#
# Author Contact :     Email - DProper@stx.rr.com
#                  Home Page - http://home.stx.rr.com/dproper
#       Homepage Direct Link - http://www.chaotix.net:3000/~dproper
#                        IRC - Primary Nick: DrN
#                     UseNet - alt.irc.bots.eggdrop
# Support Channels: #RCS @UnderNet.Org
#                   #RCS @DALnet
#                   #RCS @EFnet
#                   #RCS @GalaxyNet
#                   #RCS @ChatGalaxy
#                   #RCS @Choatix Addiction
#
#                Current contact information can be located at:
#                 http://www.chaotix.net:3000/rcs/contact.html
#
# New TCL releases are sent to the following sites as soon as they're released:
#
# FTP Site                   | Directory                     
# ---------------------------+-------------------------------
# ftp.chaotix.net            | /pub/RCS
# ftp.eggheads.org           | Various
# drn.realmweb.org           | /drn
#
# Chaotix.Net has returned. Mailing list and web site back.
#
#   Radical Computer Systems - http://www.chaotix.net:3000/rcs/
# To subscribe to the RCS mailing list: mail majordomo@chaotix.net and in
#  BODY of message, type  subscribe rcs-list
#
#  Feel free to Email me any suggestions/bug reports/etc.
# 
# You are free to use this TCL/script as long as:
#  1) You don't remove or change author credit
#  2) You don't release it in modified form. (Only the original)
# 
# If you have a "too cool" modification, send it to me and it'll be
# included in the official release. (With your credit)
#
# Commands Added:
#  Where     F CMD          F CMD            F CMD           F CMD
#  -------   - ----------   - ------------   - -----------   - ----------
#  Public:   o vab          o vablist        o vabadd        o vabdel
#     MSG:   N/A
#     DCC:   N/A
#
# Public Matching: N/A
#

# This is the user-definable flag to use to indicate a user on the no-voice list
set VAB(flag) V

# Default flags to give when adding a new user
set VAB(default-flags) "+h-p"

# User access required to modify/list no-voice list.
set VAB(access) "o|o"

# Define this as the channels you want to protect. * for all
set VAB(chans) "#wales"

# Define this as the file to store dynamic list of channels to voice on
set VAB(datafile) "~/vablist.dat"

# Trigger charactor to use.
set cmdchar_ "*"



set VAB(ver) "v1.02.02"

proc cmdchar { } {global cmdchar_; return $cmdchar_}

bind join - ** VAB_join
proc VAB_join {nick uhost hand chan} {
global VAB
 if {![voicechan $chan]} {return 1}
 if {([matchchanattr $hand |$VAB(flag) $chan]) || ([matchchanattr $hand o])} {return 0}
 pushmode $chan +v $nick
                                     }

bind pub $VAB(access) [cmdchar]vab pub_vab
bind msg $VAB(access) vab pub_vab
proc pub_vab {nick uhost hand chan rest} {
global VAB
subst -nobackslashes -nocommands -novariables rest

 if {$rest == ""} {
              putserv "NOTICE $nick :Calling Syntax: [cmdchar]vab cmd \[nick\]"
              putserv "NOTICE $nick :  Commands: list      - Lists no-voice users"
              putserv "NOTICE $nick :            add nick  - Add nick to novoice list"
              putserv "NOTICE $nick :            del nick  - Remove nick from novoice list"
              return 0
                  }
 set cmd [string toupper [lindex $rest 0]]
 set rest [lrange $rest 1 end]

 switch $cmd {
  "LIST" {vab_listuser $nick $uhost $hand $chan $rest}
  "ADD" {vab_adduser $nick $uhost $hand $chan $rest}
  "DEL" {vab_deluser $nick $uhost $hand $chan $rest}
             }
}

proc vab_adduser {nick uhost hand chan rest} {
global VAB 
 subst -nobackslashes -nocommands -novariables rest

 if {$rest == ""} {putserv "NOTICE $nick :Calling Syntax: [cmdchar]vab add nick"; return 0}
 set user [lindex $rest 0]

 if {![onchan $user $chan]} {set thand $user} else {set thand [nick2hand $user]}
 if {![validuser $thand]} {
  if {![onchan $user $chan]} {putserv "NOTICE $nick :$user is not on $chan. Can't get a hostmask to add as new user."; return 0}
   if {$thand == "*"} {set thand $user}
   set sitemask "*!*[string trimleft [maskhost [getchanhost $user $chan]] *!]"
   set rt [adduser $thand $sitemask]
   if {$rt == 1} {set rt "Success"} else {set rt "Failed"}
   putserv "NOTICE $nick :Adding $user\($thand\): $rt"
   set rt [chattr $thand ${VAB(default-flags)}]
   putserv "NOTICE $nick :Setting default flags for $user\($thand\): $rt"

                          }
 if {([matchchanattr $thand |$VAB(flag) $chan])} {putserv "NOTICE $nick :$user is allready no-voiced on $chan"; return 0}
 set rt [chattr $thand |+$VAB(flag) $chan]
 putserv "NOTICE $nick :Flags for $user\($thand\) are now: $rt"
 if {[isvoice $user $chan]} {pushmode $chan -v $user}
 #putserv "NOTICE $user :You are now being devoiced, you will not be revoiced.
 putserv "NOTICE $user :You are now being devoiced, you will not be revoiced on rejoin."
 putserv "NOTICE $user :You can only be revoiced once the no-voice ban is lifted on you."
#devoiced no wont be revoived on entyr eiuther
}

proc vab_deluser {nick uhost hand chan rest} {
global VAB 
 subst -nobackslashes -nocommands -novariables rest
 if {$rest == ""} {putserv "NOTICE $nick :Calling Syntax: [cmdchar]vab add nick"; return 0}
 set user [lindex $rest 0]

 if {![validuser $user]} {putserv "NOTICE $nick :$user is not a valid user."; return 0}
 if {(![matchchanattr $user |$VAB(flag) $chan])} {putserv "NOTICE $nick :$user isn't on the no-voiced for $chan"; return 0}
 set rt [chattr $user |-$VAB(flag) $chan]
 putserv "NOTICE $nick :Flags for $user are now: $rt"
 if {[isvoice $user $chan]} {pushmode $chan +v $user}
 putserv "NOTICE $user :You are now voiced and being removed from the blacklist."
 putquick "MODE $chan +v $user"
}

bind pub o|o [cmdchar]vablist pub_VABlist
bind msg o|o vablist pub_VABlist
proc pub_VABlist {nick uhost hand channel rest} {
global VAB
if {$VAB(chans) == ""} {puthelp "NOTICE $nick :VAB Channel list is empty."
                       } else {puthelp "NOTICE $nick :Current VAB channels are: $VAB(chans)"
                              }
}

bind pub o|o [cmdchar]vabadd pub_VABadd
bind msg o|o vabadd pub_VABadd
proc pub_VABadd {nick uhost hand channel rest} {
global VAB
 if {[voicechan $channel]} {
                            puthelp "NOTICE $nick :$channel allready in VAB List"
                            return 0
                           }
 puthelp "NOTICE $nick :Adding $channel to VAB List"
 lappend VAB(chans) $channel
 save_VAB
}

bind pub o|o [cmdchar]vabdel pub_VABdel
bind pub o|o vabdel pub_VABdel
proc pub_VABdel {nick uhost hand channel rest} {
global VAB
 if {![voicechan $channel]} {
                            puthelp "NOTICE $nick :$channel not found in  VAB List"
                            return 0
                           }
 puthelp "NOTICE $nick :Removing $channel from VAB List"
 set chans $VAB(chans)
 set VAB(chans) ""
 foreach chan $chans {
  if {[string tolower $chan] != [string tolower $channel]} {lappend VAB(chans) $chan}
                     }
save_VAB
}

proc voicechan {chan} {
 global VAB
 set chan [string tolower $chan]
 set chans [string tolower $VAB(chans)]
 if {$chan == "*"} {set chans [string tolower [channels]]}
 set dothechan 0
 foreach c $chans {
  if {($chan == $c)} {set dothechan 1}
                  }
 if {$dothechan == 0} {return 0} else {return 1}
}


proc vab_listuser {nick uhost hand chan rest} {
global VAB 
 subst -nobackslashes -nocommands -novariables rest

 set users [userlist |$VAB(flag) $chan]
 putserv "NOTICE $nick :The following are listed as no-voice for $chan: $users"
}

proc load_VAB {} {
global VAB
  if {[file exists $VAB(datafile)]} {
                                 set in [open $VAB(datafile) r]
                                 set VAB(chans) [gets $in]
                                 close $in
                                } {putlog "-VAB- Datafile $VAB(datafile) not found. Using default channel list."}
                    }
load_VAB

proc save_VAB {} {
global VAB
 putlog "Saving VAB Data to $VAB(datafile)"
 set out [open $VAB(datafile) w]
 puts $out $VAB(chans)
 close $out
}


putlog "VoiceAllBut $VAB(ver) by David Proper (DrN) -:LoadeD:-"
return "VoiceAllBut $VAB(ver) by David Proper (DrN) -:LoadeD:-"
From what I asked from the other user who has access to the shell nothing apart from the notices to the user informing them why they are devoiced has been added/altered, no other part of the script has been changed otherwise.

cheers.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

I contradict myself with that but oh well, I promised the guy I'll take a look...

Code: Select all

set vabison 1
bind pub o !vabon foo
bind pub o !vaboff foo
proc foo {args} {
   if {$::lastbind == "!vabon"} {set ::vabison 1} {set ::vabison 0}
}
and in VAB_join proc insert the following:

Code: Select all

if !$::vabison return
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
R
Rob
Voice
Posts: 25
Joined: Thu Aug 01, 2002 1:21 pm

Post by Rob »

hi thanks for the help and all works fine until we go to use !vaboff which does nothing, all other used commands inc !vabon show up in the partyline.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

then you must have missed the bind for !vaboff
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

!vabon returns 1 so it gets logged (msg on partyline)
!vaboff -> 0 will not get logged (no msg on partyline)
photon?
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

spock is always right

Rob, add return 1 to proc foo
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
R
Rob
Voice
Posts: 25
Joined: Thu Aug 01, 2002 1:21 pm

Post by Rob »

just gave it a go and works fine, brilliant stuff.

cheers.
d
dohboy2
Voice
Posts: 1
Joined: Mon Mar 24, 2008 1:22 am

Post by dohboy2 »

Anyone know of a fix for users with nicknames that are longer than 9 characters?

[00:35:41] <@dohboy> .vab add infamous_cow
[00:35:43] -VoiceR- Adding infamous_cow(infamous_cow): Success
[00:35:43] -VoiceR- Setting default flags for infamous_cow(infamous_cow): *
[00:35:44] -VoiceR- Flags for infamous_cow(infamous_cow) are now: *

[00:35:55] <@dohboy> .vab add infamous_
[00:35:58] -VoiceR- Flags for infamous_(infamous_) are now: hp|V

In the config file I set the nick length to 26, and I don't think I have access to recompile the bot to change the NICKMAX or HANDLEN settings. Anyone know of a workaround for that?
User avatar
username
Op
Posts: 196
Joined: Thu Oct 06, 2005 9:20 am
Location: Russian Federation, Podolsk
Contact:

Post by username »

dohboy2 wrote:Anyone know of a fix for users with nicknames that are longer than 9 characters?

[00:35:41] <@dohboy> .vab add infamous_cow
[00:35:43] -VoiceR- Adding infamous_cow(infamous_cow): Success
[00:35:43] -VoiceR- Setting default flags for infamous_cow(infamous_cow): *
[00:35:44] -VoiceR- Flags for infamous_cow(infamous_cow) are now: *

[00:35:55] <@dohboy> .vab add infamous_
[00:35:58] -VoiceR- Flags for infamous_(infamous_) are now: hp|V

In the config file I set the nick length to 26, and I don't think I have access to recompile the bot to change the NICKMAX or HANDLEN settings. Anyone know of a workaround for that?
In sources of your bot open file src/eggdrop.h and find there a string

Code: Select all

#define HANDLEN 9   /* valid values 9->NICKMAX  */
Change it to

Code: Select all

#define HANDLEN 32   /* valid values 9->NICKMAX  */
and recompile your bot.
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
Post Reply