summaryrefslogtreecommitdiff
path: root/npc/functions/input.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/functions/input.txt')
-rw-r--r--npc/functions/input.txt22
1 files changed, 12 insertions, 10 deletions
diff --git a/npc/functions/input.txt b/npc/functions/input.txt
index 1bce63792..0a510b740 100644
--- a/npc/functions/input.txt
+++ b/npc/functions/input.txt
@@ -68,38 +68,40 @@ function script menustr {
// menuint2(<array>)
function script menuint2 {
- .@ar$=getarg(0);
- .@vals=0;
.@menustr$="";
- if (!(getdatatype(.@ar$) & DATATYPE_VAR))
- Exception("Inadequate argument type", RB_DEFAULT|RB_ISFATAL);
+ if (!(getdatatype(getarg(0)) & DATATYPE_VAR))
+ Exception("Inadequate argument type - Must be var", RB_DEFAULT|RB_ISFATAL);
+
+ copyarray(.@ar$, getarg(0), getarraysize(getarg(0)));
if (getarraysize(.@ar$) % 2 != 0)
- Exception("Invalid array size", RB_DEFAULT|RB_ISFATAL);
+ Exception("Invalid array size: "+getarraysize(.@ar$), RB_DEFAULT|RB_ISFATAL);
freeloop(true);
for (.@f=0; .@f < getarraysize(.@ar$); .@f++) {
// String vs Int
if (.@f % 2 == 0) {
- .@menustr$+=getd(.@ar$+"["+.@f+"]")+":";
+ .@menustr$+=.@ar$[.@f]+":";
} else {
- array_push(.@vals, getd(.@ar$+"["+.@f+"]"));
+ array_push(.@vals, atoi(.@ar$[.@f]));
}
}
freeloop(false);
// Do the request
// We have: .@vals and .@menustr$
- .@vals[.@cnt] = -1;
@menu = 255;
@menuret = -1;
select(.@menustr$);
+ //debugmes "Option %d", @menu;
+ //debugmes "Array size %d", getarraysize(.@vals);
+
if (@menu == 255)
return -1;
- @menu --;
- if (@menu < 0 || @menu >= getarraysize(.@vals) - 1)
+ @menu-=1;
+ if (@menu < 0 || @menu > getarraysize(.@vals) - 1)
return -1;
@menuret = .@vals[@menu];