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

[Script✓] Help with custom debug menu script

Dr. Seuss

Will finish GS Chronicles, I swear!
523
Posts
10
Years
  • A few days ago I saw in the Skeli's server a very interesting idea about a custom debug menu to test some features without having to create a dummy script to test (I really hate to do it) so I decided to use some routines to make it possible (The JPAN Input Number to save numbers to a var and FBI's scrolling multichoice.

    The issue I'm having is with the playsong, wildbattle and trainerbattle commands that seem to be incompatible with var as values. I need ideas about how to use these functions with vars. This is the script I created.

    Code:
    #dynamic 0xC00000
    //---------------
    #org @start
    lockall
    setvar 0x8008 0x0
    setvar 0x8009 0x0
    msgbox @string1 MSG_KEEPOPEN //"Pokémon GS Chronicles Beta 2.5\nDe..."
    setvar 0x8000 0x0
    setvar 0x8001 0x7
    setvar 0x8004 0x0
    special 0x158
    waitstate
    compare LASTRESULT 0x0
    if 0x1 goto @snippet1
    compare LASTRESULT 0x1
    if 0x1 goto @snippet2
    compare LASTRESULT 0x2
    if 0x1 goto @snippet3
    compare LASTRESULT 0x3
    if 0x1 goto @snippet4
    compare LASTRESULT 0x4
    if 0x1 goto @snippet5
    compare LASTRESULT 0x5
    if 0x1 goto @snippet6
    compare LASTRESULT 0x6
    if 0x1 goto @snippet7
    releaseall
    end
    
    //---------------
    #org @snippet1
    msgbox @string2 MSG_KEEPOPEN //"Select valid species (1-412)"
    special 0x154
    waitstate
    compare 0x8008 0xC9FF
    if 0x1 goto @snippet8
    givepokemon 0x8008 0x32 0x0 0x0 0x0 0x0
    msgbox @string3 MSG_NORMAL //"Pokémon species were added."
    goto @start
    
    //---------------
    #org @snippet2
    msgbox @string4 MSG_KEEPOPEN //"Select a valid item (1-410)"
    special 0x154
    waitstate
    compare 0x8008 0xC9FF
    if 0x1 goto @snippet8
    additem 0x8008 0x64
    msgbox @string5 MSG_NORMAL //"Item was added."
    goto @start
    
    //---------------
    #org @snippet3
    msgbox @string6 MSG_KEEPOPEN //"Not functional option."
    closeonkeypress
    goto @start
    
    //---------------
    #org @snippet4
    msgbox @string7 MSG_KEEPOPEN //"Select a song to play (256-372)"
    special 0x154
    waitstate
    compare 0x8008 0xC9FF
    if 0x1 goto @snippet8
    playsong2 0x8008
    closeonkeypress
    goto @start
    
    //---------------
    #org @snippet5
    msgbox @string8 MSG_KEEPOPEN //"Select valid Weather (1-15)"
    special 0x154
    waitstate
    compare 0x8008 0xC9FF
    if 0x1 goto @snippet8
    setweather 0x8008
    doweather
    closeonkeypress
    goto @start
    
    //---------------
    #org @snippet6
    msgbox @string2 MSG_KEEPOPEN //"Select valid species (1-412)"
    special 0x154
    waitstate
    closeonkeypress
    compare 0x8008 0xC9FF
    if 0x1 goto @snippet8
    wildbattle 0x8008 0x5 0x0
    goto @start
    
    //---------------
    #org @snippet7
    msgbox @string9 MSG_KEEPOPEN //"Select a valid trainer battle\n(1-..."
    special 0x154
    waitstate
    closeonkeypress
    compare 0x8008 0xC9FF
    if 0x1 goto @snippet8
    trainerbattle 0x3 0x8008 0x0 @string10
    goto @start
    
    //---------------
    #org @snippet8
    releaseall
    end
    
    
    //---------
    // Strings
    //---------
    #org @string1
    = Pokémon GS Chronicles Beta 2.5\nDebug Menu.
    
    #org @string2
    = Select valid species (1-412)
    
    #org @string3
    = Pokémon species were added.
    
    #org @string4
    = Select a valid item (1-410)
    
    #org @string5
    = Item was added.
    
    #org @string6
    = Not functional option.
    
    #org @string7
    = Select a song to play (256-372)
    
    #org @string8
    = Select valid Weather (1-15)
    
    #org @string9
    = Select a valid trainer battle\n(1-742)
    
    #org @string10
    = ............ ............

    And here's a vide with the script running


    Any idea/suggestion to make it work as intended or at least improve it?
     
    Last edited:

    DrFuji

    [I]Heiki Hecchara‌‌[/I]
    1,691
    Posts
    14
    Years
  • For the commands that you're having issues with, aside from switching to the decomps and changing things in there, the best way to get them to work would require using eval (missingyep uses a more complicated version of what I use but they have the same result). It basically involves setting up a portion of a script in the RAM, calling it and then returning. It allows us to use variables in conjunction with commands that don't normally accept them as the values in those variables have already been loaded into the RAM.

    Here's what your snippets should look like:

    playsong:
    Code:
    #org @snippet4
    msgbox @string7 MSG_KEEPOPEN //"Select a song to play (256-372)"
    special 0x154
    waitstate
    compare 0x8008 0xC9FF
    if 0x1 goto @snippet8
    setvar 0x8007 0x3400 // a byte of padding plus the playsong2 command (0x34)
    setvar 0x8009 0x03 // return command
    call 0x020370C6 // calling variable 0x8007
    closeonkeypress
    goto @start

    wildbattle:
    Code:
    #org @snippet6
    msgbox @string2 MSG_KEEPOPEN //"Select valid species (1-412)"
    special 0x154
    waitstate
    closeonkeypress
    compare 0x8008 0xC9FF
    if 0x1 goto @snippet8
    setvar 0x8007 0xB600 // a byte of padding plus the setwildbattle command (0xB6)
    setvar 0x8009 0x0005 // level of pokemon (0x5) and first half of item word
    setvar 0x800A 0xB700 // second half of item word and dowildbattle command (0xB7)
    setvar 0x800B 0x03 // return command
    call 0x020370C6 // calling variable 0x8007
    goto @start

    trainerbattle:
    Code:
    #org @snippet7
    msgbox @string9 MSG_KEEPOPEN //"Select a valid trainer battle\n(1-..."
    special 0x154
    waitstate
    closeonkeypress
    compare 0x8008 0xC9FF
    if 0x1 goto @snippet8
    setvar 0x8006 0x035C // trainerbattle command (0x5C) and type (0x3)
    copyvar 0x8007 0x8008 // needed some extra space as 0x800C doesn't exist, so the chosen trainer number is put into 0x8007
    setvar 0x8008 0x0000 // two bytes of 0x0 that trainerbattle has for some reason
    setvar 0x8009 0x2345 // static variable for associated defeat message
    setvar 0x800A 0x0881 // static variable for associated defeat message
    setvar 0x800B 0x03 // return command
    call 0x020370C4 // calling variable 0x8006
    goto @start
    
    #org 0x812345 // change this static variable to somewhere with freespace and edit the setvar 0x8009/ 0x800A commands to match
    = [.]

    I've tested these eval scripts in a vanilla ROM and they work as intended so barring something that I missed in your debug script, they should work in your game as well.
     

    Dr. Seuss

    Will finish GS Chronicles, I swear!
    523
    Posts
    10
    Years
  • For the commands that you're having issues with, aside from switching to the decomps and changing things in there, the best way to get them to work would require using eval (missingyep uses a more complicated version of what I use but they have the same result). It basically involves setting up a portion of a script in the RAM, calling it and then returning. It allows us to use variables in conjunction with commands that don't normally accept them as the values in those variables have already been loaded into the RAM.

    Here's what your snippets should look like:

    playsong:
    Code:
    #org @snippet4
    msgbox @string7 MSG_KEEPOPEN //"Select a song to play (256-372)"
    special 0x154
    waitstate
    compare 0x8008 0xC9FF
    if 0x1 goto @snippet8
    setvar 0x8007 0x3400 // a byte of padding plus the playsong2 command (0x34)
    setvar 0x8009 0x03 // return command
    call 0x020370C6 // calling variable 0x8007
    closeonkeypress
    goto @start

    wildbattle:
    Code:
    #org @snippet6
    msgbox @string2 MSG_KEEPOPEN //"Select valid species (1-412)"
    special 0x154
    waitstate
    closeonkeypress
    compare 0x8008 0xC9FF
    if 0x1 goto @snippet8
    setvar 0x8007 0xB600 // a byte of padding plus the setwildbattle command (0xB6)
    setvar 0x8009 0x0005 // level of pokemon (0x5) and first half of item word
    setvar 0x800A 0xB700 // second half of item word and dowildbattle command (0xB7)
    setvar 0x800B 0x03 // return command
    call 0x020370C6 // calling variable 0x8007
    goto @start

    trainerbattle:
    Code:
    #org @snippet7
    msgbox @string9 MSG_KEEPOPEN //"Select a valid trainer battle\n(1-..."
    special 0x154
    waitstate
    closeonkeypress
    compare 0x8008 0xC9FF
    if 0x1 goto @snippet8
    setvar 0x8006 0x035C // trainerbattle command (0x5C) and type (0x3)
    copyvar 0x8007 0x8008 // needed some extra space as 0x800C doesn't exist, so the chosen trainer number is put into 0x8007
    setvar 0x8008 0x0000 // two bytes of 0x0 that trainerbattle has for some reason
    setvar 0x8009 0x2345 // static variable for associated defeat message
    setvar 0x800A 0x0881 // static variable for associated defeat message
    setvar 0x800B 0x03 // return command
    call 0x020370C4 // calling variable 0x8006
    goto @start
    
    #org 0x812345 // change this static variable to somewhere with freespace and edit the setvar 0x8009/ 0x800A commands to match
    = [.]

    I've tested these eval scripts in a vanilla ROM and they work as intended so barring something that I missed in your debug script, they should work in your game as well.

    Tested and working perfectly. I just had to modify the play ong snippet because not sure why I used playsong2 instead of playsong. Thanks a lot. You saved my life.
     
    Back
    Top