egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

search help

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
MacDaddy
Voice


Joined: 20 Jan 2006
Posts: 9

PostPosted: Wed Nov 01, 2006 5:52 am    Post subject: search help Reply with quote

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:

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 Smile
Back to top
View user's profile Send private message
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Wed Nov 01, 2006 6:40 am    Post subject: Reply with quote

Try:

Code:
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
Back to top
View user's profile Send private message MSN Messenger
MacDaddy
Voice


Joined: 20 Jan 2006
Posts: 9

PostPosted: Wed Nov 01, 2006 6:52 am    Post subject: Reply with quote

Tosser^^ wrote:
Try:

Code:
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:

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
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Wed Nov 01, 2006 7:47 am    Post subject: Reply with quote

Instead of lindex junk, regsub the space with either %20 or %2B (+ sign) depending on what the website wants for spaces..
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Wed Nov 01, 2006 7:50 am    Post subject: Reply with quote

And what is the point of

if { [string match "" "$a"] } {

when you can just do

if {$a == ""}
Back to top
View user's profile Send private message
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Wed Nov 01, 2006 3:04 pm    Post subject: Reply with quote

You need to encode the URL.
You can make your own proc to do it.
Back to top
View user's profile Send private message
MacDaddy
Voice


Joined: 20 Jan 2006
Posts: 9

PostPosted: Wed Nov 01, 2006 5:40 pm    Post subject: Reply with quote

rosc2112 wrote:
And what is the point of

if { [string match "" "$a"] } {

when you can just do

if {$a == ""}


Quote:
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 Smile

if {$a == ""} <<-- dont work

Tcl error [pub:torrent]: wrong # args: no script following "{$a == ""}" argument
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Wed Nov 01, 2006 6:22 pm    Post subject: Reply with quote

The format of if is:

if {test} {do stuff}


So yeah, if {test} would not work by itself.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber