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
  • Custom mouse movement


    Succulent
     Share

    Recommended Posts

    I'd like to try my hand at creating a custom mouse movement algorithm for dreambot to use to move the mouse to an AbstractMouseDestination.

    If anyone has any tips, advice, or resources I could look at that would point me in the right direction for tackling this task it would be greatly appreciated!

    It would be great to be able to customise some characteristics of mouse pathing/movement, such as overshooting, sway, acceleration, accuracy, so I could try to mimick a particular playstyle or pick movements based on the context of the interaction, for example the difference between afk skilling and panicking when bossing.

     

    Thanks,

    Succulent

    Link to comment
    Share on other sites

    If we're talking about DB3's new interface, here's some general tips:

    • You'll need to do all of the movement (or fail quickly) in the whole call, it's called once before trying to interact
    • Make sure to return as soon as possible after you're sure the mouse is over the correct point so we can do any interactions accurately without needing to move again
    • To actually move the mouse, you can send normal AWT events straight to the canvas (Instance#getCanvas)
    • For best results, you may want to handle entity mouse destinations a bit differently

    Hope that helps :)

    Link to comment
    Share on other sites

    9 minutes ago, Pandemic said:

    If we're talking about DB3's new interface, here's some general tips:

    • You'll need to do all of the movement (or fail quickly) in the whole call, it's called once before trying to interact
    • Make sure to return as soon as possible after you're sure the mouse is over the correct point so we can do any interactions accurately without needing to move again
    • To actually move the mouse, you can send normal AWT events straight to the canvas (Instance#getCanvas)
    • For best results, you may want to handle entity mouse destinations a bit differently

    Hope that helps :)

    Thanks for the tips! I am still concerned about the actual path generation, but these will certainly help with how to actually apply any custom behaviour to the interaction :D

    Link to comment
    Share on other sites

    3 hours ago, Pandemic said:

    If we're talking about DB3's new interface, here's some general tips:

    • You'll need to do all of the movement (or fail quickly) in the whole call, it's called once before trying to interact
    • Make sure to return as soon as possible after you're sure the mouse is over the correct point so we can do any interactions accurately without needing to move again
    • To actually move the mouse, you can send normal AWT events straight to the canvas (Instance#getCanvas)
    • For best results, you may want to handle entity mouse destinations a bit differently

    Hope that helps :)

    What new interface? Is there a way to override the built-in movement now?

    Link to comment
    Share on other sites

    33 minutes ago, Bunnybun said:

    What new interface? Is there a way to override the built-in movement now?

    There is if you're using the DB3 beta (you can find the builds in the script developer subforum).

    You can implement your own (org.dreambot.api.input.mouse.algorithm.MouseMovementAlgorithm), then set it with Instance#setMouseMovementAlgorithm :)

    Link to comment
    Share on other sites

    • 3 weeks later...

    Bump.

    Is it safe to use Mouse#hop to set the mouse? I'm not able to get my algo working by sending events to the canvas, I see some movement via the in game top text but I don't see actual mouse movement. If not, maybe you provide a little more insight as to the best approach. All I've found in terms of examples/tuts is listening for events not dispatching events.

    Link to comment
    Share on other sites

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