Jump to content

close bank whilst moving toward inventory.position[i]


Recommended Posts

Posted

I have the code fully set up to:

 

  • move mouse to invent spot
  • then close bank using Esc key.
     

However, I want to move the mouse to position whilst pressing Esc key. Im under the belief that threads is the way to go with this, start a thread which moves the mouse and the next line will close the bank. However, Im having trouble implementing:

 

all this is in the same class:

static Thread moveMouse;	
@Override
	public void run() {
		getMouse().move(getInventory().getMouseDestination(0), false);	
	}
//other code above here				
else if (inventory.getAmount("item") == 14){
	bank.depositAll("item");
        bank.withdrawAll("item 2");
	moveMouse = new Thread(new scriptName());
	moveMouse.start();
	getKeyboard().typeKey((char) 27);
}

any help appreciated.

Posted

As far as I know scripts are single threaded meaning either you make a thread yourself or just deal with it doing a single task at a time. But why are you doing this?

 

ahh fair enough, ill keep looking. 

And just to remove the bot like actions. As a person, Id close the bank whilst moving my mouse to the destination. With bots, it appears that it's one action at a time. Such that:

 

  • move mouse to inv spot
  • close bank with esc key

when a real human would move mouse while pressing esc key

Posted

I have things very similar to this in my Hotkey API

 

What I'd do is:

1. Create a MoveMouseEvent or ClickMouseEvent

2. Set the event to run asynchronously (setAsync)

3. Get the distance to the destination

4. Execute the event

5. ConditionalSleep until event finished or remaining mouse distance is less than 30-50% of original distance

6. Hit the hotkey

7. Wait until event finishes (if not already finished)

Posted

ahh fair enough, ill keep looking. 

And just to remove the bot like actions. As a person, Id close the bank whilst moving my mouse to the destination. With bots, it appears that it's one action at a time. Such that:

 

  • move mouse to inv spot
  • close bank with esc key

when a real human would move mouse while pressing esc key

 

How would you know that every human that plays will move their mouse while pressing the ESC key? 

Posted (edited)

How would you know that every human that plays will move their mouse while pressing the ESC key? 

 

It is an assumption I made. It is a personal script, thus resulting in 100% of the people using it will move whilst pressing the 'Esc' key.

It also makes far more sense in my head to do it this way to reduce botlike actions.

Edited by Goaks

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...