Jump to content

Clicking on inventory items + antiban would be helpful :)


Recommended Posts

Posted

Hello guys,
 
I'm making my first script, which is a wine drinker. I think I'm getting everything right, however there's missing one part that I can't get to figure out (saw a bunch of tutorials, and it was really helpful smile.png ) How do I click on jugs of wine from inventory? I have this code for now

 

import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
 
import java.awt.*;
 
@ScriptManifest(author = "Rafael", info = "My first script", name = "Bebe vinho", version = 0.1, logo = "")
public class main extends Script {
 
    @Override
    public void onStart() {
        log("Começar com 'jugs of wine' no banco de falador");
    }
 
    private enum State {
    	DRINK, BANK, WAIT
    };
    
    private State getState() {
    	if (inventory.contains("jug of wine"))
    		return State.DRINK;
    	if (!inventory.contains("jug of wine"))
    		return State.BANK;
    	return State.WAIT;   	
    }
    
    @Override
    public int onLoop() throws InterruptedException {
    	switch (getState()) {
    	case DRINK:
    		if (!myPlayer().isAnimating()) {
    			
    			sleep(random(10, 150));
    		}
    		break;
    	case BANK:
    		Entity bank = objects.closest("Bank booth");
    		if (!inventory.contains("jug of wine"))
    			getBank().depositAll();
    		if (bank != null) {
    			bank.interact("Bank");
    			sleep(random(500, 1300));
    			getBank().withdraw("Jug of wine", 28);
    		}
    		break;
    	case WAIT:
    		sleep(random(300, 1000));
    		break;
    	}
        return random(500, 1800);
    }
 
    @Override
    public void onExit() {
        log("Script parado. Bebado o suficiente?");
    }
 
    @Override
    public void onPaint(Graphics2D g) {
 
    }
 
}

 

 

Any anti-ban would be helpfull smile.png (and advices eheh)

Again, It's my first script, complete noob, never had any computer language learned, sorry if it's rubbish smile.png

Posted (edited)
Use this:
import org.osbot.rs07.api.ui.Tab;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;

import java.awt.*;

@ScriptManifest(author = "Rafael", info = "My first script", name = "Bebe vinho", version = 0.1, logo = "")
public class main extends Script {

	@Override
	public void onStart() {
		log("Começar com 'jugs of wine' no banco de falador");
		AntiBan();
	}

	public void AntiBan() throws InterruptedException {
		switch (random(1, 35)) {
		case 1:
			equipment.openTab();
			break;
		case 2:
			skills.open();
                        break;                 
		case 3:
			camera.movePitch(40 + (random(2, 80)));
			break;
		case 4:
			camera.moveYaw(110 + (random(20, 50)));
			break;
		}
		sleep(random(250, 750));
		tabs.open(Tab.INVENTORY);
	}

	private enum State {
		DRINK, BANK, WAIT
	};

	private State getState() {
		if (inventory.contains("Jug of wine") && !myPlayer().isAnimating())
			return State.DRINK;
		if (!inventory.contains("Jug of wine"))
			return State.BANK;
		return State.WAIT;
	}

	@Override
	public int onLoop() throws InterruptedException {
		switch (getState()) {
		case DRINK:
				getInventory().interact("Drink", "Jug of wine");
				sleep(random(10, 150));
			break;
		case BANK:
			if (!getBank().isOpen()) {
				getBank().open();
				new ConditionalSleep(500) {

					@Override
					public boolean condition() throws InterruptedException {
						return !getBank().isOpen();
					}

				}.sleep();
			}
			if (getBank().isOpen() && getInventory().isEmpty() && !getInventory().contains("Jug of wine")
					&& getBank().contains("Jug of wine")) {
				getBank().withdrawAll("Jug of Wine");
			} else if (getBank().isOpen() && !getInventory().isEmpty() && !getInventory().contains("Jug of wine")
					&& getBank().contains("Jug of wine")) {
				getBank().depositAll();
				getBank().withdrawAll("Jug of Wine");
			}
			if (getBank().isOpen() && getInventory().contains("Jug of wine")) {
				getBank().close();
			}
			break;
		case WAIT:
			sleep(random(300, 1000));
			break;
		}
		return random(500, 1800);
	}

	@Override
	public void onExit() {
		log("Script parado. Bebado o suficiente?");
	}

	@Override
	public void onPaint(Graphics2D g) {

	}

}

Also if you dont mind me asking , why a wine drinker?

Edited by Assnerd
  • Like 2
Posted

 

Use this:
import org.osbot.rs07.api.ui.Tab;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;

import java.awt.*;

@ScriptManifest(author = "Rafael", info = "My first script", name = "Bebe vinho", version = 0.1, logo = "")
public class main extends Script {

	@Override
	public void onStart() {
		log("Começar com 'jugs of wine' no banco de falador");
		AntiBan();
	}

	public void AntiBan() throws InterruptedException {
		switch (random(1, 35)) {
		case 1:
			equipment.openTab();
			break;
		case 2:
			skills.open();
                        break;                 
		case 3:
			camera.movePitch(40 + (random(2, 80)));
			break;
		case 4:
			camera.moveYaw(110 + (random(20, 50)));
			break;
		}
		sleep(random(250, 750));
		tabs.open(Tab.INVENTORY);
	}

	private enum State {
		DRINK, BANK, WAIT
	};

	private State getState() {
		if (inventory.contains("Jug of wine") && !myPlayer().isAnimating())
			return State.DRINK;
		if (!inventory.contains("Jug of wine"))
			return State.BANK;
		return State.WAIT;
	}

	@Override
	public int onLoop() throws InterruptedException {
		switch (getState()) {
		case DRINK:
				getInventory().interact("Drink", "Jug of wine");
				sleep(random(10, 150));
			break;
		case BANK:
			if (!getBank().isOpen()) {
				getBank().open();
				new ConditionalSleep(500) {

					@Override
					public boolean condition() throws InterruptedException {
						return !getBank().isOpen();
					}

				}.sleep();
			}
			if (getBank().isOpen() && getInventory().isEmpty() && !getInventory().contains("Jug of wine")
					&& getBank().contains("Jug of wine")) {
				getBank().withdrawAll("Jug of Wine");
			} else if (getBank().isOpen() && !getInventory().isEmpty() && !getInventory().contains("Jug of wine")
					&& getBank().contains("Jug of wine")) {
				getBank().depositAll();
				getBank().withdrawAll("Jug of Wine");
			}
			if (getBank().isOpen() && getInventory().contains("Jug of wine")) {
				getBank().close();
			}
			break;
		case WAIT:
			sleep(random(300, 1000));
			break;
		}
		return random(500, 1800);
	}

	@Override
	public void onExit() {
		log("Script parado. Bebado o suficiente?");
	}

	@Override
	public void onPaint(Graphics2D g) {

	}

}

Also if you dont mind me asking , why a wine drinker?

 

Because wine is 35gp and jug is ~85, with water 110

Its mad beginner cash

Posted

I tought a wine drinker would be a decent script to start learning (actually learned a lot holy shiee....) next stop, is to get a jug filler, where it doesn't have 20 people getting jugs of water every hour jesus christ, and maybe I'll last a while longer money-making on F2P accounts eheh I'm thinking of doing a quester next :D

Posted

I tought a wine drinker would be a decent script to start learning (actually learned a lot holy shiee....) next stop, is to get a jug filler, where it doesn't have 20 people getting jugs of water every hour jesus christ, and maybe I'll last a while longer money-making on F2P accounts eheh I'm thinking of doing a quester next biggrin.png

good luck

  • Like 1

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...