diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-03-05 14:00:56 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-03-05 14:00:56 +0300 |
commit | 0b4156877e7e47edb1233b3bca3aa33dca5346f8 (patch) | |
tree | e4b249b155b5a966a7ba350406cd85336f98fe5c | |
parent | 0e8bb3d3c73ac9fb86330f7526c4a1628c4dc6ca (diff) | |
download | serverdata-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
-rw-r--r-- | npc/000-2-1/alige.txt | 2 | ||||
-rw-r--r-- | npc/001-2-22/alige.txt | 2 | ||||
-rw-r--r-- | npc/functions/input.txt | 36 | ||||
-rw-r--r-- | npc/scripts.conf | 1 |
4 files changed, 39 insertions, 2 deletions
diff --git a/npc/000-2-1/alige.txt b/npc/000-2-1/alige.txt index 39d88b3c..34fc7912 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 24db2387..a003f252 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 00000000..c380940c --- /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 eeb92856..c5b3a457 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 |