This is the new home of the egghelp.org community forum. this announcement post . Click the X in the top right-corner of this box to dismiss this message. 
Help for those learning Tcl or writing their own scripts.
			
		
				
			
				
								tazd 							 
						Voice 			
		Posts:  3 Joined:  Thu May 05, 2011 1:08 pm 
		
						
					
													
							
						
									
						Post 
					 
								by tazd  Sat May 21, 2011 9:28 am 
			
			
			
			
			
			What i am trying o achieve is add the needed info to get this script to only announce to those that are give +v in a channel but not to those that are a halfop or above.
This shows what i tried with my limited knowledge and quick scan looking at things but its a no go so was hoping someone here could point me in the right direction.
Code: Select all 
bind mode - '% +h' userhop 
set welc(msg) "%nick type !droid in %chan to list of help commands"
set welc(chan) "#channel"
set welc(type) "1"
bind join - #channel* givewelcome
proc givewelcome {nick uhost hand chan} {
  global welc
  set welctxt $welc(msg)
  regsub -all "%nick" $welctxt "$nick" welctxt
  regsub -all "%chan" $welctxt "$chan" welctxt
  switch $welc(type) {
    1 { puthelp "NOTICE $nick :$welctxt" }
    2 { puthelp "PRIVMSG $nick :$welctxt" }
  }
} 
Many thanks in advance
Moderated: Moved to Scripting Help. 
					Last edited by 
tazd  on Sun May 22, 2011 3:25 am, edited 1 time in total.
									
 
		 
				
		
		 
	 
				
		
				
			
				
								nml375 							 
						Revered One 			
		Posts:  2860 Joined:  Fri Aug 04, 2006 2:09 pm 
		
						
					
						 
													
							
						
									
						Post 
					 
								by nml375  Sat May 21, 2011 1:33 pm 
			
			
			
			
			
			I'd probably add a check somewhat like this:
Code: Select all 
if {[matchattr $hand +v-ho]} {
  return
}
That would make sure the user has the v flag but not the h nor o flag (checking for channel modes +ohv would be rather pointless, since noone will join the channel opped/voiced).
NML_375
			
						 
		 
				
		
		 
	 
				
		
				
			
				
								doggo 							 
						Halfop 			
		Posts:  97 Joined:  Tue Jan 05, 2010 7:53 am
				Contact: 
				
			 
				
		 
		
						
					
						 
													
							
						
									
						Post 
					 
								by doggo  Sat May 21, 2011 2:04 pm 
			
			
			
			
			
			Code: Select all 
bind mode * "#nzbmatrix.chat +v" Monkey:voice 
proc Monkey:voice {nick uhost hand chan mode target} { 
          if {$nick != "Monkey"} {return} 
                putserv "NOTICE $target :type !droid in $chan to list of help commands" 
}
should do what you want tazd  
 
		 
				
		
		 
	 
				
		
				
			
				
								tazd 							 
						Voice 			
		Posts:  3 Joined:  Thu May 05, 2011 1:08 pm 
		
						
					
						 
													
							
						
									
						Post 
					 
								by tazd  Sun May 22, 2011 3:25 am 
			
			
			
			
			
			Thanks got it running just right now
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
				
			
				
								caesar 							 
						Mint Rubber 			
		Posts:  3778 Joined:  Sun Oct 14, 2001 8:00 pmLocation:  Mint Factory 
		
						
					
						 
													
							
						
									
						Post 
					 
								by caesar  Sun May 22, 2011 4:34 am 
			
			
			
			
			
			
if {$nick != "Monkey"} {return} 
You should use 'string equal -nocase' as you will sooner or later find out that for example 'Monkey' isn't equal with 'monkey'.
Also, instead of:
regsub -all "%nick" $welctxt "$nick" welctxt
you can use '
subst ' to get the same result.
Once the game is over, the king and the pawn go back in the same box.
			
						 
		 
				
		
		 
	 
				
		
				
			
				
								speechles 							 
						Revered One 			
		Posts:  1398 Joined:  Sat Aug 26, 2006 10:19 pmLocation:  emerald triangle, california (coastal redwoods) 
		
						
					
						 
													
							
						
									
						Post 
					 
								by speechles  Sun May 22, 2011 9:41 pm 
			
			
			
			
			
			caesar wrote: 
Also, instead of:
regsub -all "%nick" $welctxt "$nick" welctxt
you can use '
subst ' to get the same result.
And as well, you can use [string map] along with 
 instead of curly braces. So instead of all this below:Code: Select all 
  set welctxt $welc(msg)
  regsub -all "%nick" $welctxt "$nick" welctxt
  regsub -all "%chan" $welctxt "$chan" welctxt Code: Select all 
set weltxt [string map [list "%nick" "$nick" "%chan" "$chan"] $welc(msg)]   
		 
				
		
		 
	 
				
		
				
			
				
								caesar 							 
						Mint Rubber 			
		Posts:  3778 Joined:  Sun Oct 14, 2001 8:00 pmLocation:  Mint Factory 
		
						
					
						 
													
							
						
									
						Post 
					 
								by caesar  Mon May 23, 2011 1:03 am 
			
			
			
			
			
			True, 'string map' is even better. Forgot all about it. 
Once the game is over, the king and the pawn go back in the same box.