The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Script Using setvar in a map script (type 02) with a msgbox results in broken dialogue loop

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 October 6th, 2021 (9:48 PM).
ThePieFace ThePieFace is offline
 
Join Date: Oct 2021
Posts: 3
I'm new to ROM hacking, and I'm trying to have some dialogue appear when the game starts, however I can never use setvar to stop the map script from repeating because using it results in the following behavior:



This is what my script looks like
Code:
'---------------
#org 0x800000
setvar 0x5100 0x1
lock
msgbox 0x8800011 MSG_KEEPOPEN '"Test"
release
end


'---------
' Strings
'---------
#org 0x800011
= Test
And this is the Advance Map setup



I've looked at similar scripts from other ROM hacks and in the base game and I have no idea what I'm doing wrong. I originally thought it may be because I have a CFRU patch on my ROM but I get this exact same behavior in a Vanilla ROM. If anyone knows how to fix this I would be very grateful!
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old October 7th, 2021 (3:11 AM).
Anon822 Anon822 is offline
 
Join Date: Nov 2017
Posts: 326
Quote:
Originally Posted by ThePieFace View Post
I'm new to ROM hacking, and I'm trying to have some dialogue appear when the game starts, however I can never use setvar to stop the map script from repeating because using it results in the following behavior:



This is what my script looks like
Code:
'---------------
#org 0x800000
setvar 0x5100 0x1
lock
msgbox 0x8800011 MSG_KEEPOPEN '"Test"
release
end


'---------
' Strings
'---------
#org 0x800011
= Test
And this is the Advance Map setup



I've looked at similar scripts from other ROM hacks and in the base game and I have no idea what I'm doing wrong. I originally thought it may be because I have a CFRU patch on my ROM but I get this exact same behavior in a Vanilla ROM. If anyone knows how to fix this I would be very grateful!
There doesn't appear to be anything wrong with the script itself. I inserted it in a vanilla firered rom with the same settings in advance map and it worked fine.
Reply With Quote
  #3   Link to this post, but load the entire thread.  
Old October 7th, 2021 (6:54 AM).
ThePieFace ThePieFace is offline
 
Join Date: Oct 2021
Posts: 3
Weird maybe it has something to do with the way I'm compiling? My exact replication steps are as follows:
- Load ROM into XSE v1.1.1 by clicking on the open icon (vanilla FireRed v 1.0)
- Typing in the following code:
Code:
#dynamic 0x800000

#org @start
setvar 0x5100 0x1
lock
msgbox @t1 MSG_KEEPOPEN
release
end

#org @t1
= Test
- Clicking on the Compile button in XSE and copying the offset address
- I then load the ROM in Advance Map v 1.95
- Navigate to PALLET TOWN (4.1) and in the Header tab click the Add button under Map Script
- I set the new Map script to type 02
- Set the Flag to 5100
- Set the Script offset 2 to the copied offset from XSE being sure to leave the first two 00 so that it would read $00800000
- After that I click on the Save map scripts button
- Then click on the Save icon in the top left of Advance Map
Reply With Quote
  #4   Link to this post, but load the entire thread.  
Old October 7th, 2021 (7:54 AM).
Anon822 Anon822 is offline
 
Join Date: Nov 2017
Posts: 326
Quote:
Originally Posted by ThePieFace View Post
Weird maybe it has something to do with the way I'm compiling? My exact replication steps are as follows:
- Load ROM into XSE v1.1.1 by clicking on the open icon (vanilla FireRed v 1.0)
- Typing in the following code:
Code:
#dynamic 0x800000

#org @start
setvar 0x5100 0x1
lock
msgbox @t1 MSG_KEEPOPEN
release
end

#org @t1
= Test
- Clicking on the Compile button in XSE and copying the offset address
- I then load the ROM in Advance Map v 1.95
- Navigate to PALLET TOWN (4.1) and in the Header tab click the Add button under Map Script
- I set the new Map script to type 02
- Set the Flag to 5100
- Set the Script offset 2 to the copied offset from XSE being sure to leave the first two 00 so that it would read $00800000
- After that I click on the Save map scripts button
- Then click on the Save icon in the top left of Advance Map
I was able to replicate the issue. Looks like it's caused by a bug in advance map 1.95.
You should use 1.92 as it's the more stable version.
Reply With Quote
  #5   Link to this post, but load the entire thread.  
Old October 7th, 2021 (8:25 AM).
ThePieFace ThePieFace is offline
 
Join Date: Oct 2021
Posts: 3
Thank you so much!! That was driving me crazy! It was indeed Advanced Map version but it was a little more than that.
I had to change my Bytes to look for to 00 instead of FF. I guess Advanced Map 1.95 automatically searches for repoint locations for the script offset in FF bytes while Advanced Map 1.92 gives you the option.

So for any future ROM hackers finding this post with the same issue make sure you're using Advanced Map 1.95 and that when you click Save Map Scripts you change the Bytes to look for to 00
Reply With Quote
  #6   Link to this post, but load the entire thread.  
Old October 7th, 2021 (2:14 PM). Edited October 7th, 2021 by kalarie.
kalarie kalarie is offline
 
Join Date: Jun 2008
Posts: 760
@ThePieFace

You should NEVER let AdvanceMap interpret 0x00 bytes as free space instead of 0xFF bytes in Fire Red. 0x00 bytes in Fire Red are generally not free space. By doing this, you're probably overwriting data that is already in use by something else.

Anyway, this is a known bug in AdvanceMap. For some reason AdvanceMap falsely imports a few bytes as 0xFF instead of 0x00 bytes (Which is probably why your workaround seems to be working). After importing a map script, you need to edit the map script offset manually with XSE to change those 0xFF bytes to 0x00 bytes. Check this tutorial for an example on how to do that: https://youtu.be/FttPQvAyWB4.
Reply With Quote
  #7   Link to this post, but load the entire thread.  
Old October 7th, 2021 (2:15 PM).
kalarie kalarie is offline
 
Join Date: Jun 2008
Posts: 760
@Anon822

This bug is not unique for AdvanceMap 1.95. AdvanceMap 1.92 has the same issue.
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:20 AM.