summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgumi <git@gumi.ca>2020-08-22 13:56:52 -0400
committerJesusaves <cpntb1@ymail.com>2020-08-29 04:08:20 +0000
commit193b8ca5ffc82487872a147504e830d9fc033a8e (patch)
treea0df97586565542e6278db75d5e17f8d2bdabe2a
parent5b7b91097c8e3e2bfd962a66ef3633a420f0a358 (diff)
downloadserverdata-193b8ca5ffc82487872a147504e830d9fc033a8e.tar.gz
serverdata-193b8ca5ffc82487872a147504e830d9fc033a8e.tar.bz2
serverdata-193b8ca5ffc82487872a147504e830d9fc033a8e.tar.xz
serverdata-193b8ca5ffc82487872a147504e830d9fc033a8e.zip
add a command to display images in NPC windows
-rw-r--r--npc/functions/main.txt21
1 files changed, 21 insertions, 0 deletions
diff --git a/npc/functions/main.txt b/npc/functions/main.txt
index d65f634f..f3b58d01 100644
--- a/npc/functions/main.txt
+++ b/npc/functions/main.txt
@@ -73,6 +73,27 @@ function script mesc {
return mes(col(getarg(0, ""), getarg(1, 9)));
}
+// *showimage("<file>");
+// Displays an image in the NPC window. If no file extension is provided, it is
+// assumed to be a PNG file. The image path is relative to client-data/graphics.
+// example:
+// showimage("guiicons/flags/fr");
+function script showimage {
+ .@file$ = getarg(0);
+
+ if (!endswith(getarg(0), ".jpg") && !endswith(getarg(0), ".png")) {
+ .@file$ += ".png";
+ }
+
+ if (charat(getarg(0), 0) == "/") {
+ .@file$ = delchar(.@file$, 0); // absolute path from root of client-data
+ } else if (!startswith(getarg(0), "help/") && !startswith(getarg(0), "graphics/") ) {
+ .@file$ = "graphics/" + .@file$; // assume relative to graphics/
+ }
+
+ return mesf("~~~%s~", .@file$);
+}
+
function script adddefaultskills {
if (getskilllv(NV_BASIC) < 6)
{