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.

Simple usersearch help needed

Help for those learning Tcl or writing their own scripts.
Post Reply
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Simple usersearch help needed

Post by starpossen »

I've got this little script:

Code: Select all

bind pub - !user foo
proc foo {n u h c a} {
 set nick [lindex [split $a] 0]
 if {$nick!=""} {
  set data [::http::geturl http://www.mysite.com/users.php?search=]
  foreach line [split [::http::data $data] \n] {
   putserv "PRIVMSG $c :$line"
  }
  ::http::cleanup $data
 }
}
Wich will then post a link to the users profile page from the site.
But somehow it is not working, am I missing something?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

bind pub - !user foo 
proc foo {n u h c a} { 
  if {![llength [set nick [lindex [split $a] 0]]]} return
  set token [::http::geturl http://www.mysite.com/users.php?search=$nick] 
  set data [::http::data $token]
  ::http::cleanup $data
  foreach line [split $data \n] { 
    putserv "PRIVMSG $c :$line" 
  } 
}
Shouldn't the url be "http://www.mysite.com/users.php?search=nick" by any chance?

Edit: Damn typos. Fixed it.. again.
Last edited by caesar on Sat Jun 03, 2006 4:52 pm, edited 4 times in total.
Once the game is over, the king and the pawn go back in the same box.
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

Well, I used that url in a small script for my mIRC bot, wich worked, but this one aint working for my eggdrop and I really would like it to work for my drop, nothing is happening when I type !user starpossen and I tried adding nick to the url, but that didnt help.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Then add a line like:

Code: Select all

putserv :PRIVMSG $c :finished"
or a putlog line to see if the script works.
Once the game is over, the king and the pawn go back in the same box.
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

I tried adding that line, but my drop is still not responding to the trigger.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Oops! :oops: Forgot to add a pair of [] to the proc I've posted. Get it again and see if it works..
Once the game is over, the king and the pawn go back in the same box.
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

Thanks for your quick replies, but maybe im wayy to tired, cause where would I put the []'s ?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Not you, I forgot to add them in the proc I've posted above. Get it again and test it on your bot. Also, change that url to "http://www.mysite.com/users.php?search=$nick" because this way I think it should be.
Once the game is over, the king and the pawn go back in the same box.
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

This is what happens:

Code: Select all

[22:36:15] <%starbot> ::http::17
And the number gets higher every time I trigger the command.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Silly me... It's a bit late and I must be blind or something.. I have fixed the code .. again.. sorry.

Code: Select all

bind pub - !user foo 
proc foo {n u h c a} { 
  if {![llength [set nick [lindex [split $a] 0]]]} return 
  set token [::http::geturl http://www.mysite.com/users.php?search=$nick] 
  set data [::http::data $token] 
  ::http::cleanup $data 
  foreach line [split $data \n] { 
    putserv "PRIVMSG $c :$line" 
  } 
}
Once the game is over, the king and the pawn go back in the same box.
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

Still wont react, I made one for my mIRC bot:

Code: Select all

on *:text:.user*:#:{

  if ($nick isop $chan && $2-) { /user $nick $2- }
}
alias user {

  if ($1 && $2-) { 

    notice $1 http://www.mysite.com/users.php?search= $+ $replace($2-,$chr(32),+) 
  }
}
Wich will post the link to the username in the searchlist on the site.
I dont know if this can be rewritten to tcl., if the other one cant be fixed?
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

starpossen wrote: I dont know if this can be rewritten to tcl., if the other one cant be fixed?
you are on the wrong forum dude, this one is for people who know at least the basics of Tcl, and obviously you aren't among them

post to "Script Requests"
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

Im very well aware of what forum this is, I just asked a question, and showed the mirc script as an example, and hoping it might shed a light on my idea, but nevermind.
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

No point posting a mIRC 'script' on a forum exclusively for Tcl. You'd be lucky if anyone could understand it anyway. Learn Tcl and attempt a translation yourself maybe. :)
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Post Reply