Jump to content

exchange context vs pass script instance


Recommended Posts

Posted

I usually just pass the script reference to give my classes api method access, I learned how to do this from explv's tutorial.

I also know that it is possible to get api method access by having the class extend MethodProvider (or API) and override exchangeContext with a call to super. The in onStart() call your class's inherited exchangeContext(). Looking at osbot source I think what this does is in your class, instantiate the inherited variables of Logger, Skills, Magic, Bank, etc... from the passed instance of bot. 

Which way should be used and why? Thanks.

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...