An example TCL script can be found at http://members.fortunecity.com/eggheadtcl/menu.tcl.txtThis proposal of opening a dcc connection sounds interresting.
stdragon: You can find an example of the data in my module in the thread "Speedup of printout".
stdragon, egghead: I would be very greatfull if it would be possible for You to help me with just and example of how to establish a dcc connection with the client. Please post it in the thread "Speedup of printout", since thats the most appropriate one for this matter.
// M0dj0
Code: Select all
putserv "PRIVMSG $nick :\001DCC CHAT chat [myip] $menuport\001"
Code: Select all
load d:/pathto/fbsql.dll
set menuport 47000
#---------------------------------------------------------------------
# handle public !menu request: initialize DCC CHAT...
#---------------------------------------------------------------------
bind msg -|- !regmenu pubmenu
proc pubmenu {nick uhost hand chan} {
global menuport
putlog "Request for menu by $nick (aka $hand)"
putserv "PRIVMSG $nick :\001DCC CHAT chat 11111111111 $menuport\001"
}
listen $menuport script presentmenu
proc presentmenu { idx } {
# upon a successfull connection:
# present the menu...
menuchoice $idx
# ... and control to waitchoice
control $idx waitchoice
}
proc menuchoice { idx } {
putdcc $idx ""
putdcc $idx "Type the option number you wish to select and hit ENTER:"
putdcc $idx "1. List Current Registrants"
putdcc $idx "2. List a Individual Status (Type "2 <username>")
}
#---------------------------------------------------------------------
# proc waitchoice is triggered if the user types something...
# the proc returns either 0 or 1
# return 0: user input is sent to the procedure again
# return 1: control is returned to the bot (will close connection)
#---------------------------------------------------------------------
proc waitchoice { idx choice args} {
global botnick server
switch -- $choice {
1 { reglist $idx }
2 { regstat $idx $args }
EXIT { return 1 }
exit { return 1 }
"" { return 1 ; # connection terminated by client }
default { putidx $idx "$choice is not possible, try again" }
}
# present the menu again...
menuchoice $idx
# ... and leave control here
return 0
}
proc reglist { idx } {
set text ""
set regcount 0
sql1 connect 192.168.1.1 username password
sql1 selectdb vbulletin
sql2 connect 192.168.1.1 username password
sql2 selectdb vbulletin
sql1 startquery "SELECT userid,field6,field7,field15,field21,field28 from userfield where field10='Registered' ORDER BY field15 DESC, field23 ASC" -array registrant
while {[sql1 fetchrow] != ""} {
sql2 startquery "SELECT username from user where userid='$registrant(userid)'" -array userinfo
sql2 fetchrow
if { $registrant(field15) == "3PAID"} {set paystat "3,0PAID"}
if { $registrant(field15) == "2PENDING"} {set paystat "8,0PENDING"}
if { $registrant(field15) == "1REJECT"} {set paystat "4,0Contact test@test.org"}
if { $registrant(field15) == ""} {set paystat "4,0Not Pre-Paid"}
incr regcount
putdcc $idx "$regcount. 1,0$registrant(field6) $registrant(field7) - Nick: 12,0$userinfo(username) 1,0- PayStatus: $paystat\r\n"
sql2 endquery
}
sql2 disconnect
sql1 endquery
sql1 disconnect
}
proc regstat { idx args } {
set text ""
set attendee [lindex $args 0]
sql1 connect 192.168.1.1 username password
sql1 selectdb vbulletin
sql2 connect 192.168.1.1 username password
sql2 selectdb vbulletin
sql1 startquery "SELECT userid from user where username='$attendee'" -array registrant
while {[sql1 fetchrow] != ""} {
sql2 startquery "SELECT field6,field7,field15,field21,field28 from user where userid='$registrant(userid)'" -array userinfo
sql2 fetchrow
if { $userinfo(field15) == "3PAID"} {set paystat "3,0PAID"}
if { $userinfo(field15) == "2PENDING"} {set paystat "8,0PENDING"}
if { $userinfo(field15) == "1REJECT"} {set paystat "4,0Contact test@test.org"}
if { $userinfo(field15) == ""} {set paystat "4,0Not Pre-Paid"}
putdcc $idx "1,0$userinfo(field6) $userinfo(field7) - Nick: 12,0$attendee 1,0- PayStatus: $paystat\r\n"
sql2 endquery
}
sql2 disconnect
sql1 endquery
sql1 disconnect
}
putlog "Menu version 0 loaded: DCC connections on port $menuport."
What's your current ident-timeout?Squirre1 wrote:Is there any way to speed up the above because that is like a 10-20 second pause and I would like the users to get the menu instantly after the dcc session is made..
Ok then where is the script not working aka "me jacking it up" because if I put in "2 Username" and hit enter.. I get back "2 Username is not possible, try again"Procs triggered by a connection put under 'control' are called with two arguments, the first is the idx of the connection, the second is the entire line of user input, OR "" if the user disconnected.