• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

pbQuantity taken out?

PiaCRT

Orange Dev
938
Posts
13
Years
  • Hello. I used to work with Essentials version 7 but I decided to upgrade to version 10 today. I had a bag script that I worked extremely hard on and it was complete and fully functional. However, it seem in version 10 there is no pbQuantity and instead there are new methods in the engine. I'm not sure what to change to fix this @__@

    My script:
    Spoiler:
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    I haven't really touched the Bag scripts since version 6 when I did the GUI redesign. I may have moved things about a bit (e.g. put all the PC item storage scripts at the bottom of that section), but I've not changed how it works.

    I've just tried putting your scripts into the latest Essentials, and it works (although it seems to be designed for the smaller screen size). If you're getting any error message, please copy-paste them to give us an idea of what problems you're getting.
     

    PiaCRT

    Orange Dev
    938
    Posts
    13
    Years
  • I haven't really touched the Bag scripts since version 6 when I did the GUI redesign. I may have moved things about a bit (e.g. put all the PC item storage scripts at the bottom of that section), but I've not changed how it works.

    I've just tried putting your scripts into the latest Essentials, and it works (although it seems to be designed for the smaller screen size). If you're getting any error message, please copy-paste them to give us an idea of what problems you're getting.

    Try entering a battle, it will specifically say there is an undefined term (pbQuantity) in the script. Besides that it works fine ._.
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    You didn't say anything about battles.

    It still works, though. I went into a trainer battle and successfully used an X Attack and a Potion. Again, this was in the latest Essentials with your Bag script.

    Maybe you've been fiddling with some other scripts and accidentally deleted something? You still haven't copy-pasted the error message you get, which would be a very useful thing to see.
     

    PiaCRT

    Orange Dev
    938
    Posts
    13
    Years
  • Yeah, sorry about that, thought I posted it already e_e

    Code:
    ---------------------------
    Pokemon Essentials
    ---------------------------
    Exception: NoMethodError
    
    Message: undefined method `pbQuantity' for #<PokemonBag:0xa08ee38>
    
    PokemonField:815:in `pbGenerateWildPokemon'
    
    PokemonField:847:in `pbWildBattle'
    
    PokemonDebug:607:in `pbDebugMenu'
    
    PokemonDebug:287:in `loop'
    
    PokemonDebug:674:in `pbDebugMenu'
    
    PokemonPauseMenu:242:in `pbStartPokemonMenu'
    
    PokemonPauseMenu:241:in `pbFadeOutIn'
    
    PokemonPauseMenu:241:in `pbStartPokemonMenu'
    
    PokemonPauseMenu:142:in `loop'
    
    PokemonPauseMenu:256:in `pbStartPokemonMenu'
    
    
    
    This exception was logged in 
    
    C:\Users\Jacob\Saved Games/Pokemon Essentials/errorlog.txt.
    
    Press Ctrl+C to copy this message to the clipboard.
    ---------------------------
    OK   
    ---------------------------

    This might be only caused by the Debug menu battles, but I am not 100% sure of that.
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    I'm sorry, I honestly don't know what's wrong. I've been using the Bag scripts you pasted above, I've tried every kind of battle, and it works.

    The problem seems to be caused by the method pbQuantity not existing in class PokemonBag, but it clearly does. If for some reason it doesn't appear in the scripts you're using, then you will have deleted it yourself. You've replaced any relevant scripts (or at least, I have when I copied your scripts above), which means it is absolutely not a fault with Essentials.

    There are only two things I can suggest. First, make sure the method exists. Secondly, start a new game. Neither of these suggestions are likely to solve the problem, because the method probably does exist because it's in the code you pasted above, and the save file has no bearing on this method's existence.

    There's one other thing I could suggest, actually: start again from scratch. In future, keep notes of exactly what script changes you make.
     

    PiaCRT

    Orange Dev
    938
    Posts
    13
    Years
  • I'm sorry, I honestly don't know what's wrong. I've been using the Bag scripts you pasted above, I've tried every kind of battle, and it works.

    The problem seems to be caused by the method pbQuantity not existing in class PokemonBag, but it clearly does. If for some reason it doesn't appear in the scripts you're using, then you will have deleted it yourself. You've replaced any relevant scripts (or at least, I have when I copied your scripts above), which means it is absolutely not a fault with Essentials.

    There are only two things I can suggest. First, make sure the method exists. Secondly, start a new game. Neither of these suggestions are likely to solve the problem, because the method probably does exist because it's in the code you pasted above, and the save file has no bearing on this method's existence.

    There's one other thing I could suggest, actually: start again from scratch. In future, keep notes of exactly what script changes you make.

    Starting a new game seems to have fixed it. I think it definitely had something to do with the Debug acting up.

    EDIT: Correction! I have quarantined the problem and figured out it is in my Settings script!

    I believe this is the relevant bit:
    Code:
    POCKETNAMES = ["",
       "",
       "",
       "",
       ""
    ]
    MAXPOCKETSIZE = [0,-1,20,-1,-1]
    BAGMAXPERSLOT = 99
    BERRYPOCKET   = 1

    My bag script is image based, so I don't need any names in the arrays, or is it perhaps something else?

    However, it is most definitely this script causing the issue.

    Okay, so taking another look at the error messages, I went into the bag script and found this:

    Code:
      def pbQuantity(item)
        pocket=pbGetPocket(item)
        maxsize=maxPocketSize(pocket)
        maxsize=@pockets[pocket].length if maxsize<0
        return ItemStorageHelper.pbQuantity(
           @pockets[pocket],maxsize,item)
         end

    The maxsize part seems to be the source of this error.
    And this is the one in the current release:

    Code:
      def pbQuantity(item)
        pocket=pbGetPocket(item)
        maxsize=maxPocketSize(pocket)
        maxsize=@pockets[pocket].length if maxsize<0
        return ItemStorageHelper.pbQuantity(
           @pockets[pocket],maxsize,item)
         end

    There is no difference that I can see. I have not bothered any scripts besides the Bag and the Settings at this point.

    I tried tinkering more with the settings, but all seems to fail:
    Code:
    POCKETNAMES = ["",
       "Items",
       "Balls",
       "Key Items",
       "TMs & HMs"
    ]
    MAXPOCKETSIZE  = [0,20,-1,-1,-1]
    BAGMAXPERSLOT  = 99
    POCKETAUTOSORT = [0,false,false,false,true]
    BERRYPOCKET    = 1
     
    Last edited:
    Back
    Top