summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
Diffstat (limited to 'npc')
-rw-r--r--npc/dev/test.txt (renamed from npc/custom/test.txt)17
-rw-r--r--npc/pre-re/scripts_main.conf3
-rw-r--r--npc/re/scripts_main.conf3
-rw-r--r--npc/scripts_custom.conf4
-rw-r--r--npc/scripts_dev.conf8
5 files changed, 30 insertions, 5 deletions
diff --git a/npc/custom/test.txt b/npc/dev/test.txt
index 00f9c376e..6d1c6b49f 100644
--- a/npc/custom/test.txt
+++ b/npc/dev/test.txt
@@ -335,7 +335,7 @@ OnInit:
callsub(OnCheck, "Order of < and <<", .@x);
- // ==, != operators
+ // ==, !=, ~=, ~! operators
.@x = (0 == 0); // true
.@y = (1 == 0); // false
callsub(OnCheck, "== operator", .@x);
@@ -344,6 +344,21 @@ OnInit:
.@y = (1 != 1); // false
callsub(OnCheck, "!= operator", .@x);
callsub(OnCheck, "!= operator", .@y, 0);
+ .@x$ = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. "
+ "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. "
+ "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. "
+ "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
+ .@y = (.@x$ ~= "^Lorem.*, ([a-z]*).*(Duis).* ([a-z.]*)$");
+ callsub(OnCheck, "~= operator", .@y, 4);
+ callsub(OnCheck, "~= operator", $@regexmatchcount, 4);
+ if( $@regexmatchcount == 4 ) {
+ callsub(OnCheck, "~= operator", $@regexmatch$[0], .@x$);
+ callsub(OnCheck, "~= operator", $@regexmatch$[1], "quis");
+ callsub(OnCheck, "~= operator", $@regexmatch$[2], "Duis");
+ callsub(OnCheck, "~= operator", $@regexmatch$[3], "laborum.");
+ }
+ .@y = (.@x$ ~! "^Not Lorem.*, ([a-z]*).*(Duis).* ([a-z.]*)$");
+ callsub(OnCheck, "~! operator", .@y);
// Associativity of ==, !=
.@x = (1 == 0 == 0); // (1 == 0) == 0 --> 0 == 0 --> 1
diff --git a/npc/pre-re/scripts_main.conf b/npc/pre-re/scripts_main.conf
index 8c53b586b..a2c1fcc1c 100644
--- a/npc/pre-re/scripts_main.conf
+++ b/npc/pre-re/scripts_main.conf
@@ -39,6 +39,9 @@ import: npc/pre-re/scripts_jobs.conf
import: npc/pre-re/scripts_monsters.conf
import: npc/pre-re/scripts_warps.conf
+// ----------- Development / Testing Script Files ---------------
+import: npc/scripts_dev.conf
+
// ------------------- Custom Script Files ----------------------
// - Your NPCs go in this file!
import: npc/scripts_custom.conf
diff --git a/npc/re/scripts_main.conf b/npc/re/scripts_main.conf
index 082fb81f4..8ee3c45e5 100644
--- a/npc/re/scripts_main.conf
+++ b/npc/re/scripts_main.conf
@@ -40,6 +40,9 @@ import: npc/re/scripts_jobs.conf
import: npc/re/scripts_monsters.conf
import: npc/re/scripts_warps.conf
+// ----------- Development / Testing Script Files ---------------
+import: npc/scripts_dev.conf
+
// ------------------- Custom Script Files ----------------------
// - Your NPCs go in this file!
import: npc/scripts_custom.conf
diff --git a/npc/scripts_custom.conf b/npc/scripts_custom.conf
index b4283502c..aeae9e22f 100644
--- a/npc/scripts_custom.conf
+++ b/npc/scripts_custom.conf
@@ -104,7 +104,3 @@
//npc: npc/custom/battleground/bg_kvm01.txt
//npc: npc/custom/battleground/bg_kvm02.txt
//npc: npc/custom/battleground/bg_kvm03.txt
-
-// ----------------------- Misc Scripts -----------------------------
-// Self-test script (for development use only)
-//npc: npc/custom/test.txt
diff --git a/npc/scripts_dev.conf b/npc/scripts_dev.conf
new file mode 100644
index 000000000..ee9bcfc26
--- /dev/null
+++ b/npc/scripts_dev.conf
@@ -0,0 +1,8 @@
+// --------------------------------------------------------------
+// - Development and Testing Scripts -
+// --------------------------------------------------------------
+// The scripts listed here are for development or testing purpose.
+// There's little to no reason to enable them in a production server.
+
+// Script engine self-test.
+//npc: npc/dev/test.txt