Re: argument help

From: Magnus Jardstam (
Date: 02/03/00

> >     if (command_arg == "diag")
> >       send_to_char("Testing...\r\n", ch);
> >
> >     if (command_arg == "testing")
> >       send_to_char("Testing...\r\n", ch);
>You can't compare strings with == in C. You have to use a function
>(conviently provided for you) to do this. Like so:
>if (!strcmp(command_arg, "diag"))
>   send_to_char("Diag...\r\n", ch);
>if (!strcmp(command_arg, "testing"))
>   send_to_char("Testing...\r\n", ch);

If you use strcmp then they have to type the words in the quotes EXACTLY as
it says in the code, so in this case they must type say diag or say testing.
Say Testing would not work and neither would say test. Use str_cmp if you
wish it to be case-insensitive and if you wish them to be able to abbreviate
the arguments then try this:

if (is_abbrev(command_arg, "diagnose"))
  send_to_char("Diag...\r\n", ch);
if (is_abbrev(command_arg, "testing"))
  send_to_char("Testing...\r\n", ch);

This will allow typings of say Test, say testi, say dia, etc, etc...

          | Menion of Mythic Portal ( 4444) |
          | Personal e-mail:             |
          | Mythic Portal e-mail:   |
          | Homepage: Not up yet                          |

Get Your Private, Free Email at

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  |

This archive was generated by hypermail 2b30 : 04/10/01 PDT