Jump to content
defqon_1

Hide Paint on Mouse-Over and Click!

Recommended Posts

Simple way to add some uniqueness and flair to your paint. Could be yours over the competition! ;)

import java.awt.Graphics;import java.awt.Point;import java.awt.Rectangle;import org.tribot.script.Script;import org.tribot.script.ScriptManifest;import org.tribot.script.interfaces.MouseActions;import org.tribot.script.interfaces.Painting;@ScriptManifest(authors = { "defqon_1" }, category = "Paint", name = "Painting Tutorial")public class HidePaint extends Script implements Painting, MouseActions {		boolean paintEnabled = true; // Stores whether your paint is toggled or not for 'hide-on-click.'	Rectangle whereToClick = new Rectangle(x, y, width, height); // The screen region to click to toggle the paint.	Point mousePos = new Point(); // Current position of the mouse -- Do not modify.	@Override	public void onPaint(Graphics g) {			// This is the rectangle to 'hide-on-mouseover'  			Rectangle r = new Rectangle(x2, y2, width2, height2); // The screen region to mouse over.			// This expression checks whether or not your mouse is within the region created by the above rectangle			if (!r.contains(mousePos)) {				// Paint everything that you want to disappear on mouseover of the rectangle.			}			// This expression omits everything when the paint has been disabled by click.			if (paintEnabled) {				// Paint everything that you want toggled on click when the user clicks in the whereToClick rectangle.			}	}	@Override	public void run() {		while (true) {}	}	// Toggles the paint when the user clicks within the whereToClick rectangle on the screen.	@Override	public void mouseClicked(Point click, int button, boolean isBot) {		if (!isBot && button == 1 && whereToClick.contains(click)) {			paintEnabled = (!paintEnabled);		}	}	@Override	public void mouseDragged(Point arg0, int arg1, boolean arg2) {}	// Keeps track of current mouse position. 	@Override	public void mouseMoved(Point pos, boolean isBot) {		if(!isBot){			mousePos = pos;		}	}	@Override	public void mouseReleased(Point arg0, int arg1, boolean arg2) {}}
Edited by defqon_1
  • Like 1

Share this post


Link to post
Share on other sites

if (!r.contains(mousePos)) {
should be

if (!r.contains(Mouse.getPos())) {
Otherwise it will only get the point once when the script starts up.

It doesn't work if user input is blocked. How would one get around this dilemma here now?

You'll have to use event blocking instead:

https://tribot.org/doc/org/tribot/script/interfaces/EventBlockingOverride.html

It's a bit more complicated but allows you to ignore clicks depending on where they come from.

Share this post


Link to post
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

  • Similar Content

    • By HerpDerp93
      Hello, I'm trying to write a simple draynor willow cutter, here is what I have so far:
      https://github.com/TRiHerpDerp93/scripts/tree/master/scripts/src/scripts
      There's few things I noticed at the moment:
      1. Would throw ArrayIndexOutOfBounds when starting script logged out, maybe solution is to check if it is logged in & at the tree area beforehand?
      2. Clicks more than once when clicking on a tree, anyone advice what to do for this?
      3. Spams click when webwalking to tree area & bank too, any recommendation for this? I was thinking to check if it is moving until timeout before clicking again.
      Any reviews/feedbacks/tips would be appreciated too, thanks in advanced!
    • By Final Calibur
      Today I will be sharing an extremely simple and easy to use paint system for your scripts. Some of you may have seen it in my open sourced scripts, but I think it would be beneficial to have a thread specifically for it.
       
      This system allows for a nice, clean, easy to use paint. You can implement it within seconds when creating new scripts, and don't have to worry whatsoever about lining things up coordinate by coordinate.
       
      What you will be adding (example)
       

      Implementation
       

      Usage
       
    • By shibbstar
      is it automatically applied or do i have to do certain settings to get it on
    • By XtremePlay
      If I do 25 of the 700 click things and upload the files here, could I get that made into my own mouse data to use without VIP-E?
    • By Yawodo
      I'm a digital artist and have just created my first nooby java script, I'd like to add a customised paint with imagery. Currently I just have a line of code. Could anyone advise how I might go about creating a cool paint, a video or software or any guidance? Cheers.
    • By fleq6
      So, I'm wondering if there's a way to make DynamicClicking a bit more accurate.
      I have the Mouse Speed set to 200, and even with that speed, when trying to loot an item in the ground while the player is running is quite hard. DynamicClicking keeps trying to reach the item while the player runs, but most of the times it can't and eventually the player runs past it and it's not on the screen anymore. Even when walking, although less often, this happens as well.
      Is there any way to decrease the fail-rate and increase the accuracy of DynamicClicking?
      Thank you.
    • By Terawa
      Hi i've noticed that inspite of different scripts, the mouse always lives it's own life eg. right clicking and moving between short periods. This is usually quite nice, but when the script is supposed to afk it's not really convincing when the mouse constantly does things. Is there a way to stop it? Thanks
    • By Dequalityy
      I get this error when it starts up.. 
      Any fix for it?

  • Our picks

    • This release will:

      Add support for using custom F key bindings to switch between game tabs (Thanks @erickho123)


      Fix tab opening for "Skills" and "Kourend Tasks" (Thanks @erickho123)



      Note: If you are using LG, please restart both the RS client and TRiBot
        • Like
      • 30 replies
    • This release will:

      Fix an issue where breaks would stop firing


      Fix Combat#getWildernessLevel, use dynamic search for text and cache ID for later calls


      Fix an NPE in the Combat API


      Fix Mouse#leaveGame bug where the mouse wouldn't actually leave the game screen
        • Like
      • 21 replies
    • This release will:

      Add LG support for Runelite


      Fix NPCChat issues


      Fix a bug where the camera angle setter would just hold down a key for 5 seconds (the timeout)


      Slightly adjust the rotation via keys to be more accurate


      Add the ability for asynchronous camera movement via keys


      Make Camera rotation via mouse more fluid, with more antiban, and work much better in resizable mode


      Add a "Camera#setCamera" method, allowing the rotation and angle to be set in parallel


      Increase the likelihood of using the mouse for camera movements


      Add support for adjusting the camera to positionable entities (Positionable#adjustCameraTo)



      Upcoming updates:

      Improved CLI support


      Much more



      Note: If you are using LG, please restart both the RS client and TRiBot
        • Thanks
        • Like
      • 59 replies
    • This update will:

      Allow for clicking through the chat box when possible (Thanks @Todd)


      Fix Combat#selectIndex (Thanks @Encoded)


      Ensure worlds stay sorted and added a check to avoid misclicks in the in-game world hopper (Thanks @erickho123)


      Fix out-dated Options API interface indices (Thanks @Todd)



      Upcoming updates:

      Break handler bug fix


      Improved CLI support


      Much more



      Note: If you are using LG, please restart both the RS client and TRiBot
        • Like
      • 12 replies
    • This release will:

      Fix login bot after today's game update (Thanks @JoeDezzy1)


      Fix latest in-game world hopping issues (Thanks @erickho123)


      Compact Settings UI and set location relative to TRiBot (Thanks @JoeDezzy1)


      Fix an older implementation of GrandExchange#getWindowState (Thanks @JoeDezzy1)


      Improve the preformance of NPCChat by only searching in certain interface parents (Thanks @JoeDezzy1)



      Upcoming updates:

      Break handler bug fix


      Improved CLI support


      LG support for RuneLite


      Much more



      Note: If you are using LG, please restart both the RS client and TRiBot
        • Thanks
        • Like
      • 16 replies
  • Recently Browsing   0 members

    No registered users viewing this page.

×