diff options
Diffstat (limited to 'npc')
-rw-r--r-- | npc/functions/main.txt | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/npc/functions/main.txt b/npc/functions/main.txt index b78c94337..f44fb44ef 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; |