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

From: Erwin S. Andreasen (erwin@ANDREASEN.COM)
Date: 07/01/98


On Wed, 1 Jul 1998, Travis Turner wrote:

> in interpreter set ALL god commands to LVL_IMMORT (unless you want to keep
> some level restricted)

[...]

> 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;
> }

Instead of having to add those 3 lines of code to every admin command, and
being limited to only 32 commands, unless you use some other extend bit
system, you might want to simply use a string list of of commands, and
then use the is_name (or whatever it is called in Circle) function to
check if the admin has been assigned this command, e.g.:

ch -> allowed_commands = "slay ban reboot";



if (command needs authorization )
        if ( "command name" IS one of the keywords in
                ch->allowed_commands)
                go right ahead
        else
                Nope


You can then expand on it further by making, in the command that grants
commands, "packages" with commands - e.g. 'olc' might give Aedit, Bedit
and Cedit, and 'all' might just give all available commands.

Even better, you can expand this to not just 'commands' but
'capabilities'.

For example, when sending out immtalk chats, I don't check if the player
is level immortal and above - I simply check if they have the 'immtalk'
command.

Thus admin mortals can be given this command and automatically use and
listen to the channel.

Also, some more dangerous functions - like deleting an area - require to
have the 'aedit_delete' pseudocommand - it's not really a command that can
be used, but it has a certain level (at which you get it automatically)
and it can be granted to those that need it for some reason.


 =============================================================================
<erwin@andreasen.com>      Herlev, Denmark              UNIX System Programmer
<URL:http://www.abandoned.org/drylock/>     <*>         (not speaking for) DDE
 =============================================================================


     +------------------------------------------------------------+
     | 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