The annual holiday zone is back in. Can you save Santa from his evil twin brother? Go ahead and try it out while you can, twenty days past christmas we remove the zone again... Start looking near Warm Haven.
Northern Lights MUD
« | December 2003 | » | ||||
S | M | T | W | T | F | S |
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Makefile add events.o to MUDDOBJS events.h #ifndef _EVENTS_H_ #define _EVENTS_H_ typedef struct _event_sys { struct _event_sys *next; Boolean use; char name[50]; time_t timer; time_t reset_timer; void (*output_func)(); }_EVENT_SYS; void load_events(); void do_events(); void eventscom (); #endif events.c #include "kernel.h" #include "mud.h" #include "log.h" #include "bootstrap.h" #include "sendsys.h" #include "mobile.h" #include "timing.h" #include "locations.h" #include "objsys.h" #include "bprintf.h" #include "events.h" #include "parse.h" #include "utils.h" _EVENT_SYS *ehead, *etail; typedef _EVENT_SYS *eventsys; void event_healall(); void add_event(char *name, Boolean use, time_t t, void (*d)()) { _EVENT_SYS *ecur; if(ehead==NULL) { ehead = NEW(_EVENT_SYS, 1); etail = ehead; ecur = ehead; } else { etail->next = NEW(_EVENT_SYS, 1); etail = etail->next; } strcpy(etail->name, name); etail->use = use; etail->reset_timer = t; etail->output_func = d; etail->next = NULL; } void do_events () { _EVENT_SYS *event; for (event = ehead; event != NULL; event = event->next) { if (event->use == True) { ++event->timer; if (event->timer >= event->reset_timer) { (void) event->output_func(); event->timer = 0; } } } } //Load the events into the system. void load_events () { // Name Use? Reset Function add_event("healall", True, 300, event_healall); } //A command to show events in the mud. void eventscom () { _EVENT_SYS *event; char tleft[64]; int count; if (plev (mynum) < LVL_ARCHWIZARD) { erreval (); return; } bprintf ("&+RTimed &+Cevents &+cin the &+Gland &+cof &+m%s&+c.\n", COL_NAME); bprintf ("&+r-------------------------------------------------------------------------------\n"); bprintf ("&+W%-12s %-6s %-9s\n", "Name", "Active", "Time Left"); bprintf ("&+r-------------------------------------------------------------------------------\n"); for (event = ehead, count = 0; event != NULL; event = event->next, ++count) { strcpy (tleft, sec_to_hhmmss (event->reset_timer - event->timer)); bprintf ("&+g%-12s %-6s %-9s\n", capitalize(event->name), event->use == True ? "Yes" : "No", tleft); } bprintf ("&+r-------------------------------------------------------------------------------\n"); bprintf ("&+cTotal &+YEvents&+C: &+g%d\n", count); } /************************************************************ * Start of events, lets hope all these are nice * ************************************************************/ void event_healall () { int i; int j = 0; for (i = 0; i < max_players; ++i) { if (is_in_game (i) && pfighting (i) < 0 && plev (i) < LVL_WIZARD && ((pstr (i) < maxstrength (i) || pmagic (i) < maxmagic (i)) || (pstr (i) < maxstrength (i) && pmagic (i) < maxmagic (i)))) { setpstr (i, maxstrength (i)); setpmagic (i, maxmagic (i)); ++j; sendf (i, "&+m%s &+cunleashes a healing spell over the world.\n", MUD_NAME); } } if(!j==0) send_msg (DEST_ALL, MODE_QUIET, LVL_WIZARD, LVL_MAX, mynum, NOBODY, "&+r[&+gEvent: &+CAuto &+YHeal All&+r]\n"); } open up main.c and add this at the bottom of the includes: #include "events.h" then look for the on_timer(); and below it add: do_events(); save and exit. open up bootstrap.c and include events.h then in boot_world() add: load_events(); add the verb "events" to verbs.src then add #include "events.h" to parse.c and somewhere where you put your commands add: case VERB_EVENTS: eventscom(); break; save and exit. and you got my event code. do a make clean or rm -rf *.o first
I've just done what's possibly the scariest update in my time as Atrocity coder. The previously mentioned XML is here, and far reaching as it is (there probably isn't a command you can type that isn't affected in some small way) the potential for mishap is...unknown! On the plus side, this is my first bit of NEWS using XML tags. *bounce* Special thanks Smoke on this one, as he waded through all of our zones and info files (including policy and qinfo) adding tags.
As a part of this, we've replaced the main editor, though you may not notice much difference at first since the interface is pretty much the same. Two improvements that you may find useful though, are:
o You can now insert after "line 0" to add lines at the beginning of a buffer (at long last!)
o The default "view buffer" behaviour shows you the raw text. If you want to see how your buffer will look, use the new Render command from the editor menu.
For information on using XML in the game (for example, in your examine or mudmail) or in zone files, see INFO XML, INFO XMLTAGLIST and HELP XMLINPUT.
On a lighter note, we have a new format of SCORE for you, which includes a listing of what effects (from blindness to empoweredness) you currently have applied to you.
While the scope of adding XML to the mud will take some time to digest and understand, the effect of this is that coding zone files has evolved.