summaryrefslogtreecommitdiff
path: root/npc/functions/main.txt
diff options
context:
space:
mode:
authorJoseph Botosh <rumly111@gmail.com>2015-09-24 05:14:29 +0300
committerJoseph Botosh <rumly111@gmail.com>2015-09-24 05:14:29 +0300
commit08195da4e4ec4ecdaeb4aac3c8f38fa057f1e563 (patch)
tree8ccd7a0a17084fb156e97a5e42791315fee5b871 /npc/functions/main.txt
parentf4ece38f71ded5eeda94d6a11faf7c9fc03aa56a (diff)
downloadserverdata-08195da4e4ec4ecdaeb4aac3c8f38fa057f1e563.tar.gz
serverdata-08195da4e4ec4ecdaeb4aac3c8f38fa057f1e563.tar.bz2
serverdata-08195da4e4ec4ecdaeb4aac3c8f38fa057f1e563.tar.xz
serverdata-08195da4e4ec4ecdaeb4aac3c8f38fa057f1e563.zip
add optional first integer arg to narrator and speech functions -- number of blank lines at beginning
Diffstat (limited to 'npc/functions/main.txt')
-rw-r--r--npc/functions/main.txt34
1 files changed, 32 insertions, 2 deletions
diff --git a/npc/functions/main.txt b/npc/functions/main.txt
index b78c9433..f44fb44e 100644
--- a/npc/functions/main.txt
+++ b/npc/functions/main.txt
@@ -76,9 +76,24 @@ function script strip {
return substr(.@s$, .@start, .@end);
}
+
+// Function to show narrator text. Accepts string args.
+// If first arg is a number N, it prints N blank lines at beginning.
+// Default number of blank lines is 1.
function script narrator {
+ .@start = 0;
+ .@blank_lines = 1;
+ if (getargcount() > 1 && !isstr(getarg(0)))
+ {
+ .@start = 1;
+ .@blank_lines = getarg(0);
+ }
+
+ for (.@i = 0; .@i < .@blank_lines; .@i++)
+ mes "";
+
mes l("[Narrator]");
- for (.@i = 0; .@i < getargcount(); .@i++)
+ for (.@i = .@start; .@i < getargcount(); .@i++)
{
mes col(getarg(.@i), 9);
next;
@@ -86,9 +101,24 @@ function script narrator {
return;
}
+
+// Function to show NPC speech. Accepts string args.
+// If first arg is a number N, it prints N blank lines at beginning.
+// Default number of blank lines is 1.
function script speech {
+ .@start = 0;
+ .@blank_lines = 1;
+ if (getargcount() > 1 && !isstr(getarg(0)))
+ {
+ .@start = 1;
+ .@blank_lines = getarg(0);
+ }
+
+ for (.@i = 0; .@i < .@blank_lines; .@i++)
+ mes "";
+
mesn;
- for (.@i = 0; .@i < getargcount(); .@i++)
+ for (.@i = .@start; .@i < getargcount(); .@i++)
{
mesq getarg(.@i);
next;