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

Question on altering a compiled script

  • 17
    Posts
    7
    Years
    • Seen May 30, 2024
    Another noob question here! There won't be too many.

    I know you can't make a script bigger, or it will overwrite data later on in the rom and cause corruption. However, can you make a change that doesn't change the size? Specifically, I want to change

    trainerbattle 0x1 0x1 0x1 0x885429F 0x885429F

    to

    trainerbattle 0x4 0x1 0x1 0x885429F 0x885429F

    Seeing as I'm only changing one number, will this be safe or shall I create a new dynamic offset?

    Cheers
     

    DrFuji

    [I]Heiki Hecchara‌‌[/I]
  • 1,691
    Posts
    14
    Years
    Another noob question here! There won't be too many.

    I know you can't make a script bigger, or it will overwrite data later on in the rom and cause corruption. However, can you make a change that doesn't change the size? Specifically, I want to change

    trainerbattle 0x1 0x1 0x1 0x885429F 0x885429F

    to

    trainerbattle 0x4 0x1 0x1 0x885429F 0x885429F

    Seeing as I'm only changing one number, will this be safe or shall I create a new dynamic offset?

    Cheers

    Your example should be completely safe as you aren't increasing the total number of bytes used. Once you insert the script it will start overwrite what was originally at your pointers but won't actually change anything except for that 0x1 into a 0x4 as everything else is still the same.
     

    DrFuji

    [I]Heiki Hecchara‌‌[/I]
  • 1,691
    Posts
    14
    Years
    By bytes do you mean characters? So would, for example, 0x4 to 0x2B be unsafe?

    Nope, I mean bytes. If you were to look at your trainerbattle example in a HEX editor it would look like this:

    5C 04 0100 0100 9F548508 9F428508

    I've made it a bit more readable so you can see what each value represents. 5C is the trainerbattle command number and the two groupings of eight values are pointers to the before and after text. Notice how what you wrote as 0x4 in XSE is written as 04 in the editor and the 0x1s have become 0100s? That's because the parameters used in the trainerbattle command have different sizes assigned to them. If you open up XSE and go to 'Help > Command Help' and navigate to trainerbattle you can see both the total size of the command and the sizes of each parameter.

    Anyway, getting back to your question, changing 0x4 to something like 0x2B would not be unsafe from an overwriting perspective. 0x4 is just shorthand for 0x04 since we are using a byte. If we were using a word (two bytes combined that can be anything from 0x0 to 0xFFFF), 0x4 would be shorthand for 0x0004.

    Hopefully this helps, but I guess its a bit of a moot point though. XSE won't compile a script that has a command with an incorrect number of bytes. It will give you an overflow error to let you know that you've made the command too large.
     
  • 17
    Posts
    7
    Years
    • Seen May 30, 2024
    Oh I understand thanks man great explanation.

    So if I changed the script to
    trainerbattle 0x1
    trainerbattle 0x1

    (therefore adding in extra bytes) XSE would just be like nope?
     
    Back
    Top