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.
			
		
				
			- 
				
								MacDaddy							
- Voice
- Posts: 9
- Joined: Fri Jan 20, 2006 4:41 pm
						
					
													
							
						
									
						Post
					
								by MacDaddy » 
			
			
			
			
			
			hey all i cant get this to work no matter what i try
what i need is for it to add the arg to the url but it only adds 
eg !search MacDaddy works.
but !search MacDaddy IRC it dont see the IRC part
Code: Select all
bind pub - !search pub:search
proc pub:search {n u h c a} {
 set text [lindex [split $a] 0]
 if { [string match "" "$a"] } {
  puthelp "PRIVMSG $c $n :usage: !search UserName"
  } else {
  set data [::http::geturl http://www.mydomain.com/test/ircstats.php?search=$text]
  foreach line [split [::http::data $data] \n] {
   puthelp "PRIVMSG $c :Retrieving User Data.... Please Wait...."
   puthelp "PRIVMSG $c :$line"
  }
  ::http::cleanup $data
 }
}
it needs to send the full arg to the php not just the first word
thanks for anyhelp 

 
		 
				
		
		 
	 
				
		
				
			- 
				
								r0t3n							
- Owner
- Posts: 507
- Joined: Tue May 31, 2005 6:56 pm
- Location: UK
						
					
						
		
													
							
						
									
						Post
					
								by r0t3n » 
			
			
			
			
			
			Try:
Code: Select all
bind pub - !search pub:search
proc pub:search {n u h c a} {
 if {$a == ""} {
  puthelp "PRIVMSG $c :usage: !search UserName"
  } else {
  set data [::http::geturl http://www.mydomain.com/test/ircstats.php?search=$a]
  foreach line [split [::http::data $data] \n] {
   puthelp "PRIVMSG $c :Retrieving User Data.... Please Wait...."
   puthelp "PRIVMSG $c :$line"
  }
  ::http::cleanup $data
 }
}
r0t3n @ #r0t3n @ Quakenet
			
						 
		 
				
		
		 
	 
				
		
				
			- 
				
								MacDaddy							
- Voice
- Posts: 9
- Joined: Fri Jan 20, 2006 4:41 pm
						
					
						
		
													
							
						
									
						Post
					
								by MacDaddy » 
			
			
			
			
			
			Tosser^^ wrote:Try:
Code: Select all
bind pub - !search pub:search
proc pub:search {n u h c a} {
 if {$a == ""} {
  puthelp "PRIVMSG $c :usage: !search UserName"
  } else {
  set data [::http::geturl http://www.mydomain.com/test/ircstats.php?search=$a]
  foreach line [split [::http::data $data] \n] {
   puthelp "PRIVMSG $c :Retrieving User Data.... Please Wait...."
   puthelp "PRIVMSG $c :$line"
  }
  ::http::cleanup $data
 }
}
 
Tryed that before i get no reply and no error from the bot.
also tryed :
Code: Select all
bind pub - !search pub:search
proc pub:search {n u h c a} {
 set text [lindex [split $a] 0]
 set text2 [lindex [split $a] 1]
 if { [string match "" "$a"] } {
  puthelp "PRIVMSG $c $n :usage: !search UserName"
  } else {
  set data [::http::geturl http://www.mydomain.com/test/ircstats.php?search=$text$text2]
  foreach line [split [::http::data $data] \n] {
   puthelp "PRIVMSG $c :Retrieving User Data.... Please Wait...."
   puthelp "PRIVMSG $c :$line"
  }
  ::http::cleanup $data
 }
}
that just gives whatever you type eg MacDaddy IRC 
will become MacDaddyIRC
if i put $a in 
puthelp "PRIVMSG $c :Retrieving Data For $a.... Please Wait...."
it sees the MacDaddy IRC just dont send it
 
		 
				
		
		 
	 
				
		
				
			- 
				
								rosc2112							
- Revered One
- Posts: 1454
- Joined: Sun Feb 19, 2006 8:36 pm
- Location: Northeast Pennsylvania
						
					
						
		
													
							
						
									
						Post
					
								by rosc2112 » 
			
			
			
			
			
			Instead of lindex junk, regsub the space with either %20 or %2B (+ sign) depending on what the website wants for spaces..
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
				
			- 
				
								rosc2112							
- Revered One
- Posts: 1454
- Joined: Sun Feb 19, 2006 8:36 pm
- Location: Northeast Pennsylvania
						
					
						
		
													
							
						
									
						Post
					
								by rosc2112 » 
			
			
			
			
			
			And what is the point of
 if { [string match "" "$a"] } { 
when you can just do
if {$a == ""}
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
				
			- 
				
								metroid							
- Owner
- Posts: 771
- Joined: Wed Jun 16, 2004 2:46 am
						
					
						
		
													
							
						
									
						Post
					
								by metroid » 
			
			
			
			
			
			You need to encode the URL.
You can make your own proc to do it.
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
				
			- 
				
								MacDaddy							
- Voice
- Posts: 9
- Joined: Fri Jan 20, 2006 4:41 pm
						
					
						
		
													
							
						
									
						Post
					
								by MacDaddy » 
			
			
			
			
			
			rosc2112 wrote:And what is the point of
 if { [string match "" "$a"] } { 
when you can just do
if {$a == ""}
Instead of lindex junk, regsub the space with either %20 or %2B (+ sign) depending on what the website wants for spaces..
thanks that was it needed the %20 works great 
 
if {$a == ""} <<-- dont work 
Tcl error [pub:torrent]: wrong # args: no script following "{$a == ""}" argument
 
		 
				
		
		 
	 
				
		
				
			- 
				
								rosc2112							
- Revered One
- Posts: 1454
- Joined: Sun Feb 19, 2006 8:36 pm
- Location: Northeast Pennsylvania
						
					
						
		
													
							
						
									
						Post
					
								by rosc2112 » 
			
			
			
			
			
			The format of if is:
if {test} {do stuff}
So yeah, if {test}  would not work by itself.