From 501d7834ba0bc674cb38e7e3bdcde6483352052f Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Mon, 20 Sep 2021 20:06:46 -0300 Subject: Add consolewarn() and consolebug() replacements for consolemes() and debugmes() For the syslog monitor --- src/emap/script_buildins.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'src/emap/script_buildins.c') 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 @@ -3066,6 +3066,46 @@ BUILDIN(debugmes) return true; } +/*========================================== + * + *------------------------------------------*/ +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] *------------------------------------------*/ -- cgit v1.2.3-70-g09d2