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.
			
		
				
			- 
				
								stephers							
- Voice
- Posts: 1
- Joined: Tue Jan 18, 2011 1:10 am
						
					
													
							
						
									
						Post
					
								by stephers » 
			
			
			
			
			
			Code: Select all
bind pub - !spam  pub:!spam
proc pub:!spam {nick host handle chan text} {
	if {[ishalfop $nick $chan] == 1 || [isop $nick $chan] == 1} {
		#Set the channel to advertise on
		set channame "#sa"
		#Set your advertising message
		set advertmsg "it works"
		timer 1 msg:chan
		proc msg:chan {} {
			global channame advertmsg
			puthelp "PRIVMSG $channame :$advertmsg"
			timer 1 msg:chan
		}
	} else {
		puthelp "PRIVMSG $chan :BEEP"
	}
}
First timer goes off and then I receive this,
Error received: Cannot find channame variable.
 
		 
				
		
		 
	 
				
		
				
			- 
				
								willyw							
- Revered One
- Posts: 1209
- Joined: Thu Jan 15, 2009 12:55 am
						
					
													
							
						
									
						Post
					
								by willyw » 
			
			
			
			
			
			channame exists only inside proc pub:!spam.
Add it as a global variable, in proc pub:!spam
Code: Select all
proc pub:!spam {nick host handle chan text} {
global channame 
..
...
 
		 
				
		
		 
	 
				
		
				
			- 
				
								caesar							
- Mint Rubber
- Posts: 3778
- Joined: Sun Oct 14, 2001 8:00 pm
- Location: Mint Factory
						
					
						
		
													
							
						
									
						Post
					
								by caesar » 
			
			
			
			
			
			Move the msg:chan proc and
Code: Select all
		#Set the channel to advertise on
		set channame "#sa"
		#Set your advertising message
		set advertmsg "it works"
outside the pub:!spam proc and should work.
Once the game is over, the king and the pawn go back in the same box.