• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • 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] [Pokeemerald] Calling C/ASM routines from inside scripts.inc?

  • 222
    Posts
    7
    Years
    • Seen Nov 18, 2023
    Hello,

    I am trying to invoke a custom C function of mine through an event. However, I have not found a way to do this. Is this possible? Do I have to register my function in a special way, like make a custom command or something? Even if I don't *have* to, if I'm going to be calling this a lot would it be better that way? How would I go about that?

    Thanks.
     
    you can use callasm for custom assembly functions. Adding your function the special table would essentially be the same, unless you needed the special2 function with the extra argument.
     
    you can use callasm for custom assembly functions. Adding your function the special table would essentially be the same, unless you needed the special2 function with the extra argument.

    Thanks for your help, although I was actually talking about the pokéemerald decomp ??????

    I did find the answer though. There is a command called callnative that lets you put any function name as an argument and it will run that function. You may want to add a waitstate depending on the command or the script will end before the command does!

    Example script: (SaveGame is an internal function in start_menu.c)

    Code:
    devtest_savegame::
    lock
    callnative SaveGame
    waitstate
    release
     
    Last edited:
    Back
    Top