Jump to content

deselect inventory item snippet


Joseph

Recommended Posts

You are right, it will deselect and would only accept the trade if it double clicks for some reason tongue.png

I kinda forgot about the context, my bad ph34r.png  QwPha8E.png

 

Thus what I was arguing before. Due to the fact that I have no internet at home at the moment, I couldn't prove it. Like I was saying, if the client misclicks, ie. double clicks, then it could mess up. Otherwise, it would be a safe area to click in. :P

Link to comment
Share on other sites

Thus what I was arguing before. Due to the fact that I have no internet at home at the moment, I couldn't prove it. Like I was saying, if the client misclicks, ie. double clicks, then it could mess up. Otherwise, it would be a safe area to click in. tongue.png

 

Yeah sorry I thought you meant another kind of misclick :p

My bad brochachos

Link to comment
Share on other sites

Here's how I do it (edited):

	/**
	 * @author Botrepreneur 
	 * @throws InterruptedException 
	 * @Version: 00.11 
	 */
	
	public static boolean deselect(Script script) throws InterruptedException {
		Timer timer = new Timer();
		while (script.inventory.isItemSelected() && timer.getElapsed() < 30000L) {
			// GET ALL OPENABLE TABS:
			List<Tab> openableTabs = new ArrayList<Tab>();
			for (Tab tab : Tab.values()) {
				if (!tab.isOpen(script.bot) && !tab.isDisabled(script.bot)) {
					openableTabs.add(tab);
				}
			}
			if (openableTabs != null && !openableTabs.isEmpty()) {
				int i = MethodProvider.random(0, openableTabs.size() - 1);
				if (openableTabs.get(i) != null && script.tabs.open(openableTabs.get(i))) {
					MethodProvider.sleep(MethodProvider.random(600, 900));
				}
			} else {
				// DEAD SPACE, could use interface values instead
				Rectangle deadSpaceLeftColumn = new Rectangle(520, 205, 25, 260);
				Rectangle deadSpaceRightColumn = new Rectangle(740, 205, 25, 260);
				Rectangle deadSpaceRightFromMap = new Rectangle(720, 10, 45, 155);
				Rectangle[] deadSpaceAll = new Rectangle[] { deadSpaceLeftColumn, deadSpaceRightColumn, deadSpaceRightFromMap };
				int i = MethodProvider.random(0, deadSpaceAll.length - 1);
				if (deadSpaceAll[i] != null && MoveMouse.toRectangle(script, deadSpaceAll[i], true, 3)) {
					MethodProvider.sleep(MethodProvider.random(600, 900));
				}
			}
		}
		return !script.inventory.isItemSelected();
	}
Edited by Botrepreneur
Link to comment
Share on other sites


                        else {
				// DEAD SPACE
				Rectangle deadSpaceLeftColumn = new Rectangle(520, 205, 25, 260);
				Rectangle deadSpaceRightColumn = new Rectangle(740, 205, 25, 260);
				Rectangle deadSpaceRightFromMap = new Rectangle(720, 10, 45, 155);
				Rectangle[] deadSpaceAll = new Rectangle[] { deadSpaceLeftColumn, deadSpaceRightColumn, deadSpaceRightFromMap };
				int i = MethodProvider.random(0, deadSpaceAll.length - 1);
				if (deadSpaceAll[i] != null && MoveMouse.toRectangle(script, deadSpaceAll[i], true, 3)) {
					MethodProvider.sleep(MethodProvider.random(600, 900));
				}
			}

where you have this at is a bit useless since. The code below will never be empty nor null

if (openableTabs != null && !openableTabs.isEmpty()) {

So you should add a boolean to switch between both methods.

 

Also, rather then putting the tabs in an arraylist couldnt you loop through all tab, add a boolean that check to see if it isnt open. Interact with it and add a break statement to end the loop.

 

Plus, why does the method return item is selected true

		return script.inventory.isItemSelected();
Link to comment
Share on other sites

 where you have this at is a bit useless since. The code below will never be empty nor null

 

For situations where no tab is openable (randomevents  for example).

The openableTabs array will be empty when nothing is added to it (if all tabs are disabled).

 

 

 Also, rather then putting the tabs in an arraylist couldnt you loop through all tab, add a boolean that check to see if it isnt open. Interact with it and add a break statement to end the loop.

 

You absolutely could, the reason I add all openable tabs to an array is so that I can open a random one from that list. I like randomization tongue.png

 

 Plus, why does the method return item is selected true

 

Should be !script.inventory.isItemSelected() indeed, thanks.

 

Edit: second time I fuck up a boolean return value today facep.gif

Edited by Botrepreneur
Link to comment
Share on other sites

For situations where no tab is openable (randomevents  for example).

The openableTabs array will be empty when nothing is added to it (if all tabs are disabled).

 

 

 

You absolutely could, the reason I add all openable tabs to an array is so that I can open a random one from that list. I like randomization tongue.png

 

 

Should be !script.inventory.isItemSelected() indeed, thanks.

 

Edit: second time I fuck up a boolean return value today facep.gif

correct me if im wrong, but i havent seen any random that disable all tabs. and i love randomization

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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