Maybe your looking for a game toggle command to toggle code in the mud.
I have a "gametoggle" command and here is the code for it.
Firstly put your variables in config.c for example:
int olc_on = 1;
***NOTE***
When using these variables in code to check if something is "on"
don't forget "extern int XXX;" at the top of the file.
act.other.c
~~~~~~~~~~~~
At top of file:
extern int XXX;
...
ACMD(do_game_tog);
Anywhere in file:
ACMD(do_game_tog)
{
int l, i, j;
char field[MAX_INPUT_LENGTH];
struct show_struct {
const char *cmd;
const char level;
} fields[] = {
{ "nothing", 0 },
{ "show", LVL_IMMORT },
{ "xxx", LVL_IMPL },
...
{ "\n", 0}
};
skip_spaces(&argument);
if (!*argument) {
strcpy(buf, "Game Toggle options:\r\n");
for (j = 0, i = 1; fields[i].level; i++)
if (fields[i].level <= GET_LEVEL(ch))
sprintf(buf + strlen(buf), "%-15s%s", fields[i].cmd, (!(++j % 5) ? "\r\n" :
""));
strcat(buf, "\r\n");
send_to_char(buf, ch);
return;
}
strcpy(arg, one_argument(argument, field));
for (l = 0; *(fields[l].cmd) != '\n'; l++)
if (!strncmp(field, fields[l].cmd, strlen(field)))
break;
if (GET_LEVEL(ch) < fields[l].level) {
send_to_char("You are not powerful enough for that!\r\n", ch);
return;
}
switch (l) {
case 1: /* show */
send_to_char("-= Game Toggles =-\r\n\r\n", ch);
sprintf(buf, "XXX : %3s\r\n", ONOFF(XXX));
send_to_char(buf, ch);
break;
case 2: /* xxx */
XXX = !XXX;
sprintf(buf, "XXX has been %s.\r\n", (XXX ? "enabled" : "disabled"));
send_to_char(buf, ch);
break;
default:
send_to_char("Sorry, I don't understand that.\r\n", ch);
break;
}
}
Now just put your variables where you need them, for example here's
where my "olc_on" is used:
ACMD(do_oasis)
{
int number = -1, save = 0, real_num;
struct descriptor_data *d;
/*
* No screwing around as a mobile.
*/
if (IS_NPC(ch))
return;
+ if (!olc_on) {
+ send_to_char("OLC has been disabled.\r\n", ch);
+ return;
+ }
Hope it's what you were looking for.
Subliminal
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
--
+---------------------------------------------------------------+
| FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
| Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
+---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/03/01 PST