From 023348b0a03c9af84bc09ee837d767fc6626f01d Mon Sep 17 00:00:00 2001 From: Nauzhror Date: Mon, 15 Jan 2018 15:37:42 -0500 Subject: [PATCH] Added %log% command, and made capitalization up to the builders discretion in various trigedit messages. (#35) * Added %log%, and made %send%, %echo%, etc. not force capitalization. * Fixed Previous Commit * Really fixed this time. --- src/dg_comm.c | 1 - src/dg_mobcmd.c | 22 ++++++++++++++++++++++ src/dg_objcmd.c | 10 ++++++++++ src/dg_olc.c | 4 ++-- src/dg_scripts.h | 1 + src/dg_variables.c | 3 +++ src/dg_wldcmd.c | 12 ++++++++++++ src/interpreter.c | 1 + 8 files changed, 51 insertions(+), 3 deletions(-) diff --git a/src/dg_comm.c b/src/dg_comm.c index fb86692..1c2eb39 100644 --- a/src/dg_comm.c +++ b/src/dg_comm.c @@ -113,7 +113,6 @@ static void sub_write_to_char(char_data *ch, char *tokens[], void *otokens[], ch strcat(sb,tokens[i]); strcat(sb,"\n\r"); - sb[0] = toupper(sb[0]); send_to_char(ch, "%s", sb); } diff --git a/src/dg_mobcmd.c b/src/dg_mobcmd.c index bb0ed94..4ca2e8e 100644 --- a/src/dg_mobcmd.c +++ b/src/dg_mobcmd.c @@ -282,6 +282,28 @@ ACMD(do_mecho) sub_write(p, ch, TRUE, TO_CHAR); } +ACMD(do_mlog) +{ + char *p; + + if (!MOB_OR_IMPL(ch)) { + send_to_char(ch, "%s", CONFIG_HUH); + return; + } + + if (AFF_FLAGGED(ch, AFF_CHARM)) + return; + + if (!*argument) + return; + + p = argument; + skip_spaces(&p); + + mob_log(ch, p); + +} + ACMD(do_mzoneecho) { int zone; diff --git a/src/dg_objcmd.c b/src/dg_objcmd.c index 5435689..880d837 100644 --- a/src/dg_objcmd.c +++ b/src/dg_objcmd.c @@ -45,6 +45,7 @@ static OCMD(do_odoor); static OCMD(do_osetval); static OCMD(do_oat); static OCMD(do_omove); +static OCMD(do_olog); struct obj_command_info { char *command; @@ -154,6 +155,14 @@ static OCMD(do_oecho) obj_log(obj, "oecho called by object in NOWHERE"); } +static OCMD(do_olog) +{ + skip_spaces(&argument); + + if (*argument) + obj_log(obj, argument); +} + static OCMD(do_oforce) { char_data *ch, *next_ch; @@ -805,6 +814,7 @@ static const struct obj_command_info obj_cmd_info[] = { { "otransform " , do_otransform, 0 }, { "ozoneecho " , do_ozoneecho , 0 }, /* fix by Rumble */ { "omove " , do_omove , 0 }, + { "olog " , do_olog , 0 }, { "\n", 0, 0 } /* this must be last */ }; diff --git a/src/dg_olc.c b/src/dg_olc.c index 84ba406..94de0b0 100644 --- a/src/dg_olc.c +++ b/src/dg_olc.c @@ -377,11 +377,11 @@ static const char *syntax_color_replacement[SYNTAX_TERMS][2] = }; // Here you can include more commands usually used in your triggers -#define COMMAND_TERMS 35 +#define COMMAND_TERMS 36 static const char *command_color_replacement[COMMAND_TERMS][2] = { // Mob specific commands (25) - { "marena", "\tcmarena\tn" }, // 0 + { "mlog", "\tcmlog\tn" }, // 0 { "masound", "\tcmasound\tn" }, { "mkill", "\tcmkill\tn" }, { "mjunk", "\tcmjunk\tn" }, diff --git a/src/dg_scripts.h b/src/dg_scripts.h index cbf73aa..6d950af 100644 --- a/src/dg_scripts.h +++ b/src/dg_scripts.h @@ -384,6 +384,7 @@ ACMD(do_msend); ACMD(do_mteleport); ACMD(do_mtransform); ACMD(do_mzoneecho); +ACMD(do_mlog); /* from dg_olc.c... thinking these should be moved to oasis.h */ void trigedit_save(struct descriptor_data *d); diff --git a/src/dg_variables.c b/src/dg_variables.c index 2d86889..30f6477 100644 --- a/src/dg_variables.c +++ b/src/dg_variables.c @@ -257,6 +257,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig, char *name; int num, count, i, j, doors; + char *log_cmd[] = {"mlog ", "olog ", "wlog " }; char *send_cmd[] = {"msend ", "osend ", "wsend " }; char *echo_cmd[] = {"mecho ", "oecho ", "wecho " }; char *echoaround_cmd[] = {"mechoaround ", "oechoaround ", "wechoaround "}; @@ -343,6 +344,8 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig, snprintf(str, slen, "%s", recho[type]); else if (!str_cmp(var, "move")) snprintf(str, slen, "%s", omove[type]); + else if (!str_cmp(var, "log")) + snprintf(str, slen, "%s", log_cmd[type]); else *str = '\0'; } diff --git a/src/dg_wldcmd.c b/src/dg_wldcmd.c index 795a6f5..424b434 100644 --- a/src/dg_wldcmd.c +++ b/src/dg_wldcmd.c @@ -52,6 +52,7 @@ WCMD(do_wload); WCMD(do_wdamage); WCMD(do_wat); WCMD(do_wmove); +WCMD(do_wlog); /* attaches room vnum to msg and sends it to script_log */ @@ -114,6 +115,16 @@ WCMD(do_wecho) act_to_room(argument, room); } +WCMD(do_wlog) +{ + skip_spaces(&argument); + + if (!*argument) + return; + + wld_log(room, argument); +} + WCMD(do_wsend) { char buf[MAX_INPUT_LENGTH], *msg; @@ -624,6 +635,7 @@ static const struct wld_command_info wld_cmd_info[] = { { "wdamage " , do_wdamage, 0 }, { "wat " , do_wat, 0 }, { "wmove " , do_wmove , 0 }, + { "wlog" , do_wlog , 0 }, { "\n", 0, 0 } /* this must be last */ }; diff --git a/src/interpreter.c b/src/interpreter.c index 3c82d4d..7e1c1cc 100644 --- a/src/interpreter.c +++ b/src/interpreter.c @@ -392,6 +392,7 @@ static const struct mob_script_command_t mob_script_commands[] = { { "mtransform", do_mtransform , 0 }, { "mzoneecho", do_mzoneecho, 0 }, { "mfollow" , do_mfollow , 0 }, + { "mlog" , do_mlog , 0 }, { "\n" , do_not_here , 0 } }; int script_command_interpreter(struct char_data *ch, char *arg) {