diff options
author | Jesusaves <cpntb1@ymail.com> | 2021-09-20 20:06:46 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-09-20 20:06:46 -0300 |
commit | 501d7834ba0bc674cb38e7e3bdcde6483352052f (patch) | |
tree | e8435fcd07af1eaba70c3875d69e1a1abcc7da95 | |
parent | 6ee06fdebc63a87a427b751727c777863b76e0a1 (diff) | |
download | evol-hercules-501d7834ba0bc674cb38e7e3bdcde6483352052f.tar.gz evol-hercules-501d7834ba0bc674cb38e7e3bdcde6483352052f.tar.bz2 evol-hercules-501d7834ba0bc674cb38e7e3bdcde6483352052f.tar.xz evol-hercules-501d7834ba0bc674cb38e7e3bdcde6483352052f.zip |
Add consolewarn() and consolebug() replacements for consolemes() and debugmes()
For the syslog monitor
-rw-r--r-- | src/emap/init.c | 2 | ||||
-rw-r--r-- | src/emap/script_buildins.c | 40 | ||||
-rw-r--r-- | src/emap/script_buildins.h | 2 |
3 files changed, 44 insertions, 0 deletions
diff --git a/src/emap/init.c b/src/emap/init.c index 1e750c8..efad185 100644 --- a/src/emap/init.c +++ b/src/emap/init.c @@ -246,6 +246,8 @@ HPExport void plugin_init (void) // Overrides addScriptCommand("debugmes","v*",debugmes); + addScriptCommand("consolewarn","v*",consolewarn); + addScriptCommand("consolebug","v*",consolebug); addScriptCommand("countitem","v?",countitem); addScriptCommand("atcommand","s",atcommand); addScriptCommand("getinventorylist","",getinventorylist); diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c index d61811c..7fe408a 100644 --- a/src/emap/script_buildins.c +++ b/src/emap/script_buildins.c @@ -3067,6 +3067,46 @@ BUILDIN(debugmes) } /*========================================== + * + *------------------------------------------*/ +BUILDIN(consolewarn) +{ + struct StringBuf buf; + StrBuf->Init(&buf); + + if (!script->sprintf_helper(st, 2, &buf)) { + StrBuf->Destroy(&buf); + script_pushint(st, 0); + return false; + } + + ShowWarning("script warning : %d %d : %s\n", st->rid, st->oid, StrBuf->Value(&buf)); + StrBuf->Destroy(&buf); + script_pushint(st, 1); + return true; +} + +/*========================================== + * + *------------------------------------------*/ +BUILDIN(consolebug) +{ + struct StringBuf buf; + StrBuf->Init(&buf); + + if (!script->sprintf_helper(st, 2, &buf)) { + StrBuf->Destroy(&buf); + script_pushint(st, 0); + return false; + } + + ShowError("script error : %d %d : %s\n", st->rid, st->oid, StrBuf->Value(&buf)); + StrBuf->Destroy(&buf); + script_pushint(st, 1); + return true; +} + +/*========================================== * gmcommand [MouseJstr] *------------------------------------------*/ BUILDIN(atcommand) diff --git a/src/emap/script_buildins.h b/src/emap/script_buildins.h index 98812bd..183f21e 100644 --- a/src/emap/script_buildins.h +++ b/src/emap/script_buildins.h @@ -131,6 +131,8 @@ BUILDIN(getskillname); // Overrides BUILDIN(countitem); BUILDIN(debugmes); +BUILDIN(consolewarn); +BUILDIN(consolebug); BUILDIN(atcommand); BUILDIN(getinventorylist); |