Basically what I am trying to do, is setup a command like this:
!location BotName BotsLocation(Ingame) What-the-bot-is-doing
Now this is all manual, so I'm just storing it to a file.
Now heres the code:
Code: Select all
proc locate { nick user hand chan arg } {
set locatebot [lindex $arg 0]
set location [lindex $arg 1]
set action [lrange $arg 2 end]
if {$locatebot == ""} {
puthelp "PRIVMSG $chan :The bot you specified does not match any bot in my database."
return 0
}
if {$location == ""} {
puthelp "PRIVMSG $chan :Not a valid location."
return 0
}
if {$action == ""} {
puthelp "PRIVMSG $chan :You have to specify what the bot is currently doing."
return 0
}
set file [open bots.db w+]
set found 0
set index ""
while {![eof $file]} {
gets $file line
if {[string match $locatebot [lindex $line 0]]} {
set found 1
}
}
if {$found == 1} {
puts $file "$locatebot $location $action"
putserv "PRIVMSG $chan :The location and action of $locatebot have been added to the database."
return
} else {
puts $file "$locatebot $location $action"
putserv "PRIVMSG $chan :The location and action of $locatebot have been changed in the database."
return
}
}
Thanks