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. 
Old posts that have not been replied to for several years.
			
		
				
			
				
								WulfMan72 							 
						Voice 			
		Posts:  23 Joined:  Wed Oct 12, 2005 11:02 amLocation:  Massachusetts 
		
						
					
													
							
						
									
						Post 
					 
								by WulfMan72  Wed Oct 12, 2005 11:06 am 
			
			
			
			
			
			I'm writing a script and I'd like to be able to have it analyze a nick on join and determine if it's Capitalized or not.
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
				
			
				
								Sir_Fz 							 
						Revered One 			
		Posts:  3794 Joined:  Sun Apr 27, 2003 3:10 pmLocation:  Lebanon
				Contact: 
				
			 
				
		 
		
						
					
						 
													
							
						
									
						Post 
					 
								by Sir_Fz  Wed Oct 12, 2005 1:05 pm 
			
			
			
			
			
			This should strip all characters other than [A-z]:
Code: Select all 
regsub -all -- {[^A-z]|\^} $string "" string
and to check if the string is all in upper case:
 
		 
				
		
		 
	 
				
		
				
			
				
								WulfMan72 							 
						Voice 			
		Posts:  23 Joined:  Wed Oct 12, 2005 11:02 amLocation:  Massachusetts 
		
						
					
						 
													
							
						
									
						Post 
					 
								by WulfMan72  Wed Oct 12, 2005 1:11 pm 
			
			
			
			
			
			ty Fz, what about just to check if the first letter of a nick is uppercase? is there a way to do that with an eggdrop?
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
				
			
				
								greenbear 							 
						Owner 			
		Posts:  733 Joined:  Mon Sep 24, 2001 8:00 pmLocation:  Norway 
		
						
					
						 
													
							
						
									
						Post 
					 
								by greenbear  Wed Oct 12, 2005 3:23 pm 
			
			
			
			
			
			Returns 1 if it starts with a capital letter or a number, 0 if doesnt.
Code: Select all 
proc firstup {var} {
 set first [string range $var 0 0]
 if {![string isupper $first] && ![string is digit $first]} {
  return 0
 } {
  return 1
 }
} 
		 
				
		
		 
	 
				
		
				
			
				
								Sir_Fz 							 
						Revered One 			
		Posts:  3794 Joined:  Sun Apr 27, 2003 3:10 pmLocation:  Lebanon
				Contact: 
				
			 
				
		 
		
						
					
						 
													
							
						
									
						Post 
					 
								by Sir_Fz  Wed Oct 12, 2005 7:11 pm 
			
			
			
			
			
			This should do it as well:
returns 1 if the first letter of $string is a capital letter, 0 otherwise.
OR 
Code: Select all 
string is upper [string index $string 0] 
		 
				
		
		 
	 
				
		
				
			
				
								WulfMan72 							 
						Voice 			
		Posts:  23 Joined:  Wed Oct 12, 2005 11:02 amLocation:  Massachusetts 
		
						
					
						 
													
							
						
									
						Post 
					 
								by WulfMan72  Wed Oct 12, 2005 8:50 pm 
			
			
			
			
			
			Thanks guys, I really appreciate it 
 
		 
				
		
		 
	 
				
		
				
			
				
								WulfMan72 							 
						Voice 			
		Posts:  23 Joined:  Wed Oct 12, 2005 11:02 amLocation:  Massachusetts 
		
						
					
						 
													
							
						
									
						Post 
					 
								by WulfMan72  Mon Oct 17, 2005 4:51 pm 
			
			
			
			
			
			ok, here's what I have for my script so far, I wanna add the lines from the above posts to have it check if the nick Starts with a capitol letter before it runs the proc.
Code: Select all 
bind join - * servjoin
proc servjoin {nick hand u@h chan} {
 if { [validuser $nick] == 1 } {
   user-set $nick XTRA status "AWS"
  }
  return 0
}
Code: Select all 
regsub -all -- {[^A-z]|\^} $string "" string
regexp -- {^[A-Z]} $string
can anyone show me exactly how to set up those two lines so the code will only trigger if the nick of the person who triggers it is capped?
 
		 
				
		
		 
	 
				
		
				
			
				
								Sir_Fz 							 
						Revered One 			
		Posts:  3794 Joined:  Sun Apr 27, 2003 3:10 pmLocation:  Lebanon
				Contact: 
				
			 
				
		 
		
						
					
						 
													
							
						
									
						Post 
					 
								by Sir_Fz  Mon Oct 17, 2005 5:09 pm 
			
			
			
			
			
			You simply use them in an if-statement. for example:
Code: Select all 
if {[regexp -- {^[A-Z]} $string]} {
 # do whatever...
} 
		 
				
		
		 
	 
				
		
				
			
				
								WulfMan72 							 
						Voice 			
		Posts:  23 Joined:  Wed Oct 12, 2005 11:02 amLocation:  Massachusetts 
		
						
					
						 
													
							
						
									
						Post 
					 
								by WulfMan72  Mon Oct 17, 2005 5:20 pm 
			
			
			
			
			
			thanks again Fz, it's been giving me fits