Fixed def pbChooseItemFromList not storing the correct result in a Game Variable

This commit is contained in:
Maruno17
2022-06-02 16:46:27 +01:00
parent 0da046d2c3
commit 17e386d33e

View File

@@ -886,7 +886,7 @@ def pbChooseFossil(var = 0)
end end
# Shows a list of items to choose from, with the chosen item's ID being stored # Shows a list of items to choose from, with the chosen item's ID being stored
# in the given Global Variable. Only items which the player has are listed. # in the given Game Variable. Only items which the player has are listed.
def pbChooseItemFromList(message, variable, *args) def pbChooseItemFromList(message, variable, *args)
commands = [] commands = []
itemid = [] itemid = []
@@ -898,16 +898,16 @@ def pbChooseItemFromList(message, variable, *args)
itemid.push(itm.id) itemid.push(itm.id)
end end
if commands.length == 0 if commands.length == 0
$game_variables[variable] = 0 $game_variables[variable] = :NONE
return nil return nil
end end
commands.push(_INTL("Cancel")) commands.push(_INTL("Cancel"))
itemid.push(nil) itemid.push(nil)
ret = pbMessage(message, commands, -1) ret = pbMessage(message, commands, -1)
if ret < 0 || ret >= commands.length - 1 if ret < 0 || ret >= commands.length - 1
$game_variables[variable] = nil $game_variables[variable] = :NONE
return nil return nil
end end
$game_variables[variable] = itemid[ret] $game_variables[variable] = itemid[ret] || :NONE
return itemid[ret] return itemid[ret]
end end