From f91413a6b22b698881068fcf85a5402a42381e0d Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Tue, 12 May 2020 12:56:54 -0300 Subject: ManaMarket sketch --- npc/functions/input.txt | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'npc/functions/input.txt') 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() +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; +} + -- cgit v1.2.3-70-g09d2