So I'm writing a script for a points tracking system for my eggdrop. The idea is that an op can /msg the bot with the command "points <user> <value>" where <value> is optional (if left blank, it defaults to 100). The bot then stores the score in the user's whois field under "points".
set our_chan "<channel>" ;## <- MUST set a channel!##
bind msg o points addpoints
proc addpoints {nick host hand text} {
global our_chan
lassign [split [string trim $text]] whom points
if {$whom eq ""} {
puthelp "PRIVMSG $nick :Use: \002/msg $::botnick <handle> \[points\]\002"
return 0
}
if {![validuser $whom]} {
puthelp "PRIVMSG $nick :\002$whom\002 is not a valid handle!"
return 0
}
if {[string match -nocase $whom $hand]} {
puthelp "PRIVMSG $nick :You can't award yourself points. Don't be a schmuck."
return 0
}
if {![string is digit -strict $points]} { set points 100 }
puthelp "PRIVMSG $our_chan :$nick gives $points to $whom."
# now you can check if they already have any points
# and do the math for their new total points
# and save the new total points to the user file
return 0
}