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.
			
		
				
			
				
								spithash 							 
						Master 			
		Posts:  251 Joined:  Thu Jul 12, 2007 9:21 amLocation:  Libera
				Contact: 
				
			 
				
		 
		
						
					
													
							
						
									
						Post 
					 
								by spithash  Mon Apr 22, 2013 5:34 am 
			
			
			
			
			
			Code: Select all 
{exec cut \-d. \-f1 /proc/uptime} reply; set secs [expr $reply % 60]; set mins [expr $reply / 60 % 60]; set hours [expr $reply / 3600 % 24]; set days [expr $reply / 86400]
Can anyone please let me know how can I fix this? what am I doing wrong?
I'm not a coder, I'm trying to be one. this is from a script I found and I am trying to fix it.
The errors I get are:
Code: Select all 
% {exec cut \-d. \-f1 /proc/uptime} reply; set secs [expr $reply % 60]; set mins [expr $reply / 60 % 60]; set hours [expr $reply / 3600 % 24]; set days [expr $reply / 86400]
invalid command name "exec cut \-d. \-f1 /proc/uptime"
%
Libera ##rtlsdr & ##re - Nick: spithash 
			
						 
		 
				
		
		 
	 
				
		
				
			
				
								caesar 							 
						Mint Rubber 			
		Posts:  3778 Joined:  Sun Oct 14, 2001 8:00 pmLocation:  Mint Factory 
		
						
					
						 
													
							
						
									
						Post 
					 
								by caesar  Mon Apr 22, 2013 6:15 am 
			
			
			
			
			
			if you wish to store the result of the exec command in the 
reply  variable, then replace:
Code: Select all 
{exec cut \-d. \-f1 /proc/uptime} reply;
with either:
Code: Select all 
set reply [exec cut \-d. \-f1 /proc/uptime]
or:
Code: Select all 
catch {exec cut \-d. \-f1 /proc/uptime} reply
I would go with first option.
Once the game is over, the king and the pawn go back in the same box.
			
						 
		 
				
		
		 
	 
				
		
				
			
				
								spithash 							 
						Master 			
		Posts:  251 Joined:  Thu Jul 12, 2007 9:21 amLocation:  Libera
				Contact: 
				
			 
				
		 
		
						
					
						 
													
							
						
									
						Post 
					 
								by spithash  Mon Apr 22, 2013 8:39 am 
			
			
			
			
			
			what about this?
Code: Select all 
[03:59:38] <@spithash> ;set reply {exec cut -d. -f1 /proc/uptime} set secs [expr {$reply % 60}]; set mins [expr {$reply / 60 % 60}]; set hours [expr {$reply / 3600 % 24}]; set days [expr {$reply / 86400}]
[03:59:40] <@nigger> spithash: #29 Tcl error: can't use non-numeric string as operand of "%"
Libera ##rtlsdr & ##re - Nick: spithash 
			
						 
		 
				
		
		 
	 
				
		
				
			
				
								caesar 							 
						Mint Rubber 			
		Posts:  3778 Joined:  Sun Oct 14, 2001 8:00 pmLocation:  Mint Factory 
		
						
					
						 
													
							
						
									
						Post 
					 
								by caesar  Tue Apr 23, 2013 12:27 am 
			
			
			
			
			
			Before the 
set secs  you forgot to add an ;
Try with:
Code: Select all 
set reply [exec cut -d. -f1 /proc/uptime]; set secs [expr {$reply % 60}]; set mins [expr {$reply / 60 % 60}]; set hours [expr {$reply / 3600 % 24}]; set days [expr {$reply / 86400}]
Once the game is over, the king and the pawn go back in the same box.