• 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.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • 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.

aliasing the compilation methods

  • 1,224
    Posts
    11
    Years
    I'd like to make an alias for the main compilation method, in case I ever decide to make this script standalone. However, it seems that this alias does not take place before the initial compiling does, rendering it useless.

    Code:
    #Make books compile with everything else
    alias :pbCompileAllData_old :pbCompileAllData
    def pbCompileAllData(mustcompile)
      pbCompileAllData_old(true){|msg| Win32API.SetWindowText(msg) }
      #yield(_INTL("Compiling book data"))
      pbCompileBooks(mustcompile)
    end

    Any ideas?
     
    I gave you a solution in Skype, but since you asked here, I'll answer here as well so that others can find it if they want to.

    No, there's no reasonable way to alias the compiling script. The method that compiles everything is in the script section Compiler (I know, right?), and the call to that method which runs it is also in the script section Compiler. The entire script section is evaluated at once, meaning the call is made and done before you get to the next script section that has your standalone script. The only way you could alias the method is if you put the alias in the middle of script section Compiler, which is useless if you want to make a standalone script (which by definition lives in its own script section(s)).

    So what's the solution? Make another compiler for what you want. The call to the compiling method is at the bottom of the script section Compiler, as code that isn't in its own method. Basically, copy that and make the necessary tweaks to make the copy compile whatever it is you want it to compile. Obviously this is something you should only do if you're confident with coding, which is why I'm not going into any more detail about it. I'm just pointing you in the right direction.
     
    Back
    Top