Re: [Code help] - pfiles

From: Will Andrews (andrews@TECHNOLOGIST.COM)
Date: 01/30/99


At 07:21 PM 1/29/99 -0600, you wrote:
>to do is change everyone's default AC from 100 to 1000.  Would
>anyone know of an easy way of doing this w/ vi or emacs or perhaps

with vi:

enter command mode (hit <ESC> to check).
enter the search command--
        :%s/AC: 100/AC: 1000/

: = command, %s = replace all, /find this/replace with this/

You may have to put an escape sequence before the ":" in the search, like so:
        :%s/AC\: 100/AC\: 1000/

Encompassing this e-mail, I suggest you backup your pfile before trying this.

Unfortunately, if you have more than one pfile.. you'll have to do this for
all of them -- vi isn't like sed or awk, which i have yet to understand. ;\

--

in code (wrote this in 5 mins or so):

ACMD(do_set_all_ac) {
  int i = 0, val = 0;

        one_argument(argument, arg);

        if ((arg) && is_number(arg)) {
                val = atoi(arg);
                for (i = 0; i <= top_of_p_table; i++) {
                        GET_AC(player_table[i]) = val;
                }
        } else {
                send_to_char("Invalid argument. Must be numerical.\r\n", ch);
                return;
        }
        sprintf(buf, "Okay, set all people's AC to %d.", val);
        send_to_char(buf, ch);
}

Of course, you'll need to add the appropriate declarations to interpreter.c
for this command to work. And, I don't even know if it works for sure
(haven't tested), but it should, or it should require minor tweaking.

Toodles.

--Acme, Maintenance Implementor & Demi-Coder [NIC: WA915]
The Black Dawn -- http://www.blackdawn.com/ -- telnet://blackdawn.com:4000


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST