Jump to content

exchange context vs pass script instance


yfoo

Recommended Posts

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.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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