diff options
author | Saulc <lucashelaine14@gmail.com> | 2018-01-13 20:50:42 +0100 |
---|---|---|
committer | Saulc <lucashelaine14@gmail.com> | 2018-01-13 20:50:42 +0100 |
commit | 20df2abc1aca00d6aa5dc78347133890f36b32f3 (patch) | |
tree | 4ad4a8bb8b0605473a702e314799a4626347721a /npc/functions/input.txt | |
download | serverdata-20df2abc1aca00d6aa5dc78347133890f36b32f3.tar.gz serverdata-20df2abc1aca00d6aa5dc78347133890f36b32f3.tar.bz2 serverdata-20df2abc1aca00d6aa5dc78347133890f36b32f3.tar.xz serverdata-20df2abc1aca00d6aa5dc78347133890f36b32f3.zip |
Initial commit
Diffstat (limited to 'npc/functions/input.txt')
-rw-r--r-- | npc/functions/input.txt | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/npc/functions/input.txt b/npc/functions/input.txt new file mode 100644 index 000000000..cf0382d25 --- /dev/null +++ b/npc/functions/input.txt @@ -0,0 +1,66 @@ +// Evol functions. +// Author: +// 4144 +// Description: +// Input utility functions +// Variables: +// none + +function script menuint { + 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 ++; + } + } + + .@vals[.@cnt] = -1; + @menu = 255; + @menuret = -1; + select(.@menustr$); + if (@menu == 255) + return -1; + + @menu --; + if (@menu < 0 || @menu >= getarraysize(.@vals) - 1) + return -1; + + @menuret = .@vals[@menu]; + return @menuret; +} + +function script menustr { + 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 ""; + + @menu --; + if (@menu < 0 || @menu >= getarraysize(.@vals$)) + return ""; + + @menuret$ = .@vals$[@menu]; + return @menuret$; +} |