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 

[SOLVED] Trying to set user variables and download a file.

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


Joined: 27 Apr 2008
Posts: 2

PostPosted: Sun Apr 27, 2008 5:46 am    Post subject: [SOLVED] Trying to set user variables and download a file. Reply with quote

Hey, im trying to make a script which downloads a file depending what the user writes eg. '!stats someone' would get a certain file eg http://server.tld/stats.php?stats=someone. Heres what I got until now and I dont have a clue why it isnt working.

Code:
package require http

bind pub 0 !stats getfile
proc getfile {nick host hand chan text} {
      set user [lindex $text 0]
      set x [::http::geturl http://server.tld/stats.php?export=$user]
      foreach pasta [split [::http::data $x] \n] {puthelp "privmsg $c :$pasta"}
      ::http::cleanup $x
}


Sincerely,
Salim


Last edited by Salim on Sun Apr 27, 2008 12:04 pm; edited 1 time in total
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Apr 27, 2008 11:07 am    Post subject: Reply with quote

Would "someone" happen to contain characters such as {[]}" within it?
First off, you can't use list commands on strings:
Code:
set user [lindex $text 0]
really should be
Code:
set user [lindex [split $text] 0]


Secondly, I assume you've checked user privileges - that the user issuing the command is properly identified as a user with the +0 flag...

Third, do you get any error messages on your console or such?
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Sun Apr 27, 2008 11:52 am    Post subject: Reply with quote

having a bind flag of "0" means the person already has to have that flag in the bot's userlist, binds do not automatically give flags
Back to top
View user's profile Send private message
Salim
Voice


Joined: 27 Apr 2008
Posts: 2

PostPosted: Sun Apr 27, 2008 12:03 pm    Post subject: Reply with quote

Changed the line and the flag to '-' and it works now.

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