• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • 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.

[Scripting Question] Make party screen remember last selected slot

  • 112
    Posts
    10
    Years
    • Seen Nov 17, 2023
    I'm changing Essential's default party screen and I'm looking for a way to have the screen remember the last Pokemon that was selected before it changed to the current selection. I was able to do this for the storage party screen (in PScreen_Storage) shown below:

    Spoiler:


    And here's the code that allows this screen to remember the last selected pokemon on the right list when scrolling left/right between it and the lead pokemon (changes highlighted):

    Spoiler:

    I figured I could easily do the same thing in PScreen_Party for the general party screen with a similar layout shown here:

    Spoiler:


    The code section for this in PScreen_Party is similar enough to the section in PScreen_Storage that I thought I could easily create the same behavior, but it turns out it's much different than I hoped it would be. Here's what I have so far (changes highlighted):

    Spoiler:

    All it does is default to the second slot (which has the value of "1" since slot 1 has a value of "0").

    TL;DR: How can I set lastsel equal to currentsel in pbChangeSelection without it defaulting back to 1?

    Also, this is version 16 FYI, but I checked between 16 and 17 and didn't see any big changes to the party screen code as far as I could tell.
     
    Honestly if I look at the code I'm not really sure if it is actually going to do what you want it to. I might be wrong since I haven't looked further into it. The reason I think is because you put the the part where it selects the last selection into an input and not at the part where the screen is started.

    Anyway what also would be good to know if and where you put the code that actually stores the info on the last selection and what kind of variable it is
     
    Back
    Top