Heya all..
As promised, here are some of my additions to the DG-Scripts, All
credits must go to the original coder, since It's only a very nasty
ripoff from WZONEEHCO (But I would like an Email if you do use it
though.. :)
Earlier today I sent a mail regarding the send_to_zone function, all
of these functions uses that send_to_zone (If you didn't get the mail
first time, just ask.. :)
A function that allows mobs to echo something through a zone.
-----------------------Start MZONEECHO -----------------------
Command: MZONEECHO
Usage: MZONEECHO <zoneVNUM> <message>
Code in dg_mobcmd.c:
Find : extern struct room_data *world;
add: extern int top_of_zone_table;
add: void send_to_zone(char *messg, int zone_vnum);
In the end of the file add everything between *SNIP*
*SNIP*
ACMD(do_mzoneecho)
{
int zone, i;
char zone_name[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH], *msg;
bool found = FALSE;
if (!MOB_OR_IMPL(ch)) {
send_to_char("Huh?!?\r\n", ch);
return;
}
if (AFF_FLAGGED(ch, AFF_CHARM))
return;
msg = any_one_arg(argument, zone_name);
skip_spaces(&msg);
if (!*zone_name || !*msg)
mob_log(ch, "mzoneecho called with too few args");
zone = atoi(zone_name);
for (i=0;i<=top_of_zone_table;i++)
if (zone_table[i].number == zone) {
found = TRUE;
break;
}
if (!found)
mob_log(ch, "mzoneecho called for nonexistant zone");
else {
sprintf(buf, "%s\r\n", msg);
send_to_zone(buf, zone);
}
}
*SNIP*
In Interpreter.c you need to add :
ACMD(do_mzoneecho); /* Put this with all the other ACMD's */
/* Put this one around MECHOAROUND */
{ "mzoneecho", POS_DEAD, do_mzoneecho, 0, 0},
That should do the trick for MZONEECHO.
------------------------END MZONEECHO -----------------------
Then I made OZONEECHO :
------------------------START OZONEECHO -----------------------
Command: OZONEECHO
Usage: OZONEECHO <zoneVNUM> <message>
Code in dg_wldcmd.c:
Find : void die(struct char_data * ch, struct char_data *killer);
add: extern struct *zone_table;
add: void send_to_zone(char *messg, int zone_vnum);
Somewhere between some OCMD (You decide) put everything between the
*snip* things..
*SNIP*
in: OCMD(do_ozoneecho)
{
int zone, i;
char zone_name[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH], *msg;
cbool found = FALSE; msg = any_one_arg(argument, zone_name);
skip_spaces(&msg);
if (!*zone_name || !*msg)
obj_log(obj, "ozoneecho called with too few args");
zone = atoi(zone_name);
for (i=0;i<=top_of_zone_table;i++)
if (zone_table[i].number == zone) {
found = TRUE;
break;
}
if (!found)
obj_log(obj, "ozoneecho called for nonexistant zone");
else {
sprintf(buf, "%s\r\n", msg);
send_to_zone(buf, zone);
}
}
*SNIP*
You also need to add the command into the definition of obj_cmd_info,
like this:
{ "ozoneecho", do_ozoneecho, 0, 0},
------------------------END OZONEECHO -----------------------
Oh yeah.. and while I was at it, I made it possible for IMMS to echo
throughout a zone with :
ACMD(do_zecho)
{
int zone, i;
char zone_name[MAX_INPUT_LENGTH], *msg;
cbool found = FALSE;
msg = any_one_arg(argument, zone_name);
skip_spaces(&msg);
zone = atoi(zone_name);
for (i = 0; i<=top_of_zone_table;i++)
if (zone_table[i].number == zone) {
found = TRUE;
break;
}
if (!found || !*msg)
send_to_char("Usage: zecho <zonenumber> <msg>\r\n", ch);
else if (!found)
send_to_char("Please enter a zone that exists, Hint: show
zones)!!!\r\n", ch); else { sprintf(buf, "%s\r\n", msg);
send_to_zone(buf, zone); sprintf(buf, "(GC) %s echoes %s to zone
%d", GET_NAME(ch), msg, zone); mudlog(buf, NRM, MAX(LVL_GOD,
GET_INVIS_LEV(ch)), TRUE); }
}
this one also needs to be defined in Interpreter.c :)
---------------------------------------------------------------------
currently I'm pondering why I put all this in 4 different functions,
everything could be called in one function. Just with different
SCMD's .. *ponder* maybe I'll do that at some point.
Not now.. have too much other things to do..
Usual Disclaimer (I claim Dis) for this.. :
"If you use this, and it breaks your code, I cannot be held
responsible, you put it in, your fault if anything breaks."
comments and bugreports are very welcome.. :) Flames are forwarded
directly towards /dev/null
S. P. Skou
Serces - Ancient at the Realm of Chaos - Chaos.mud.dk 4000
+------------------------------------------------------------+
| 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