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.

what is wrong with this script?

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

Post by ahv »

Hi

Can somebody check this code and tell me what is wrong with it?

# flirt.tcl
# by ahv - 09/05/2002

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

# 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 (flirt)
if { [llength $arg] == 0 } {
putserv "PRIVMSG $channel :Unable to perform request, give command."
} else {
# get command and compare it to "flirt"
set command [lindex $arg 0]
set command [string tolower $command]
if { [string compare $command flirt] == 0 } {
# check if valid number of arguments
if { [llength $arg] < 2 } {
putserv "PRIVMSG $channel :razz:lease check the help function if you don't know how to use this command."
# command syntax is ok, process request
} else {
set level [lindex $arg 1]
if { $level == wink } { putserv "PRIVMSG $channel :You can always Wink." }
if { $level == smile } { putserv "PRIVMSG $channel :You need 5 Charm Points to start to Smile" }
if { $level == compliment } { putserv "PRIVMSG $channel :You need 15 Charm Points to start to Compliment." }
if { $level == hug } { putserv "PRIVMSG $channel :You need 30 Charm Points to start to Hug" }
if { $level == kiss } { putserv "PRIVMSG $channel :You need 50 Charm Points to start to Kiss" }
if { $level == backrub } { putserv "PRIVMSG $channel :You need 80 to start to Backrub" }
if { $level == pinch } { putserv "PRIVMSG $channel :Females need 80 Charm Points to start to Pinch. - Males need 120 Charmpoints to start to Pinch." }
if { $level == snuggle } { putserv "PRIVMSG $channel :Females need 120 Charm Points to start to snuggle." }
if { $level == upstairs } { putserv "PRIVMSG $channel :Males need 190 Charm Points to take Lily Upstairs." }
if { $level == invite } { putserv "PRIVMSG $channel :Females need 190 Charm Points to Invite Rowen to their room." }
}
}
}
}

The error i get is:
TCL error [pub:ahv]: syntax error in expression " $level == wink "
M
Mordred

Post by Mordred »

Syntax error in the == expression likely refers to the fact you are comparing strings and not numbers, hence you should enclose the values in quotes.

if {$level == "wink"}
a
ahv

Post by ahv »

Thanks Mordred

Locked