Jump to content

Clicking on inventory items + antiban would be helpful :)


rafomaniac

Recommended Posts

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

 

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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