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

From: Patrick Dughi (dughi@IMAXX.NET)
Date: 07/01/98


> 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.
>
        Wrote up a system like this.  Since I had ascii pfiles, the whole
problem with saving wasn't an issue, and I believe I did it pretty
inefficiently by making an array of size = NUM_COMMANDS (maybe I had to
define this?). I had a grant.h file which had one #define for every
function (not command - for example, do_action, or do_track, instead of
smile, laugh, and track).  This allowed me to add a single define, and I
could add/remove commands without worrying if it would affect previously
existing commands, or commands to be added in the future.  I threw in the
batches of commands  - as a matter of fact, everyone was assigned to the
batch named 'everybody' when they logged on (mobs too, although they had a
mob batch as well).

        Worked okay, although with every command being possible of being
restricted, I could easily disable myself, but since they were ascii
pfiles, there wasn't a problem with that - I just added it back in and
re-entered.

                                                        PjD


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