• 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.

[Other] A dumb script messed up my rom... can I fix it?

heyo

HEYO!
113
Posts
11
Years
    • Seen Nov 24, 2023
    EDIT: So I went back to my last backup, and it took like 6 hours but I managed to import a bunch of scripts into the game from the broken version. Those work fine...

    However, since adding them, I ran into another new problem. Every time a wild battle or trainer battle starts up, the game freezes or resets. I know the scripts I added all work fine, and were imported to places in the rom where there was space. Is there any way of fixing this?

    Original Post:
    I haven't posted here in a LONG time........ hi

    I started a new ROM hack about a month ago. First hack I've done in almost a decade. wild.
    Anyways it's been going good, Ive been really really happy with how much more I can do now.

    BUT, I ran into an issue. I compiled a script onto an npc in the game -- a really simple one; if flag is checked then the NPC will give you a TM. The problem was I accidentally put in the wrong line. In other words...
    Instead of something like
    Code:
    msgbox @text2
    #org @text2
    I put in something like
    Code:
    msgbox @text2
    #org @text3
    The script had no text linked to it...thus, when I compiled it into the game, it screwed up.

    I didn't think anything of it, so I just fixed the code and compiled that one. But now when I start the game up from BIOS, it white screens. I can get past this by loading a .sav from my VBA...but I'd really prefer the game to work on startup y'know?

    I guess the question is, can I fix this? Is there any hex I can delete or rewrite that would undo this, or is it too far gone?

    Would I have to redo everything from a backup? (I got lazy with backups and that'd mean I'd lose about a week of work, so oof)

    I have no idea what line the code was on that broke it, or if it screwed a line up somewhere else. But if anyone has seen something like this before and knows what the repercussions are or how to fix, it would be greatly appreciated. Thanks.
     
    Last edited:

    Mahian23

    Behold my Supreme Power!
    523
    Posts
    4
    Years
  • Are you using XSE? It's not that hard,Just go to the offset you compiled it in XSE and correct it,If you are still getting problems than goto advancemap 1.92,Click the NPC where you compiled the script into.There should be an offset shown in the bottom left corner.Go to an Hex editor and jump to that offset and replace the bytes with FF.Your problem should get solved.If not,Than I hope you have a backup file which you can use or I'm sorry mate. :)
     
    Last edited:

    heyo

    HEYO!
    113
    Posts
    11
    Years
    • Seen Nov 24, 2023
    I tried both; it didn't seem to work. Maybe I'm just doomed to redo it.
    Thank you, though.
     

    Asith

    Uwao
    237
    Posts
    3
    Years
    • Seen May 8, 2024
    There's practically zero chance that a badly-written script would cause your game to break. Crash when the script is called sure, but permanent white screen? A successfully compiled script would never do that. Something else is going wrong here.
    put in something like
    Code:
    msgbox @text2
    #org @text3
    Also, XSE would NOT let you compile a script like that. If your script has "no text linked to it" XSE (and any half-decent script editor) would tell you that and not compile. Your problem is clearly not what you think it is.
     

    heyo

    HEYO!
    113
    Posts
    11
    Years
    • Seen Nov 24, 2023
    There's practically zero chance that a badly-written script would cause your game to break. Crash when the script is called sure, but permanent white screen? A successfully compiled script would never do that. Something else is going wrong here.

    Also, XSE would NOT let you compile a script like that. If your script has "no text linked to it" XSE (and any half-decent script editor) would tell you that and not compile. Your problem is clearly not what you think it is.

    I was using pksvui at the time of writing that script, so it did let me compile it... that being said, I think you're right.
    I ended up going back to an older backup and filling in a lot of things that I made afterwards, and I don't get the white screen anymore. BUT, now the game is resetting every time I enter a battle with a wild pokemon or trainer. I'm about to rip my hair out.
     
    124
    Posts
    8
    Years
    • Seen Apr 5, 2024
    I've noticed something similar in my hack, if ever im using amap and the emulator at the same time and reloading the rom to check what I have edited, some addresses will screw up and change. Especially when I added FBI's custom wild pokemon, I go to the emulator, try the script and the game would freeze, then I check the asm routine I added for custom wild pokemon and all the values have changed out of nowhere, inexplicable, so I just re-write them and everything works fine again! Weirdest thing that has happened so much to me that now I know how to fix it. It scared me many times I have like 300+ backups, ugh!
     

    heyo

    HEYO!
    113
    Posts
    11
    Years
    • Seen Nov 24, 2023
    I've noticed something similar in my hack, if ever im using amap and the emulator at the same time and reloading the rom to check what I have edited, some addresses will screw up and change. Especially when I added FBI's custom wild pokemon, I go to the emulator, try the script and the game would freeze, then I check the asm routine I added for custom wild pokemon and all the values have changed out of nowhere, inexplicable, so I just re-write them and everything works fine again! Weirdest thing that has happened so much to me that now I know how to fix it. It scared me many times I have like 300+ backups, ugh!

    I think something like this happened; I went into the hex of the version that was white-screening and for some reason the first 3 lines were goofed. I fixed those, and it doesn't white screen anymore. Afterwards, there's no audio at the game freak logo, and clicking past the title screen freezes the game. So I'm assuming there's more messed up lines in places but now I have no clue how to find them, ahahah.
     
    124
    Posts
    8
    Years
    • Seen Apr 5, 2024
    I usually make a backup for the game every time I make a single script that Im not 100% sure will work, and I will test it out, once the script is perfect and works without bugs, then I delete the game I was trying it on, and insert the perfect working script into the backup I made....Also if you are making a script with asm inserts and it bugs out in the game, theres a chance the game will corrupt, idk why, but it has happened so much to me.
     

    Asith

    Uwao
    237
    Posts
    3
    Years
    • Seen May 8, 2024
    So I'm assuming there's more messed up lines in places but now I have no clue how to find them, ahahah.

    1) Get HexManiacAdvance
    2) Open your ROM
    3) Open a Vanilla ROM
    4) Right click on your ROM's tab and click "Diff with right"
    5) All the different lines are listed
     
    Back
    Top