The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Script Using the pointer loaded to the script bank as a goto or call?

Notices
For all updates, view the main page.

Binary ROM Hacking Need a helping hand or just want to talk about binary ROM hacks? Get comments and answers to any ROM Hacking-related problems, questions or thoughts you have here.

Ad Content
Reply
 
Thread Tools
  #1   Link to this post, but load the entire thread.  
Old June 26th, 2018 (8:35 PM). Edited June 27th, 2018 by hjk321.
hjk321's Avatar
hjk321 hjk321 is offline
 
Join Date: Sep 2017
Posts: 219
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:

Code:
loadpointer 0x0 0x740009      ' Points to a string, and loads it to bank 0x0

------------

'separate, generic function that gets called a lot
preparemsg 0x0
waitmsg
return


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.
__________________
Binary is dead.
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old June 27th, 2018 (12:27 AM). Edited June 27th, 2018 by DrFuji.
DrFuji's Avatar
DrFuji DrFuji is offline
Heiki Hecchara‌‌
 
Join Date: Sep 2009
Location: Aussie
Age: 30
Gender: Male
Nature: Jolly
Posts: 1,693
Quote:
Originally Posted by hjk321 View Post
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:

Code:
loadpointer 0x0 0x740009      ' Points to a string, and loads it to bank 0x0

------------

'separate, generic function that gets called a lot
preparemsg 0x0
waitmsg
return


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.
__________________
Reply With Quote
Reply

Quick Reply

Join the conversation!

Create an account to post a reply in this thread, participate in other discussions, and more!

Create a PokéCommunity Account
Ad Content
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 9:14 AM.