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.

can't get this mirc script to work in a tcl script

Old posts that have not been replied to for several years.
Locked
a
ahv

Post by ahv »

Hi

I am trying to get this mirc script to work with an eggdrop bot.

Anybody knows how to get it to work?

on 1:text:*:#:{
if ($1 == ahv) {
if ($2 == calculate) || ($2 == calc) {
if ($3 >= 100) {
if ($4 isnum) { var %Hrs $4 }
else var %Hrs 24
var %StrtGold $3
var %Gold %StrtGold
var %X 0
while (%X < %Hrs) {
var %Gold $int($calc(%Gold * 1.01))
inc %X
}
msg $chan After %Hrs hours in the bank, %StrtGold gold will be %Gold gold.
}
else msg $chan You must have 100 or more gold to earn interest!
}
}
}

My bot's script is setup this way:

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 {#ahv2 #nike}

# 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 (xp)
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 exp [lindex $arg 1]

Please can anybody help me to convert the mirc script to tcl with the way it is setup?

Regards,

ahv
Locked