If you're using Oasis, then you've run across: prompt> olc The following OLC components need saving:- - Rooms for zone 0. I deciced that if this can be done with a command, then a safeguard could be added to the shutdown command to make sure that the MUD isn't shutdown when there is information that has no been saved to disk. I've killed several rooms or mob descrips with one shutdown command before, and, quite frankly, it's frustrating and avoidable. George, how about sticking this in as part of the Oasis patch if you wouldn't mind? What the code does is requires an additional argument of "yes" if there is unsaved data. In other words, "shutdown die" kills the MUD and the autoscript. If there is unsaved data from the OLC, then to kill the script an immort. must type "shutdown die yes". If you find any problems with the code, or a faster/easier way of doing it, please let me know. What you've all been waiting for..... The code: /* BEGIN CODE */ ACMD(do_shutdown) { extern int circle_shutdown, circle_reboot; extern struct olc_save_info *olc_save_list; char arg1[MAX_INPUT_LENGTH]; char arg2[MAX_INPUT_LENGTH]; bool allow_shutdown = FALSE; if (subcmd != SCMD_SHUTDOWN) { send_to_char("If you want to shut something down, say so!\r\n", ch); return; } two_arguments(argument, arg1, arg2); if (olc_save_list) { if (!str_cmp(arg1, "yes")) allow_shutdown = TRUE; else if (!*arg2) allow_shutdown = FALSE; else if (!str_cmp(arg2, "yes")) allow_shutdown = TRUE; else allow_shutdown = FALSE; if (allow_shutdown) { send_to_char("Shutting down and losing unsaved " "OLC components.\r\n", ch); } else { send_to_char("There are unsaved OLC components.\r\n" "Use 'shutdown [option] yes' to shutdown the MUD " "without saving this information.\r\n" "Type 'olc' to see what needs to be saved.\r\n", ch); return; } } if (!*arg1 || !str_cmp(arg1, "yes")) { log("(GC) Shutdown by %s.", GET_NAME(ch)); send_to_all("Shutting down.\r\n"); circle_shutdown = 1; } else if (!str_cmp(arg1, "reboot")) { log("(GC) Reboot by %s.", GET_NAME(ch)); send_to_all("Rebooting.. Come back in about a minute.\r\n"); touch("../.fastboot"); circle_shutdown = circle_reboot = 1; } else if (!str_cmp(arg1, "die")) { log("(GC) Shutdown by %s.", GET_NAME(ch)); send_to_all("Shutting down for maintenance.\r\n"); touch("../.killscript"); circle_shutdown = 1; } else if (!str_cmp(arg1, "pause")) { log("(GC) Shutdown by %s.", GET_NAME(ch)); send_to_all("Shutting down for maintenance.\r\n"); touch("../pause"); circle_shutdown = 1; } else send_to_char("Unknown shutdown option.\r\n", ch); } /* END CODE */ John Evans <evansj@hi-line.net> May the source be with you. +------------------------------------------------------------+ | 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/08/00 PST