diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-07-31 13:26:38 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-07-31 13:26:38 -0300 |
commit | bdb40f4c49f32b0145d5127b2071fa3bc92c8e1b (patch) | |
tree | 9a4c3aafa61af07bf8e960a832a869271b2ecbbc /npc | |
parent | 70c2ecc2c4b58e4427f5e3f40b6f8d6528a50302 (diff) | |
download | serverdata-bdb40f4c49f32b0145d5127b2071fa3bc92c8e1b.tar.gz serverdata-bdb40f4c49f32b0145d5127b2071fa3bc92c8e1b.tar.bz2 serverdata-bdb40f4c49f32b0145d5127b2071fa3bc92c8e1b.tar.xz serverdata-bdb40f4c49f32b0145d5127b2071fa3bc92c8e1b.zip |
Bugfixes to menuint2
Diffstat (limited to 'npc')
-rw-r--r-- | npc/boss/manamarket.txt | 6 | ||||
-rw-r--r-- | npc/functions/input.txt | 22 | ||||
-rw-r--r-- | npc/magic/forget.txt | 7 |
3 files changed, 19 insertions, 16 deletions
diff --git a/npc/boss/manamarket.txt b/npc/boss/manamarket.txt index 6f9f3a940..c3c5bc219 100644 --- a/npc/boss/manamarket.txt +++ b/npc/boss/manamarket.txt @@ -73,7 +73,7 @@ function MMBuy { // MMBuyMenu ( page=0 ) function MMBuyMenu { deletearray @mm_menu$; - setarray @mm_menu$, l("Cancel"), -1; + setarray @mm_menu$, l("Cancel"), "-1"; .@pg=getarg(0, 0); .@limit=min(getarraysize($@MM_id), (.@pg+1)*20); @@ -87,11 +87,11 @@ function MMBuyMenu { // Still more pages if (.@limit < getarraysize($@MM_id)) { array_push(@mm_menu$, "Next Page >>"); - array_push(@mm_menu$, -2); + array_push(@mm_menu$, "-2"); } // Handle input - menuint2("@mm_menu$"); + menuint2(@mm_menu$); deletearray @mm_menu$; return @menuret; } 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]; diff --git a/npc/magic/forget.txt b/npc/magic/forget.txt index f000c82bd..81e3cdf9f 100644 --- a/npc/magic/forget.txt +++ b/npc/magic/forget.txt @@ -15,11 +15,11 @@ function script ForgetfulNPC { { next; mesc l("Which skill will you FORGET permanently today?"), 1; - setarray .@forget$, l("Cancel"), "0"; + setarray .@forget$, l("Cancel"), "-1"; freeloop(true); for (.@i=0; .@i < getarraysize($@MSK_MAGIC) ; .@i++) { .@sk=$@MSK_MAGIC[.@i]; - if (getskilllv(.@sk) > 1) { + if (getskilllv(.@sk)) { if ($@MSK_CLASS[.@sk] == .@school) { array_push(.@forget$, getskillname(.@sk)); array_push(.@forget$, str(.@sk)); @@ -28,7 +28,8 @@ function script ForgetfulNPC { } freeloop(false); menuint2(.@forget$); - if (!@menuret) + deletearray(.@forget$); + if (@menuret < 1) close; mes ""; mesc l("Skill @@ will be permanently lost!", getskillname(@menuret)), 1; |