Skip to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Wine Maker - Feedback Welcome - Noobie!

Featured Replies

Hello, I'm dartz and this is my first OsBot script.  I've written a tab making bot on another client and recently came to osBot to write bots, improve my java skill, and not have to pay $8 a month. I know python fairly well, but I'm a noob at java. 

The script is very simple, but gets the job done. 

Fixed:

When checking the bank for grapes/jugs of water, it will not detect the items if they are at the corner of the screen.

  • Pros
    • Works
    • Has a Paint
  • Cons
    • Few comments  
    • simple if statements, no functions 
    • only works at the G.E.
    • No GUI

 

package osBots;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.util.concurrent.TimeUnit;

import org.osbot.rs07.api.ui.RS2Widget;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

@ScriptManifest(name = "CookMate", version = 1.0, info = "", author = "Dartz", logo = "")
public class CookMate extends Script{
	
	// reaction times changed prior to posting..
	public int min = 1000;
	public int low = 2000;
	public int med = 3000;
	public int high = 5000;
	// item ids
	public int grapes = 1987;
	public int water = 1937;
	// Paint //
	public int batches;
	public int estWine;
	public int fontSize;
	public long timeBegan;
	public long timeRan;
	
	// Crucial to paint time working //
	public void onStart() {
		timeBegan = System.currentTimeMillis();
	}
	
	@Override
	public int onLoop() throws InterruptedException {
		if (!myPlayer().isAnimating()) {
			log("Standing still");
			if (!inventory.contains(grapes) & !inventory.contains(water)) {
				log("Inventory lacking grapes");
				objects.closest("Grand Exchange booth").interact();
				log("Clicked bank");
				sleep(1000);
				// smart depositing + paint implementation
				if (!inventory.isEmpty()) {
					if (inventory.contains(1995) | inventory.contains(1993)) {
						batches = batches + 1;
						estWine = estWine + 14;
						log("batches: " + batches);
					}
					log("depositing all");
					bank.depositAll();
				}
				if (!bank.contains(grapes) | !bank.contains(water)) {
					stop();
				}
				sleep(random(min,low));
				bank.withdraw(grapes, 14);
				sleep(random(min,low));
				bank.withdraw(water, 14);
				sleep(random(min,low));
				bank.close();
				log("Bank Closed");
				sleep(1000);
			}
		
			if (inventory.contains(grapes) & inventory.contains(water)) {
				inventory.getItem("Grapes").interact("Use");
				sleep(1000);
				inventory.getItem("Jug of water").interact("Use");
				sleep(1000);
				RS2Widget makeInterface = getWidgets().get(270,14,38);
				if (makeInterface != null) {
					if (makeInterface.isVisible());
					log("Make interface is visible!");
					makeInterface.interact();
					/*
					 * Wine making = 2 ticks
					 * 14 Wines = 16.8 secs
					 */
					sleep(random(13000,18000));
				}
			}
		}

		
		log("Gone through onLoop()");
		sleep(1000);
		return 500;
	}
	
	// BELOW: ONLY EFFECTS PAINT //
	public void onPaint(Graphics2D g) {
		Graphics2D gr = g;
		timeRan = System.currentTimeMillis() - this.timeBegan;
		fontSize = 16;
		Font crossHair = new Font("SANS_SERIF", Font.BOLD, fontSize);
		g.setColor(Color.BLACK);
		g.setFont(crossHair);
		// 17 pixels in between each other
		g.drawString("Estimated xp: " + (estWine*200), 555, 424);
		g.drawString("Run time: " + ft(timeRan), 555, 441);
		g.drawString("Batches made: " + batches + " (wines: "+estWine+")", 555, 458);
		
		
	}
	
	private String ft(long duration) {
        String res = "";
        long days = TimeUnit.MILLISECONDS.toDays(duration);
        long hours = TimeUnit.MILLISECONDS.toHours(duration) - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration));
        long minutes = TimeUnit.MILLISECONDS.toMinutes(duration) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration));
        long seconds = TimeUnit.MILLISECONDS.toSeconds(duration) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration));
        if (days == 0) {
            res = (hours + ":" + minutes + ":" + seconds);
        } else {
            res = (days + ":" + hours + ":" + minutes + ":" + seconds);
        }
        return res;
    }
}

 

I used several tutorials on here and greatly appreciate this community.  I want to become a better programmer and community member.  If you have any resources that proved helpful, I'd greatly appreciate those as well.  I also started working on a shrimp fisher to get familiar with walking to and from the bank.

Edited by dartz

12 minutes ago, dreameo said:

RIP.

The example is wrong.

The "bitwise and" is not appropriate in the way that it's used but it still works here.

The examples not wrong. 

boolean expressions are expressed as 0s or 1s and in the example they had 
 

int x =55;
if (x<50 & x>0)

so it'd be if (0 & 1) which (0 & 1) evaluate to 0 which is false.

you're right about it not being appropriate though.

2 minutes ago, IDontEB said:

The examples not wrong. 

boolean expressions are expressed as 0s or 1s and in the example they had 
 


int x =55;
if (x<50 & x>0)

so it'd be if (0 & 1) which (0 & 1) evaluate to 0 which is false.

you're right about it not being appropriate though.

zz read it as the author saying the first expression is false and second is true.

  • Author
47 minutes ago, IDontEB said:

The examples not wrong. 

boolean expressions are expressed as 0s or 1s and in the example they had 
 


int x =55;
if (x<50 & x>0)

so it'd be if (0 & 1) which (0 & 1) evaluate to 0 which is false.

you're right about it not being appropriate though.

Thanks for the clarification.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.