ISSUE:
In file act.informative.c:
look_at_room function calls the do_auto_exits function.
After I copy and paste this code from ACMD(do_exits) into do_auto_exits():
Code:
{
int door, len = 0;
if (AFF_FLAGGED(ch, AFF_BLIND) && GET_LEVEL(ch) < LVL_IMMORT)
{
send_to_char(ch, "You can't see a damned thing, you're blind!\r\n");
return;
}
send_to_char(ch, "%s", CCGRN(ch, C_NRM));
send_to_char(ch, "Exits:\r\n");
for (door = 0; door < DIR_COUNT; door++)
{
if (!EXIT(ch, door) || EXIT(ch, door)->to_room == NOWHERE)
continue;
if (EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) && !CONFIG_DISP_CLOSED_DOORS)
continue;
if (EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) && !PRF_FLAGGED(ch, PRF_HOLYLIGHT))
continue;
len++;
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS) && !EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED))
{
send_to_char(ch, "%-5s -[%5d]%s %s\r\n", dirs[door], GET_ROOM_VNUM(EXIT(ch, door)->to_room),
EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? "[HIDDEN]" : "", world[EXIT(ch, door)->to_room].name);
}
else if (CONFIG_DISP_CLOSED_DOORS && EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED))
{
/*But we tell them the door is closed */
send_to_char(ch, "%-5s - The %s is closed%s\r\n", dirs[door],
(EXIT(ch, door)->keyword) ? fname(EXIT(ch, door)->keyword) : "opening",
EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? " and hidden." : ".");
}
else
{
send_to_char(ch, "%-5s - %s\r\n", dirs[door], IS_DARK(EXIT(ch, door)->to_room) &&
!CAN_SEE_IN_DARK(ch) ? "Too dark to tell." : world[EXIT(ch, door)->to_room].name);
}
}
if (!len)
send_to_char(ch, " None.\r\n");
}
It causes the server to report:
Code:
:: SCRIPT ERROR: Room 55571 :: wdoor: invalid direction
:: SCRIPT ERROR: Room 55577 :: wdoor: invalid direction
:: SCRIPT ERROR: Room 55569 :: wdoor: invalid direction
:: SCRIPT ERROR: Room 55624 :: wdoor: invalid direction
:: SCRIPT ERROR: Room 55618 :: wdoor: invalid direction
:: SCRIPT ERROR: Mob (Hazel, the wellmaster, VNum 109):: mdoor: invalid direction
These rooms are:
55571 Yew Forest
55577 Yew Forest
55569 Yew Forest
55624 The Whirlpool
55618 The Whirlpool
Each of these rooms use a trigger script to "shift" their exits to create maze. For some reason, the copied code causes the server to "monitor" when these scripts "shift" exits and "report" those script errors. Using the redit command to detach those triggers for each room resolves the issue, but isn't exactly a solution to the root problem.
As for Hazel the wellmaster, a trigger script causes her to unlock a door, open a door, then close that door and lock it again. The opening and closing of that door causes the server to report that respective script error. Again, detaching her trigger resolves the issue, but isn't exactly a solution to the root problem.
Something in this "new" do_auto_exits() code doesn't play nice with trigger scripts opening, closing, or shifting doors. Each time we get a pulse and the trigger scripts have opened, closed, or "shifted" any door, it causes the server to report those script errors. However, there are no genuine errors. This is just a notification that trigger scripts have fired and altered door states.
So, I investigate and locate the code that produces the SCRIPT ERROR message:
FILE:
dg_scripts.c
IN FUNCTION:
Code:
void script_vlog(const char *format, va_list args)
{
char output[MAX_STRING_LENGTH];
struct descriptor_data *i;
/* parse the args, making the error message */
vsnprintf(output, sizeof(output) - 2, format, args);
/* Save to the syslog file */
basic_mud_log("SCRIPT ERROR: %s", output);
/* And send to imms */
for (i = descriptor_list; i; i = i->next) {
if (STATE(i) != CON_PLAYING || IS_NPC(i->character)) /* switch */
continue;
if (GET_LEVEL(i->character) < LVL_BUILDER)
continue;
if (PLR_FLAGGED(i->character, PLR_WRITING))
continue;
if (NRM > (PRF_FLAGGED(i->character, PRF_LOG1) ? 1 : 0) + (PRF_FLAGGED(i->character, PRF_LOG2) ? 2 : 0))
continue;
send_to_char(i->character, "%s[ %s ]%s\r\n", CCGRN(i->character, C_NRM), output, CCNRM(i->character, C_NRM));
}
}
FILE:
dg_wldcmd.c
IN COMMAND:
Code:
WCMD(do_wdoor)
{
char target[MAX_INPUT_LENGTH], direction[MAX_INPUT_LENGTH];
char field[MAX_INPUT_LENGTH], *value;
room_data *rm;
struct room_direction_data *newexit;
int dir, fd, to_room;
const char *door_field[] = {
"purge",
"description",
"flags",
"key",
"name",
"room",
"\n"
};
argument = two_arguments(argument, target, direction);
value = one_argument(argument, field);
skip_spaces(&value);
if (!*target || !*direction || !*field) {
wld_log(room, "wdoor called with too few args");
return;
}
if ((rm = get_room(target)) == NULL) {
wld_log(room, "wdoor: invalid target");
return;
}
if ((dir = search_block(direction, dirs, FALSE)) == -1) {
wld_log(room, "wdoor: invalid direction");
return;
}
if ((fd = search_block(field, door_field, FALSE)) == -1) {
wld_log(room, "wdoor: invalid field");
return;
}
newexit = rm->dir_option[dir];
/* purge exit */
if (fd == 0) {
if (newexit) {
if (newexit->general_description)
free(newexit->general_description);
if (newexit->keyword)
free(newexit->keyword);
free(newexit);
rm->dir_option[dir] = NULL;
}
}
else {
if (!newexit) {
CREATE(newexit, struct room_direction_data, 1);
rm->dir_option[dir] = newexit;
}
switch (fd) {
case 1: /* description */
if (newexit->general_description)
free(newexit->general_description);
CREATE(newexit->general_description, char, strlen(value) + 3);
strcpy(newexit->general_description, value);
strcat(newexit->general_description, "\r\n");
break;
case 2: /* flags */
newexit->exit_info = (sh_int)asciiflag_conv(value);
break;
case 3: /* key */
newexit->key = atoi(value);
break;
case 4: /* name */
if (newexit->keyword)
free(newexit->keyword);
CREATE(newexit->keyword, char, strlen(value) + 1);
strcpy(newexit->keyword, value);
break;
case 5: /* room */
if ((to_room = real_room(atoi(value))) != NOWHERE)
newexit->to_room = to_room;
else
wld_log(room, "wdoor: invalid door target");
break;
}
}
}
Now, I see "what" produces those script error messages. Unfortunately, I still don't understand "why". I must be missing something. Why is that copy and pasted code in do_auto_exits() causing the server to "monitor" and "report" trigger scripts altering door states?
If I don't understand why it happens, I can't prevent it from happening.
What am I missing?