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.

autovoicelist problem

Support & discussion of released scripts, and announcements of new releases.
Post Reply
c
calippo
Voice
Posts: 13
Joined: Mon Jan 19, 2009 3:53 pm

autovoicelist problem

Post by calippo »

hi guys i have a problem with this script I can not let him accept the nick braces ...{nick} thank u so muck

Code: Select all

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #                                                                         # #
#                 avl (autovoicelist) - Script v1.0 by stylus740              # 
# #                                                                         # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #


###############################################################################
# History:                                                                    #
# 1.0		Erstes Release                                                    #
###############################################################################

##
# verwaltet eine Liste von Nicks, die im Channel autovoice erhalten
##

# In welchen Channels soll das Script aktiv sein? 
# Die Definition erfolgt durch Setzen von +avl in der Partyline im Bot
#
# .chanset #channel +avl

# Definition des Datenfiles für berechtigte User

set avl_ni(datafile) "scripts/avl.dat"

###############################################################################
# Mögliche Befehle in der Partyline:							#
#													#
# .chanset #chan +avl		Aktivierung des scripts in Channel #chan		#
# .chanset #chan -avl		Deaktivierung des scripts in Channel #chan	#
# .avlhelp				Hilfen zur Bedienung					#
# .addvoice nick			User zur Liste hinzufügen				#
# .delvoice nick			User von Liste löschen					#
# .listvoice			Einträge anzeigen						#
###############################################################################

### Ab hier nur editieren, wenn man genau weiß, was man tut. Beginn des Codes ###

setudef flag avl								;# Zur Aktivierung der userdefined flags
set avl_ni(version) v1.0						;# Variable für Version setzten

bind dcc n|n addvoice add_users					;# User hinzufügen
bind dcc n|n delvoice del_users					;# User hinzufügen
bind dcc n|n listvoice list_users					;# User anzeigen
bind dcc n|n avlhelp help_users					;# Hilfe anzeigen
bind msg n|n addvoice m_add_users					;# User hinzufügen
bind msg n|n delvoice m_del_users					;# User hinzufügen
bind msg n|n listvoice m_list_users					;# User anzeigen
bind msg n|n avlhelp m_help_users					;# Hilfe anzeigen
bind join - * join:avl_check
bind nick - * nick:avl_check

proc help_users {handle idx args} {
putlog "avl ermöglicht es Usern, die von einer berechtigten Person in einer Liste gespeichert sind"
putlog "auto-voice durch den Bot erteilen zu lassen. (Nützlich in Support Channels, wo oft User nicht"
putlog "registriert sind."
putlog "Die Steuerung von avl erfolgt über die Partyline mit den folgenden Befehlen:"
putlog " "
putlog ".addvoice <nick> <chan>        Nick mit Channel hinzufügen oder ändern"
putlog ".delvoice <nick> <chan>        Den angegebenen Nick löschen"
putlog ".listvoice		         Sämtliche berechtigten User-Einträge anzeigen"
putlog ".avlhelp      	               Diese Hilfemeldung anzeigen"
}

proc m_help_users {nick host hand args} {
puthelp "PRIVMSG $nick :avl ermöglicht es Usern, die von einer berechtigten Person in einer Liste gespeichert sind"
puthelp "PRIVMSG $nick :auto-voice durch den Bot erteilen zu lassen. (Nützlich in Support Channels, wo oft User nicht"
puthelp "PRIVMSG $nick :registriert sind."
puthelp "PRIVMSG $nick :Die Steuerung von avl erfolgt über ein Query mit dem Bot mit den folgenden Befehlen:"
puthelp "PRIVMSG $nick : "
puthelp "PRIVMSG $nick :/msg <bot> addvoice <nick> <chan>        Nick mit Channel hinzufügen oder ändern"
puthelp "PRIVMSG $nick :/msg <bot> delvoice <nick> <chan>        Den angegebenen Nick löschen"
puthelp "PRIVMSG $nick :/msg <bot> listvoice		           Sämtliche berechtigten User-Einträge anzeigen"
puthelp "PRIVMSG $nick :/msg <bot> avlhelp      	           Diese Hilfemeldung anzeigen"
}

proc init_users {} {
global avl_nick avl_ni					   	
if {[file exists $avl_ni(datafile)]} {		   
  putlog "Laden Userdaten aus $avl_ni(datafile)"   
  set in [open $avl_ni(datafile) r]			   		
  while {![eof $in]} {					   		
    set vline [gets $in]                           	
    if {[eof $in]} {break}  				   		
    set inick [lindex $vline 0]			   		
    set ichan [lrange $vline 1 end]			  
    set ientry "$inick&$ichan"			   
    set avl_nick($ientry) $ientry                  		
    }								   
  close $in							   	
  }								  
}								  
init_users

proc list_users {handle idx args} {
global avl_nick avl_ni					   		
if {[info exists avl_nick]} {				  
  putlog "Eingetragene Nick für avl:"		   		
  foreach search [array names avl_nick] {          		
   if {$search != 0} {					   		
     set acmd [split $search "&"]			   		
     set inick [lindex $acmd 0]			   		
     set inick [form $inick]				   		
     set ichan [lrange $acmd 1 end]			   		
     set ichan [form $ichan]				   		
     putlog "$inick$ichan"	 	  	   		
     }							   	
    }								   		
  } else {							   		
    putlog "Keine Daten gespeichert"		   	
  }								   
}								   

proc add_users {handle idx args} {
 global avl_nick avl_ni					   		
 set acmd [lindex $args 0]				   		
 set inick [lindex $acmd 0]				   
 set inick [form $inick]				  
 set ichan [lrange $acmd 1 end]			   		
 set ichan [form $ichan]				 
 set ientry "$inick&$ichan"				   	
 set avl_nick($ientry) $ientry                     		
 writefile							   		
 putlog "User $inick mit Chan $ichan in $avl_ni(datafile) hinzugefügt"
 if {[onchan $inick $ichan]} {
   pushmode $ichan +v $inick 						
 }
}								   		

proc del_users {handle idx args} {
 global avl_nick avl_ni					   		
 set acmd [lindex $args 0]				   		
 set inick [lindex $acmd 0]				  	
 set inick [form $inick]				  		
 set ichan [lrange $acmd 1 end]			  		
 set ichan [form $ichan]				   		
 set ientry "$inick&$ichan"				   		
 if {([info exists avl_nick($ientry)])} {          		
   unset avl_nick($ientry)				 		
   writefile
   putlog "Eintrag $ientry aus $avl_ni(datafile) gelöscht"  
   } else {							 	
   putlog "Eintrag $ientry ist nicht gespeichert!"
   }										
 if {[onchan $inick $ichan]} 
   pushmode $ichan -v $inick 			
 }
}									

proc m_list_users {nick host hand args} {
global avl_nick avl_ni					   		
if {[info exists avl_nick]} {				   		
  puthelp "PRIVMSG $nick :Eingetragene Nick für avl:"	
  foreach search [array names avl_nick] {          		
   if {$search != 0} {					   		
     set acmd [split $search "&"]			   	
     set inick [lindex $acmd 0]			  		
     set inick [form $inick]				   	
     set ichan [lrange $acmd 1 end]			   	
     set ichan [form $ichan]				   		
     puthelp "PRIVMSG $nick :$inick       $ichan"	 	
     }							   		
    }								   		
  } else {							   		
    puthelp "PRIVMSG $nick :Keine Daten gespeichert"		
  }								   	
}								   		

proc m_add_users {nick host hand args} {
 global avl_nick avl_ni					   		
 set acmd [lindex $args 0]				   		
 set inick [lindex $acmd 0]				   		
 set inick [form $inick]				   
 set ichan [lrange $acmd 1 end]			   		
 set ichan [form $ichan]				   	
 set ientry "$inick&$ichan"				   		
 set avl_nick($ientry) $ientry                     		
 writefile							   		
 puthelp "PRIVMSG $nick :User $inick mit Chan $ichan in $avl_ni(datafile) hinzugefügt"
 if {[onchan $inick $ichan]} {
   pushmode $ichan +v $inick 						
 }
}								   	

proc m_del_users {nick host hand args} {
 global avl_nick avl_ni					   		
 set acmd [lindex $args 0]				   		
 set inick [lindex $acmd 0]				  		
 set inick [form $inick]				  		
 set ichan [lrange $acmd 1 end]			  		
 set ichan [form $ichan]				   		
 set ientry "$inick&$ichan"				   		
 if {([info exists avl_nick($ientry)])} {          		
   unset avl_nick($ientry)				 		
   writefile
   puthelp "PRIVMSG $nick :Eintrag $ientry aus $avl_ni(datafile) gelöscht"  
   } else {							 		
   puthelp "PRIVMSG $nick :Eintrag $ientry ist nicht gespeichert!"		
   }										
 if {[onchan $inick $ichan]} {
   pushmode $ichan +v $inick 						
 }
}									

### Bei einem Join wird dann Voice gegeben, wenn der Nick im Datenfile steht

proc join:avl_check {nick uhost handle chan} {
  global botnick avl_nick
  if {![avl:active $chan]} { return 0 } 				
  set chan [string tolower $chan]					
  if ([isop $botnick $chan]) {					
    foreach search [array names avl_nick] {		   	
      if {$search != 0} {					 	
        set ientry [string tolower $avl_nick($search)]   	
        set parts [split $ientry "&"]
        set inick [lindex $parts 0]		   	   		
        set ichan [lindex $parts 1]		   	   		
        if {($nick == $inick) && ($chan == $ichan)} {
          pushmode $chan +v $nick 					
	}  
      }									
    } 									
  } else {									
    putlog "Habe kein op op und hole es mir neu" 		    
    putserv "chanserv op $chan $botnick"
  }								   	
}										

proc nick:avl_check {nick uhost handle chan newnick} {
  global botnick avl_nick
  if {![avl:active $chan]} { return 0 } 				
  set chan [string tolower $chan]					
  if ([isop $botnick $chan]) {					
    foreach search [array names avl_nick] {		   	
      if {$search != 0} {					 	
        set ientry [string tolower $avl_nick($search)]   	
        set parts [split $ientry "&"]
        set inick [lindex $parts 0]		   	   		
        set ichan [lindex $parts 1]		   	   		
        if {($nick == $inick) && ($chan == $ichan)} {
          pushmode $chan +v $newnick 				
	}   
      }									
    }										
  } else {									
    putlog "Habe kein op op und hole es mir neu" 		   
  }								   		
 )
}										

proc form {formtext} {							
  set t [string trimleft $formtext]					
  set t [string trimright $t]						
  return $t									
}

proc writefile {} {
  global avl_nick avl_ni
  set out [open $avl_ni(datafile) w]		  	 	
  foreach search [array names avl_nick] {			   	
    if {$search != 0} {						   	
      set parts [split $search "&"]				   	
      set inick [lindex $parts 0]				   	
      set ichan [lindex $parts 1]				   	
      set output "$inick $ichan"				   	
      puts $out $output						   	
     }							         
   }										
   close $out								
}										

proc avl:active {chan} {
  foreach setting [channel info $chan] {				
    if {[regexp -- {^[\+-]} $setting]} {
      if {$setting == "+avl"} { return 1 }
    }
  }
  return 0
}

putlog "avl (autovoicelist) von stylus740 geladen. (Stand 12.02.05)"
putlog "Eingabe von \.avlhelp bzw. \/msg $botnick avlhelp zeigt Bedienungshinweise an"
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

This script has a nasty habit of using the special token 'args' within procedure headers invoked by binds. But, they use the part below to work around it.

Code: Select all

set acmd [lindex $args 0]
set inick [lindex $acmd 0]
set ichan [lrange $acmd 1 end]
They use an intermediate variable 'acmd' to return the 'args' list back into a string. Which if they had used anything other than 'args' for their variable name wouldn't have been needed. You also notice the list command on a string on the two lines below that. This is also a big problem. They must be changed to this for every single occurence you find.

Code: Select all

set inick [lindex [split $acmd] 0]
set ichan [join [lrange [split $acmd] 1 end]]

Code: Select all

    set vline [gets $in]                              
    if {[eof $in]} {break}                       
    set inick [lindex $vline 0]                  
    set ichan [lrange $vline 1 end] 
The major problem for you above looks like the script is using list commands on the string 'vline' when reading the file, this will break the script before it even gets started. Just change it to look like it does below.

Code: Select all

    set vline [gets $in]                              
    if {[eof $in]} {break}                       
    set inick [lindex [split $vline] 0]                  
    set ichan [join [lrange [split $vline] 1 end]] 
c
calippo
Voice
Posts: 13
Joined: Mon Jan 19, 2009 3:53 pm

Post by calippo »

speechles wrote:This script has a nasty habit of using the special token 'args' within procedure headers invoked by binds. But, they use the part below to work around it.

Code: Select all

set acmd [lindex $args 0]
set inick [lindex $acmd 0]
set ichan [lrange $acmd 1 end]
They use an intermediate variable 'acmd' to return the 'args' list back into a string. Which if they had used anything other than 'args' for their variable name wouldn't have been needed. You also notice the list command on a string on the two lines below that. This is also a big problem. They must be changed to this for every single occurence you find.

Code: Select all

set inick [lindex [split $acmd] 0]
set ichan [join [lrange [split $acmd] 1 end]]

Code: Select all

    set vline [gets $in]                              
    if {[eof $in]} {break}                       
    set inick [lindex $vline 0]                  
    set ichan [lrange $vline 1 end] 
The major problem for you above looks like the script is using list commands on the string 'vline' when reading the file, this will break the script before it even gets started. Just change it to look like it does below.

Code: Select all

    set vline [gets $in]                              
    if {[eof $in]} {break}                       
    set inick [lindex [split $vline] 0]                  
    set ichan [join [lrange [split $vline] 1 end]] 
Tnx now working :D
Post Reply