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
  • MethodProvider#log Listener? Is it possible?


    una_maquina

    Recommended Posts

    Hi, I wanna intercept all the log messages from MethodProvider.log("message"); is there any listener I can use or something?

    Basically whenever I call MethodProvider.log("something") in a function, I want to also catch that message and give it to my onPaint() method.

     

    In essence, I don't want to hardcode and just want to use the data from MethodProvider.log to print it out with onPaint()... if that makes any sense

    Link to comment
    Share on other sites

    There isn't. You can write your own log method that does what you want and also calls MethodProvider.log. Then you'd replace all MethodProvider.logs with your custom log method.

    Link to comment
    Share on other sites

    I'm asking the following question without looking at your code, so please keep that in mind. But if you're logging things in your code, can't you just replace those logs with something to modify your paint? If not replace, then simply add a line of code at logging point to modify your paint?

    Again, I'm not too sure what you're doing, so I may be incorrect, but it sounds like you're over-engineering this. It sounds like you're doing something, logging the action, then want to modify your paint with what is logged. But why not just do something and paint what action is being performed?

    Feel free to let me know where my assumptions may be wrong.

    Link to comment
    Share on other sites

    18 hours ago, Hashtag said:

    There isn't. You can write your own log method that does what you want and also calls MethodProvider.log. Then you'd replace all MethodProvider.logs with your custom log method.

    Oh yeaah, I should've done that from the beginning so I could have options down the line; thanks for the idea, I'll see if I can replace everything with one click or something

    16 hours ago, Bonfire said:

    I'm asking the following question without looking at your code, so please keep that in mind. But if you're logging things in your code, can't you just replace those logs with something to modify your paint? If not replace, then simply add a line of code at logging point to modify your paint?

    Again, I'm not too sure what you're doing, so I may be incorrect, but it sounds like you're over-engineering this. It sounds like you're doing something, logging the action, then want to modify your paint with what is logged. But why not just do something and paint what action is being performed?

    Feel free to let me know where my assumptions may be wrong.

    I basically have a lot of printing to console to see what's going on and so I could debug easier -- using MethodProvider#log method.

    Anyways, Hashtag gave me a great idea, I'll need to refactor my code now a bit

    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.