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.

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

Help for those learning Tcl or writing their own scripts.
Post Reply
S
Salim
Voice
Posts: 2
Joined: Sun Apr 27, 2008 5:42 am

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

Post by Salim »

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: Select all

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.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Would "someone" happen to contain characters such as {[]}" within it?
First off, you can't use list commands on strings:

Code: Select all

set user [lindex $text 0]
really should be

Code: Select all

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
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

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
S
Salim
Voice
Posts: 2
Joined: Sun Apr 27, 2008 5:42 am

Post by Salim »

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

Thanks :>
Post Reply