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 /npc/functions/input.txt | |
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
Diffstat (limited to 'npc/functions/input.txt')
-rw-r--r-- | npc/functions/input.txt | 36 |
1 files changed, 36 insertions, 0 deletions
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; +} |