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. 
	 
Help for those learning Tcl or writing their own scripts.
			
		
				
			
				
								pektek 							 
						Halfop 			
		Posts:  64  		Joined:  Sat Jul 01, 2023 4:51 pm 		
		
						
						
		 
		
						
					
													
							
						
									
						Post 
					 
								by pektek   »  Thu May 02, 2024 3:21 am 
			
			
			
			
			
			I'm getting error
[10:19:01] Tcl error in script for 'timer1':
Code: Select all 
# channel to cycle
set cyclechan "#blabla"
# minutes between each cycle
set timecycle 120 
# minutes to idle before rejoining chan
set timewait 1
bind RAW * 366 cyclestart
proc cyclestart { from key arg } {
global cyclechan timecycle
        set chan [lindex [split $arg] 1]
        if { $chan != $cyclechan } { return 0 }
        timer $timecycle cycle
}
proc cycle { } {
global scanchan timewait
        channel set $cyclechan +inactive
        timer $timewait "channel set $cyclechan -inactive"
}
 
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
				
			
				
								DasBrain 							 
						Voice 			
		Posts:  19  		Joined:  Thu Apr 08, 2021 12:31 pm 		
		
						
						
		 
		
						
					
													
							
						
									
						Post 
					 
								by DasBrain   »  Thu May 02, 2024 3:27 am 
			
			
			
			
			
			You use the variable cyclechan in your proc cycle, but that variable is not listed in the global, or a parameter, or set anywhere. 
 
Did you mean scanchan? Or did you mean cyclechan in the global statement?
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
				
			
				
								CrazyCat 							 
						Revered One 			
		Posts:  1366  		Joined:  Sun Jan 13, 2002 8:00 pm 		
		
											Location:  France 
												
							
				Contact: 
				
			 
				
		 
		
						
					
													
							
						
									
						Post 
					 
								by CrazyCat   »  Thu May 02, 2024 3:29 am 
			
			
			
			
			
			You'd better try:
timer $timewait [list channel set $cyclechan -inactive]
And when an error occures, think to type 
.set errorInfo  to have more informations about it
DasBrain is true too: you don't have $cyclechan in this proc
 
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
				
			
				
								pektek 							 
						Halfop 			
		Posts:  64  		Joined:  Sat Jul 01, 2023 4:51 pm 		
		
						
						
		 
		
						
					
													
							
						
									
						Post 
					 
								by pektek   »  Sun May 05, 2024 5:28 pm 
			
			
			
			
			
			I'm getting an error
[00:26:01] Tcl error in script for 'timer1':
[00:26:01] can't read "cyclechan": no such variable
Code: Select all 
# channel to cycle
set cyclechan "#Sohbet"
# minutes between each cycle
set timecycle 2 
# minutes to idle before rejoining chan
set timewait 1
bind RAW * 366 cyclestart
proc cyclestart { from key arg } {
global cyclechan timecycle
        set chan [lindex [split $arg] 1]
        if { $chan != $cyclechan } { return 0 }
        timer $timecycle cycle
}
proc cycle { } {
global scanchan timewait
        channel set $cyclechan +inactive
        timer $timewait [list channel set $cyclechan -inactive]
}
 
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
				
			
				
								CrazyCat 							 
						Revered One 			
		Posts:  1366  		Joined:  Sun Jan 13, 2002 8:00 pm 		
		
											Location:  France 
												
							
				Contact: 
				
			 
				
		 
		
						
					
													
							
						
									
						Post 
					 
								by CrazyCat   »  Sun May 05, 2024 6:14 pm 
			
			
			
			
			
			That's the thing DasBrain explained. $cyclechan is not defined in cycle proc. Add it in your global, or use $:: namespace
# channel to cycle
set cyclechan "#Sohbet"
# minutes between each cycle
set timecycle 2 
# minutes to idle before rejoining chan
set timewait 1
bind RAW * 366 cyclestart
proc cyclestart { from key arg } {
        global cyclechan timecycle
        set chan [lindex [split $arg] 1]
        if { $chan != $cyclechan } { return 0 }
        timer $timecycle cycle
}
proc cycle { } {
        global scanchan cyclechan timewait
        channel set $cyclechan +inactive
        timer $timewait [list channel set $cyclechan -inactive]
}