Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • [Solved] Executing AbstractScript through another script?


    Mad

    Recommended Posts

    Edit: Solved by @ ... I wasn't setting the context correctly because "this" was referring to a null context since it wasn't created yet. So you have to do,

    this.registerMethodContext(Instance.getInstance().getMethodContext().getClient()) 

    Im trying to execute a script through another script by calling the onLoop, but no matter what I do, it throws NPE's on pretty much every API call. These include widgets, opening tabs, interactions, etc.
     
    I assume it has something to do with the context not being correct or something, so i tried setting the global context of the client in the onStart of the script being executed from the main script using:
     

     Client.getClient().setContext(this);
     Instance.getInstance().setMethodContext(this);
    

    But that didnt do anything.
     
    I have my controller here, where I add my script:
    UellvKe.png

    Which is just a regular script...
    5l6Pcwn.png
     
    Then my loop where it finds the current valid script from my set of scripts that I added in the on start and executes it.
     
    H24PYZZ.png
     
    I'm not really sure why it wouldn't work, any suggestions?

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.