egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

little modification

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Rob
Voice


Joined: 01 Aug 2002
Posts: 25

PostPosted: Sat Dec 24, 2005 6:31 pm    Post subject: little modification Reply with quote

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_archive.tcl?mode=download&id=613

Any help would be well apprechiated.
Many thanks.

Merry xmas and happy new year to all who reads this too
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Wed Dec 28, 2005 4:13 am    Post subject: Reply with quote

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] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
Rob
Voice


Joined: 01 Aug 2002
Posts: 25

PostPosted: Sat Dec 31, 2005 2:54 pm    Post subject: Reply with quote

Sorry here is the script complete.

Code:

#         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.
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sun Jan 01, 2006 6:22 am    Post subject: Reply with quote

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

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:

if !$::vabison return

_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
Rob
Voice


Joined: 01 Aug 2002
Posts: 25

PostPosted: Sun Jan 01, 2006 6:58 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sun Jan 01, 2006 6:02 pm    Post subject: Reply with quote

then you must have missed the bind for !vaboff
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
spock
Master


Joined: 12 Dec 2002
Posts: 319

PostPosted: Sun Jan 01, 2006 7:52 pm    Post subject: Reply with quote

!vabon returns 1 so it gets logged (msg on partyline)
!vaboff -> 0 will not get logged (no msg on partyline)
_________________
photon?
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sun Jan 01, 2006 8:14 pm    Post subject: Reply with quote

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] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
Rob
Voice


Joined: 01 Aug 2002
Posts: 25

PostPosted: Fri Jan 13, 2006 9:22 pm    Post subject: Reply with quote

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

cheers.
Back to top
View user's profile Send private message
dohboy2
Voice


Joined: 24 Mar 2008
Posts: 1

PostPosted: Mon Mar 24, 2008 1:32 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
username
Op


Joined: 06 Oct 2005
Posts: 196
Location: Russian Federation, Podolsk

PostPosted: Mon Mar 24, 2008 4:46 pm    Post subject: Reply with quote

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:
#define HANDLEN 9   /* valid values 9->NICKMAX  */
Change it to
Code:
#define HANDLEN 32   /* valid values 9->NICKMAX  */
and recompile your bot.
_________________
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber