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.

Trigger help

Help for those learning Tcl or writing their own scripts.
Post Reply
A
Ace-T
Halfop
Posts: 82
Joined: Tue Aug 29, 2006 7:25 am

Trigger help

Post by Ace-T »

hey guys looking for a script to trigger the bot into send a command to a mysql data base, i have come up with 1 that works when they join irc, it updates the data base but cant get it to work on part or quit...

here is the onjoin code, would some1 to be ble to adapt it to work on part

Code: Select all

load /xxxxxxxxxxx/mysqltcl/libmysqltcl2.30.so
package require mysqltcl
set db_handle TOOK THIS BIT OUT
# main strings
bind pub - !user ircjoin
#setudef flag testing
proc ircjoin { nick host handle channel text } {
global db_handle quote_noflags  
#  if {![channel get $channel testing]} {
#    return 0
#  }  
#  if [matchattr $handle $quote_noflags] { return 0 }
#  if {($handle == "") || ($handle == "*")} {
#    set handle $nick
#  }  
  set sql "UPDATE users SET onirc = 'yes' WHERE username = '$nick'"
  putloglev d * "ircstats: executing $sql"
  set result [mysqlexec $db_handle $sql]
  if {$result != 1} {
    putlog "An error occurred with the sql :("
  } else {    
     set id [mysqlinsertid $db_handle]
     puthelp "PRIVMSG $channel :User Online \002$nick\002 added"
  }
}
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

Wouldn't it simply be a matter of duplicating your 'proc ircjoin' renaming it to like 'proc ircpart' and using the PART and QUIT binds?
Post Reply