def pbItemMenu(index)
[COLOR="red"]if $game_switches[86]==true[/COLOR]
ret=0
emptyspot=-1
pkmnid=-1
endscene=true
oldsprites=pbFadeOutAndHide(@sprites)
itemscene=PokemonBag_Scene.new
itemscene.pbStartScene($PokemonBag)
loop do
item=itemscene.pbChooseItem
break if item==0
usetype=$ItemData[item][ITEMBATTLEUSE]
cmdUse=-1
commands=[]
if usetype==0
commands[commands.length]=_INTL("Cancel")
else
commands[cmdUse=commands.length]=_INTL("Use")
commands[commands.length]=_INTL("Cancel")
end
itemname=PBItems.getName(item)
command=itemscene.pbShowCommands(_INTL("{1} is selected.",itemname),commands)
if cmdUse>=0 && command==cmdUse
if usetype==1 || usetype==3
pkmnlist=PokemonScreen_Scene.new
pkmnscreen=PokemonScreen.new(pkmnlist,@battle.party1)
itemscene.pbEndScene
pkmnscreen.pbStartScene(_INTL("Use on which Pokémon?"),@battle.doublebattle)
pkmnid=pkmnscreen.pbChoosePokemon
emptyspot=0 if @battle.doublebattle && @battle.battlers[0].hp<=0
emptyspot=2 if @battle.doublebattle && @battle.battlers[2].hp<=0
if pkmnid>=0 && @battle.pbUseItemOnPokemon(item,pkmnid,pkmnscreen)
pkmnscreen.pbRefresh
pkmnlist.pbEndScene
ret=item
endscene=false
break
end
pkmnlist.pbEndScene
itemscene.pbStartScene($PokemonBag)
elsif usetype==2 || usetype==4
if @battle.pbUseItemOnBattler(item,index,itemscene)
ret=item
break
[COLOR="Red"] end[/COLOR]
end
end
end
end