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
  • Correctly cancel a mouse/keyboard event (Maybe bug?)


    orange451

    Recommended Posts

    That doesn't invalidate my point that event#consume() isn't properly implemented. Regardless of what I am trying to make.

     

    Hopefully a developer will see and fix this.

    Link to comment
    Share on other sites

    9 minutes ago, orange451 said:

    That doesn't invalidate my point that event#consume() isn't properly implemented. Regardless of what I am trying to make.

     

    Hopefully a developer will see and fix this.

    Do you mind showing the code snippet where you consume the event? Are you creating your own handler then consuming through it or are you overriding Dreambot's mouse handler?

    Link to comment
    Share on other sites

    Here's an MCVE.

     

    package scripts;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseMotionListener;
    
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.core.Instance;
    
    @ScriptManifest(author = "orange451", name = "Test Consumable Mouse", version = 1.0, description = "Script", category = Category.MISC)
    public class HelloWorldGui extends AbstractScript implements MouseListener,MouseMotionListener {
    
    	public void onStart() {
    		log("Started");
    		
    		Instance.getInstance().getCanvas().addMouseListener(this);
    		Instance.getInstance().getCanvas().addMouseMotionListener(this);
    	}
    
    	public void onExit() {
    		//
    	}
    
    	@Override
    	public int onLoop() {
    		return 20;
    	}
    	
    	/**
    	* Test method to consume any mouse event. This should prevent all mouse clicks on the screen.
    	*/
    	public static void mouseEvent(MouseEvent arg0) {
    		arg0.consume();
    	}
    	
    	@Override
    	public void mouseClicked(MouseEvent arg0) {
    		mouseEvent(arg0);
    	}
    
    	@Override
    	public void mouseEntered(MouseEvent arg0) {
    		mouseEvent(arg0);
    	}
    
    	@Override
    	public void mouseExited(MouseEvent arg0) {
    		mouseEvent(arg0);
    	}
    
    	@Override
    	public void mousePressed(MouseEvent arg0) {
    		mouseEvent(arg0);
    	}
    
    	@Override
    	public void mouseReleased(MouseEvent arg0) {
    		mouseEvent(arg0);
    	}
    
    	@Override
    	public void mouseDragged(MouseEvent arg0) {
    		mouseEvent(arg0);
    	}
    
    	@Override
    	public void mouseMoved(MouseEvent arg0) {
    		mouseEvent(arg0);
    	}
    }

     

    Link to comment
    Share on other sites

    just disable mouse input from dreambot, after that create your own mouselistener and handle stuff in there.

    also how did you get all those rs gui elements and do they have actionlisteners?

    Link to comment
    Share on other sites

    10 minutes ago, Hoodz said:

    just disable mouse input from dreambot, after that create your own mouselistener and handle stuff in there.

    also how did you get all those rs gui elements and do they have actionlisteners?

    It looks like they are just painted on to the screen possibly, which might explain why you're needing to have the mouse and keyboard input disabled while they are using those interfaces. It looks like a really nice concept!

    Link to comment
    Share on other sites

    2 minutes ago, Zoe said:

    It looks like they are just painted on to the screen possibly, which might explain why you're needing to have the mouse and keyboard input disabled while they are using those interfaces. It looks like a really nice concept!

    if it does works like you are saying then my solution works because I use this in my own interactive paint too.

    Link to comment
    Share on other sites

    It's a gui framework I created that's designed similar to Java's Swing. However, it's stylized with runescape graphics. It's all customizable and configurable, so yes there's action listeners to make anything clickable have actions :)

     

    I haven't had any time to check your replies, will do that soon.

    Link to comment
    Share on other sites

    1 hour ago, orange451 said:

    It's a gui framework I created that's designed similar to Java's Swing. However, it's stylized with runescape graphics. It's all customizable and configurable, so yes there's action listeners to make anything clickable have actions :)

     

    I haven't had any time to check your replies, will do that soon.

    Are you keeping this closed source if you don't mind me asking, it actually looks really nice.

    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.