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
  • Try asking for help in the chatbox
  • [Solved] Executing AbstractScript through another script?


    Mad
     Share

    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?

    Edited by Mad
    Link to comment
    Share on other sites

    Guest
    This topic is now closed to further replies.
     Share

    ×
    ×
    • 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.