Re: Adding aedit gives me a cmd list problem

From: Patrick Dughi (dughi@imaxx.net)
Date: 05/02/03


> Hi all,
>   I am running circle 3.1 with dg_scripts pl9, ascii pfiles, hedit, olc
> 2.01, and a few other goodies. My problem is this. I added aedit to my
> base and after a few problems everything worked well. Then I noticed that
> all the socials were taking presidence over the main commands. I went back
> into interpreter.c to see if I had indeed make a few mistakes, but there
> was no problems. This is an example:
>
> I type l    for look and I receive the laugh social.

        In fact, this problem pops up quite frequently.  I don't even
think there's a check to see if a given 'new' social is also a command
(just imagine if your social was called 'look' or 'kill' !).

        Instead of having a fancy solution, I just fixed this the easy
way.   I opened up interpreter.c, located the command_interpreter()
function, and found this bit of code:

  /* otherwise, find the command */
  for (length = strlen(arg), cmd = 0; *cmd_info[cmd].command != '\n';
cmd++)
    if (!strncmp(cmd_info[cmd].command, arg, length))
      if (GET_LEVEL(ch) >= cmd_info[cmd].minimum_level)
        break;

        I simply changed it to make sure that it would never hit socials
until after everything else was checked;


  /* otherwise, find the command */
  for (length = strlen(arg), cmd = 0; *cmd_info[cmd].command != '\n';
cmd++)
    if(complete_cmd_info[cmd].command_pointer != do_action &&
       !strncmp(cmd_info[cmd].command, arg, length)
      if (GET_LEVEL(ch) >= cmd_info[cmd].minimum_level)
        break;

  /* it's not a 'real' command, so it's a social */

  if(*complete_cmd_info[cmd].command == '\n')
    for (length = strlen(arg), cmd = 0; *cmd_info[cmd].command != '\n';
cmd++)
      if (complete_cmd_info[cmd].command_pointer == do_action &&
          !strncmp(cmd_info[cmd].command, arg, length))
        if (GET_LEVEL(ch) >= cmd_info[cmd].minimum_level)
          break;


        I make sure to check if the function is not the do_action (aka,
social), and I do it first to cut down on the number of strncmps.  For the
same reason, I make sure to check the command_pointer first in the second
loop, though we already know that no 'real' command will match.

        Hope this helps!

                                                PjD

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/26/03 PDT