Re: Setcmd Code - Was: Re: New oedit.c Code

From: Tony Robbins (tonyr@NWPACLINK.COM)
Date: 07/01/98


At 12:39 PM 7/1/98 -0500, you wrote:
>Bsst.. Sorry.. Ok, everyone refer to the thing under the snippets page
>called "Trust System".  Hate to say it, but it was MY creation, and my
>coder said you stole it from him.  Anyways, it wasnt even done right,
>theres like 5 things you missed in it.
>
>Ok Guys, I'm gonna go ahead and release what I did for code called setcmd
>
>the do_wizhelp and do_setcmd are posted (by Quinn) with my exact variables
>in it that I used when I created it (either he read my mind, or.. he
>stole it)
>
>in interpreter set ALL god commands to LVL_IMMORT (unless you want to keep
>some level restricted)
>
>also take out the old wizhelp (or what I did was changed it to oldwizhelp)
>and define ACMD(do_new_wizhelp) and place it in the interpreter comands
>
>in structs.h define the certain command sets you want
>i.e.
>#define CMD_ADVANCE     (1 << 0)
>#define CMD_BAN         (1 << 1)
>
>also.. down in player_specials.saved change a spare long from sparen to
>cmd
>
>in utils.h pretty much copy the PRF_FLAGGED, PRF_BITS, anything with PRF
>and make it CMD_FLAGGED, CMD_BITS, etc..
>
>in act.wizard.c add that snippet (the setcmd is basically a rip off of
>set, but it works), and for wizhelp modify it as so..
>comsend = (<COMMAND BIT>, "<command name>", nums);
>
>Ok, heres what makes it..
>
>In each command place that has a cmdset, place this..
>
>if (!CMD_FLAGGED(<CMD BIT>, ch)) {
>   send_to_char("Huh?\r\n", ch);
>   return;
>}

I don't suggest using this manner.  If you get _MY_ godset.stk.tgz from
circlemud.org/pub/contrib/code, you'll see another way of doing it.

    command       ACMD          position     minlevel      scmd
  { "ban"       , do_ban        , POS_DEAD      , LVL_GRGOD     , 0 },

becomes:

    command     ACMD          position     minlevel      scmd    required bit
  { "ban"       , do_ban        , POS_DEAD      , LVL_IMMORT    , 0     , CMD_BAN },

You can use this for regular commands too if you experiment with a long
long.  You also have to change the structure in interpreter.h to have a
"long   godbit;" or whatever.

Down with the "Huh?!?" stuff, put this:

  if (!CMD_FLAGGED(cmd_info[cmd].godbit, ch)) {
    send_to_char("Huh?!?\r\n", ch);
    return;
  }

It makes it seem niftier that way.  This code isn't really tough.  The
first time I did it, I did it the way he said above, but that requires
extra code and gets confusing if you want to add things to two groups.  The
way I've noted allows for overlapping command groups:

  { "ban"       , do_ban        , POS_DEAD      , LVL_IMMORT    , 0 , CMD_BAN | CMD_PR },

So you can specifically give the command or you can put it in a group
called PR.  I've never tried making a double requirement, but that'd just
be silly anyway.  If you look at the way it's done in godset.stk.tgz, it
just adds like one line to the wizhelp command and mimics set for the rest.
 I have to say that this version of set is prettier, but I was just
interested in getting it done.  :P

-B.


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



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