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 update will:

      Fix GE inventory item positioning bug


      Fix broken object hooks
        • Like
      • 21 replies
    • This release will:

      Fix some ClosedChannelException bug


      Fix bug in RSObject#getAllTiles


      Add game tab support for "Kourend Favour"
      • 15 replies
    • This release will:

      Fix Settings UI placement bug


      Fix game object location bug


      Fix small layout bug making the client shift up and down


      Fix client crashing bug where loading the client with a small display area will cause the client to crash


      Fix annoying Linux bug relating to painting events and peers


      Fix settings saving bug where settings are saved to disk more often than they should


      Fix RSInterface#isBeingDrawn bug affecting a limited amount of people


      Drop Java 1.7 bytecode version for 1.8


      Important: Since the downloadable RS client uses Java 7, it will no longer be compatible with Looking Glass. To make up for this, we will add support for using other clients such as RuneLite (at a later date).


      This change was necessary to allow us to use Java 8 syntax. It also paves the way for Java 9/10/11 support.
        • Haha
      • 40 replies
    • This update will:

      Fix the RSMenuNode bug which also fixes the bug with bank opening


      Fix the incorrect object positions bug


      Fix and re-enable the LG Objects API Accelerator


      Fix the RSObject#getAllTiles bug
      • 22 replies
    • Try our development release by checking "Development Release" on the TRiBot Loader. Note that these new features are currently in beta.

      This release features:

      Re-sizable mode support for both LG and the regular client


      Slightly improved login bot


      Removed final access modifiers from API classes


      Added RSServer hook wrapper to get the client's cached list of server/world info


      [NEW] Bug fix for intelligent banking


      [NEW] Improvement to the stability of LG over time


      [NEW] Vastly improved the reliability and speed of Screen#getColorAt on both LG and the regular client


      [NEW] Fix LG login problems


      [NEW] Fixed re-sizable mode container bug


      [NEW] Fixed re-sizable mode mouse bug


      [NEW] Use of public constants in the Banking API


      [NEW] Use of other various constants such as Projection#NULL_PT and Screen#EMPTY_COLOR



      More features to come very soon!

      Please test it and let us know here if there are any new bugs introduced in this release.
        • Like
      • 12 replies
  • Recently Browsing   0 members

    No registered users viewing this page.

×