diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-05-12 12:56:54 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-05-12 12:56:54 -0300 |
commit | f91413a6b22b698881068fcf85a5402a42381e0d (patch) | |
tree | c4a3f1a1ae5f2e98f7e218bd56433080ccf3eabc /npc/functions/input.txt | |
parent | 1119e48182fef2de3f01e70c82ebeff1bd9cbebc (diff) | |
download | serverdata-f91413a6b22b698881068fcf85a5402a42381e0d.tar.gz serverdata-f91413a6b22b698881068fcf85a5402a42381e0d.tar.bz2 serverdata-f91413a6b22b698881068fcf85a5402a42381e0d.tar.xz serverdata-f91413a6b22b698881068fcf85a5402a42381e0d.zip |
ManaMarket sketch
Diffstat (limited to 'npc/functions/input.txt')
-rw-r--r-- | npc/functions/input.txt | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/npc/functions/input.txt b/npc/functions/input.txt index cf0382d25..1ccfc0578 100644 --- a/npc/functions/input.txt +++ b/npc/functions/input.txt @@ -1,6 +1,7 @@ // Evol functions. // Author: // 4144 +// Jesusalva // Description: // Input utility functions // Variables: @@ -64,3 +65,41 @@ function script menustr { @menuret$ = .@vals$[@menu]; return @menuret$; } + +// menuint2(<array>) +function script menuint2 { + .@ar$=getarg(0); + .@vals=0; + .@menustr$=""; + + if (getarraysize(.@ar$) % 2 != 0) + Exception("Invalid array size", RB_DEFAULT|RB_ISFATAL); + + freeloop(true); + for (.@f=0; .@f < getarraysize(.@ar$); .@f++) { + // String vs Int + if (.@f % 2 == 0) { + .@menustr$+=getd(.@ar$+"["+.@f+"]")+":"; + } else { + array_push(.@vals, getd(.@ar$+"["+.@f+"]")); + } + } + freeloop(false); + + // Do the request + // We have: .@vals and .@menustr$ + .@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; +} + |