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 

PLz help me with a mirc script

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


Joined: 28 Dec 2006
Posts: 2

PostPosted: Thu Dec 28, 2006 12:53 am    Post subject: PLz help me with a mirc script Reply with quote

This is for an irc for a website i am setting up for peeps that share homebrew movies and such IT IS NOT AN ILLEGAL SITE!!!

this is error i get
Quote:

[10:54] Tcl error [user_test]: wrong # args: should be "user_test nick host handle channel text site_add"

[10:55] Tcl error [user_search]: wrong # args: should be "user_search nick host handle channel text staffchan"



any ideas guys.....

here is the code


Code:
package require mysqltcl

###### Set Site address ###########################

set site_add "http://www.bleh.com"

###### Setup Your database info here ##############

set dbuser "user"
set dbpassword "pass"
set name "dbname"
set portno "2222"

##### Set site channels ##########################

set staffchan "#staff"
set userchan "#user"
set uploaderchan "#uppers"
set uploaderclassno "7"

##################################################
# Connect to Database #
##################################################

set db_handle [mysqlconnect -host localhost -socket /tmp/mysql.sock -port $portno -user $dbuser -password $dbpassword -db $name]


##################################################
# Bind channel commands #
##################################################

bind pub "-|-" !user user_search
bind pub "-|-" !file user_file
bind pub "-|-" @file user_file
bind pubm - "% *request*" user_request

bind msg - pass invite_me

##################################################
# Set user defined flag for users #
##################################################

setudef flag UserSearch

##################################################
# /msg botname pass ircpass #
##################################################

proc invite_me { nick host handle text uploaderclassno uploaderchan userchan} {

global db_handle

set sql "SELECT irc, class FROM users WHERE username='%[mysqlescape $nick]%'"

set result [mysqlsel $db_handle $sql -list]

if {$result > 0} {

set record [lindex $result 0];
set pass [lindex $record 0];
set class [lindex $record 1];

if {$text == $pass} {

putserv "NOTICE $nick :Invite Successfull"
putserv "invite $nick $userchan"


if {$class > $uploaderclassno} {

putserv "invite $nick $uploaderchan"

}

} else {

puthelp "NOTICE $nick :The password you supplied does not match our records."

}

} else {

puthelp "NOTICE $nick :The username $nick was not found in our records. Ensure your nickname matches your site name."

}

mysqlendquery $result
}


##################################################
# Check file names #
##################################################


proc user_file { nick host handle channel text site_add} {

global db_handle


if {![channel get $channel UserSearch]} {
return 0
}

set sql "SELECT id, name, size, unix_timestamp(added), leechers, seeders FROM files WHERE search_text LIKE '%[mysqlescape $text]%' ORDER BY added DESC LIMIT 1"

set result [mysqlsel $db_handle $sql -list]

if {$result > 0} {

set record [lindex $result 0];
set id [lindex $record 0];
set name [lindex $record 1];
set size [lindex $record 2];
set added [lindex $record 3];
set added [duration [expr [clock seconds] - $added]];
set leechers [lindex $record 4];
set seeders [lindex $record 5];


if {[expr $size / 1024] >= 1} {
set sized "[string range "[expr $size / 1024.0]" 0 [expr [string length "[expr $size / 1024]"]+ 2] ] KB"};

if {[expr $size / 1048576] >= 1} {
set sized "[string range "[expr $size / 1048576.0]" 0 [expr [string length "[expr $size / 1048576]"]+ 2] ] MB"};

if {[expr $size / 1073741824] >= 1} {
set sized "[string range "[expr $size / 1073741824.0]" 0 [expr [string length "[expr $size / 1073741824]"]+ 2] ] GB"};


puthelp "NOTICE $nick :Name: $name"
puthelp "NOTICE $nick :Size: $sized"
puthelp "NOTICE $nick :Added: $added ago"
puthelp "NOTICE $nick :Seeders: $seeders"
puthelp "NOTICE $nick :Leechers: $leechers"
puthelp "NOTICE $nick :Link: $site_add/details.php?id=$id"

} else {
puthelp "NOTICE $nick :No matches : Please try again"
}


mysqlendquery $result
}



##################################################
# Perform User Search #
##################################################


proc user_search { nick host handle channel text staffchan} {
global db_handle


if {![channel get $channel UserSearch]} {
return 0
}

set sql "SELECT id, username, class, unix_timestamp(added), uploaded, downloaded, gender FROM users WHERE username='%[mysqlescape $text]%'"

set result [mysqlsel $db_handle $sql -list]

if {$result > 0} {

set record [lindex $result 0];
set id [lindex $record 0];
set username [lindex $record 1];
set class [lindex $record 2];
set added [lindex $record 3];
set added [duration [expr [clock seconds] - $added]];
set upload [lindex $record 4];
set download [lindex $record 5];
set gender [lindex $record 6]


if {[expr $upload / 1024] >= 1} {
set uploaded "[string range "[expr $upload / 1024.0]" 0 [expr [string length "[expr $upload / 1024]"]+ 2] ] KB"};

if {[expr $upload / 1048576] >= 1} {
set uploaded "[string range "[expr $upload / 1048576.0]" 0 [expr [string length "[expr $upload / 1048576]"]+ 2] ] MB"};

if {[expr $upload / 1073741824] >= 1} {
set uploaded "[string range "[expr $upload / 1073741824.0]" 0 [expr [string length "[expr $upload / 1073741824]"]+ 2] ] GB"};

if {[expr $upload / 1099511627776] >= 1} {
set uploaded "[string range "[expr $upload / 1099511627776.0]" 0 [expr [string length "[expr $upload / 1099511627776]"]+ 2] ] TB"};

if {[expr $download / 1024] >= 1} {
set downloaded "[string range "[expr $download / 1024.0]" 0 [expr [string length "[expr $download / 1024]"]+ 2] ] KB"};

if {[expr $download / 1048576] >= 1} {
set downloaded "[string range "[expr $download / 1048576.0]" 0 [expr [string length "[expr $download / 1048576]"]+ 2] ] MB"};

if {[expr $download / 1073741824] >= 1} {
set downloaded "[string range "[expr $download / 1073741824.0]" 0 [expr [string length "[expr $download / 1073741824]"]+ 2] ] GB"};

if {[expr $download / 1099511627776] >= 1} {
set downloaded "[string range "[expr $download / 1099511627776.0]" 0 [expr [string length "[expr $download / 1099511627776]"]+ 2] ] TB"};


switch $class {

"0" {set class "Leecher" }
"1" {set class "User" }
"2" {set class "Power User" }
"3" {set class "Donor" }
"4" {set class "Supreme User" }
"5" {set class "Power Seeder" }
"6" {set class "Ultimate Seeder" }
"7" {set class "VIP" }
"8" {set class "Light Uploader" }
"9" {set class "Maxi Uploader" }
"10" {set class "Support" }
"11" {set class "Moderator" }
"12" {set class "Supervisor" }
"13" {set class "Administrator" }
"14" {set class "Sysop" }
"default" {set class "Not Found" }
}


puthelp "PRIVMSG $staffchan User: $username"
puthelp "PRIVMSG $staffchan Gender: $gender"
puthelp "PRIVMSG $staffchan Class: $class"
puthelp "PRIVMSG $staffchan Joined: $added ago"
puthelp "PRIVMSG $staffchan Upload: $uploaded Download: $downloaded"
puthelp "PRIVMSG $staffchan Link: $site_add/userdetails.php?id=$id"

} else {

puthelp "PRIVMSG $channel :No matches"

}


mysqlendquery $result

}
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Thu Dec 28, 2006 2:05 am    Post subject: Reply with quote

As you seem to be teaching yourself Tcl you may find the following links informative:

Guide to TCL scripting for Eggdrop 1.6
man/tcl8.4/TclCmd/
A beginners guide to TCL with focus on Eggdrop
Eggdrop Tcl Commands
How to write eggdrop scripts that won't choke on special characters
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Thu Dec 28, 2006 7:47 am    Post subject: Reply with quote

Procedure user_search should take 5 arguments only: nick uhost hand chan arg. user_test does not exist in your given code.

Also read: Help us to help you and Posts with poor subject lines may be deleted to learn how to post the right way so you can get proper help.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
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