summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-03-05 14:00:56 +0300
committerAndrei Karas <akaras@inbox.ru>2015-03-05 14:00:56 +0300
commit0b4156877e7e47edb1233b3bca3aa33dca5346f8 (patch)
treee4b249b155b5a966a7ba350406cd85336f98fe5c /npc
parent0e8bb3d3c73ac9fb86330f7526c4a1628c4dc6ca (diff)
downloadserverdata-0b4156877e7e47edb1233b3bca3aa33dca5346f8.tar.gz
serverdata-0b4156877e7e47edb1233b3bca3aa33dca5346f8.tar.bz2
serverdata-0b4156877e7e47edb1233b3bca3aa33dca5346f8.tar.xz
serverdata-0b4156877e7e47edb1233b3bca3aa33dca5346f8.zip
Add function menu2 for return some missing features.
Example: menu2 "test 1", 10, "test 2", 20; If select "test 1", will set @menuret to 10, and @menu to 1 If select "test 2", will set @menuret to 20, and @menu to 2
Diffstat (limited to 'npc')
-rw-r--r--npc/000-2-1/alige.txt2
-rw-r--r--npc/001-2-22/alige.txt2
-rw-r--r--npc/functions/input.txt36
-rw-r--r--npc/scripts.conf1
4 files changed, 39 insertions, 2 deletions
diff --git a/npc/000-2-1/alige.txt b/npc/000-2-1/alige.txt
index 39d88b3cb..34fc79122 100644
--- a/npc/000-2-1/alige.txt
+++ b/npc/000-2-1/alige.txt
@@ -167,7 +167,7 @@ L_Accepted:
L_GiveFood:
mes "";
- menu
+ menu2
rif(countitemcolor(501, 1), l(getitemname("Acorn"))), 0,
rif(countitemcolor(502, 1), l(getitemname("Bread"))), 502,
rif(countitemcolor(503, 1), l(getitemname("Fungus"))), 503,
diff --git a/npc/001-2-22/alige.txt b/npc/001-2-22/alige.txt
index 24db23877..a003f2524 100644
--- a/npc/001-2-22/alige.txt
+++ b/npc/001-2-22/alige.txt
@@ -171,7 +171,7 @@ L_Accepted:
L_GiveFood:
mes "";
- menu
+ menu2
rif(countitemcolor(501, 1), l(getitemname("Acorn"))), 0,
rif(countitemcolor(502, 1), l(getitemname("Bread"))), 502,
rif(countitemcolor(503, 1), l(getitemname("Fungus"))), 503,
diff --git a/npc/functions/input.txt b/npc/functions/input.txt
new file mode 100644
index 000000000..c380940c6
--- /dev/null
+++ b/npc/functions/input.txt
@@ -0,0 +1,36 @@
+// Evol functions.
+// Authors:
+// 4144
+// Description:
+// Input utility functions
+// Variables:
+// none
+
+function script menu2 {
+ deletearray .@vals;
+ .@menustr$ = "";
+ .@cnt = 0;
+
+ for (.@f = 0; .@f < getargcount(); .@f = .@f + 2)
+ {
+ if (getarg(.@f) != "")
+ {
+ .@menustr$ = .@menustr$ + getarg(.@f) + ":";
+ .@vals[.@cnt] = getarg(.@f + 1);
+ .@cnt ++;
+ }
+ }
+
+ @menu = 255;
+ @menuret = -1;
+ select(.@menustr$);
+ if (@menu == 255)
+ return -1;
+
+ @menu --;
+ if (@menu < 0 || @menu >= getarraysize(.@vals))
+ return -1;
+
+ @menuret = .@vals[@menu];
+ return @menuret;
+}
diff --git a/npc/scripts.conf b/npc/scripts.conf
index eeb928566..c5b3a4575 100644
--- a/npc/scripts.conf
+++ b/npc/scripts.conf
@@ -10,6 +10,7 @@ npc: npc/functions/clientversion.txt
npc: npc/functions/doors.txt
npc: npc/functions/hammocks.txt
npc: npc/functions/harbours.txt
+npc: npc/functions/input.txt
npc: npc/functions/inventoryplace.txt
npc: npc/functions/goodbye.txt
npc: npc/functions/sailordialogue.txt