It doesn't calculate:
Code: Select all
# listen to all ahv commands in channels
bind pub - ahv pub:ahv
# limit the chans to listen in by filling them in here ( more chans goes this way {#chan1 #chan2}
set enabledchans {#ahv #nike #bbs #equinox1 #equinox2 #equinox3 #equinox4 #equinox5 #antisocial #lotus}
# procedure to check if chan where command is used is listed chan
proc isenabledchan { channel } {
global enabledchans
# compare each chan in $enabledchans with current chan and return 1 (true) if chan is listed
foreach enablechan $enabledchans {
if { $channel == $enablechan } {
return 1
}
}
return 0
}
# main procedure to handle the ahv commands
proc pub:ahv { nick uhost handle channel arg } {
# check if command should work in this chan
set chan [string tolower $channel]
if { ![isenabledchan $chan] } {
return 1
}
# check if valid command (calc)
if { [llength $arg] == 0 } {
putserv "PRIVMSG $channel :Unable to perform request, give command."
} else {
# get command and compare it to "xp"
set command [lindex $arg 0]
set command [string tolower $command]
if { [string compare $command xp] == 0 } {
# check if valid number of arguments
if { [llength $arg] < 2 } {
putserv "PRIVMSG $channel :Please check the help function if you don't know how to use this command."
# command syntax is ok, process request
} else {
set calc_a [lindex $arg 1]
set calc_b [lindex $arg 1]
if { $calc_b == "" } { set $calc_b 24 }
{ set $calc_temp [expr $calc_a / 1.01 * $calc_b] }
{ putserv "PRIVMSG $channel :After $calc_b hours in the bank, $calc_a gold will be $calc_temp gold." }
}
}
}
<font size=-1>[ This Message was edited by: ahv on 2002-05-30 03:58 ]</font>