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.

Responding on bot lowercase and capital letters

Old posts that have not been replied to for several years.
Locked
m
mkluin
Voice
Posts: 27
Joined: Tue Nov 05, 2002 4:11 am

Responding on bot lowercase and capital letters

Post by mkluin »

Hi,

I have a script that people can use to check stats on stuff they want to know.

But when they use caps in the names of the stuff, my bot doesn't respond.

Does anybody know how to fix this?
Regards,

Mkluin
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Yes, use the string tolower aka. strlwr. See this page for instructions.
Once the game is over, the king and the pawn go back in the same box.
m
mkluin
Voice
Posts: 27
Joined: Tue Nov 05, 2002 4:11 am

Post by mkluin »

when i check the script, it seems there already is a string like that in the script.

here is a part of the script that has the string tolower in it:

Code: Select all

   # check if valid command (armor)
   if { [llength $arg] == 0 } {
      putserv "PRIVMSG $channel :Unable to perform request, give command."
   } else {
       # get command and compare it to "armor"
       set command [lindex $arg 0]
       set command [string tolower $command]
       if { [string compare $command armor] == 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 armor_a [lindex $arg 1]
            set armor_b [lindex $arg 2]
            set armor_c [lindex $arg 3]
            if { ($armor_a == "cloth") && ($armor_b == "tunic") } { putserv "PRIVMSG $channel :Cloth Tunic costs 150 gold and has 10 Defense$



the problem is with $armor_a and $armor_b

when i use caps in those names (Cloth Armor) the bot won't answer at all.

Any idea how to fix it?
Last edited by mkluin on Tue Jun 03, 2003 4:05 am, edited 2 times in total.
Regards,

Mkluin
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

No, it matters. Please paste the binds of your proc that is not working with capital letters as you've said.
Once the game is over, the king and the pawn go back in the same box.
m
mkluin
Voice
Posts: 27
Joined: Tue Nov 05, 2002 4:11 am

Post by mkluin »

hehe. i was editing the message the second you answered. look at my prevorious message please
Regards,

Mkluin
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

The script uses 'string tolower' on the $command var, but not $armor_a or $armor_b. Change the lines to say: set armor_a [string tolower [lindex $arg 1]]<br>
<br>
(repeat for each one)
m
mkluin
Voice
Posts: 27
Joined: Tue Nov 05, 2002 4:11 am

Post by mkluin »

That didn't work. the bot doesn't respond on both lowercase and words with caps now.

the code i used was: set armor_a [string tolower[lindex $arg 1]]
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Looks like you made a typo. Try it again.
m
mkluin
Voice
Posts: 27
Joined: Tue Nov 05, 2002 4:11 am

Post by mkluin »

yeah i forgot a space.

It works now.

Thanks for the help.
Regards,

Mkluin
Locked