• 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!
  • Cyndy, May, Hero (Conquest), or Wes - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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.

[Script✓] Using the pointer loaded to the script bank as a goto or call?

  • 222
    Posts
    7
    Years
    • Seen Nov 18, 2023
    Now I'm sure a lot of us know you can use loadpointer in conjunction with preparemsg to dynamically change the value of a displayed textbox like so:

    Spoiler:


    But I'm curious to know if there was a (preferrably non-ASM) way to do a similar thing and call the pointer at script bank 0? Like a script could, in effect, dynamically change the functionality of another script down the road.

    I looked through the command listings and surprisingly the support for banks is very limited within the game engine. Most commands that accept banks as parameters simply perform operations of those banks.

    But maybe I missed something. There's no possible way the engine could support strings and not other pointers within the banks. Anyone ever tried this before? It might just be that I'll have to either work around this or buckle down and learn how to code ASM.
     
    Last edited:
    Now I'm sure a lot of us know you can use loadpointer in conjunction with preparemsg to dynamically change the value of a displayed textbox like so:

    Spoiler:


    But I'm curious to know if there was a (preferrably non-ASM) way to do a similar thing and call the pointer at script bank 0? Like a script could, in effect, dynamically change the functionality of another script down the road.

    I looked through the command listings and surprisingly the support for banks is very limited within the game engine. Most commands that accept banks as parameters simply perform operations of those banks.

    But maybe I missed something. There's no possible way the engine could support strings and not other pointers within the banks. Anyone ever tried this before? It might just be that I'll have to either work around this or buckle down and learn how to code ASM.

    Script banks are pretty terrible places to try and work with pointers as they are constantly being set and reset by interacting with the world. Entering a house, interacting with an NPC and loading a text box (as well as probably a dozen other things) clear the bank pointers and leave you with nothing. That being said, there's no real way to call the bank pointers in a script without using ASM. If you don't want to use ASM you might be able to use eval in some capacity depending on the situation, but it would be far easier to just use variables and flags to remember what's happened and change the functionality of your scripts off them.

    The four script banks are loaded into the RAM starting at 0x03000F14 if you want to experiment with what actions clear the pointers there.
     
    Last edited:
    Back
    Top