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

What's wrong with this script?

Featured Replies

I'm a fucking newb at this, my programmer knowledge is basic at best.

I can't for the love of my life figure out why this script doesn't start, I don't even get the onStart messages, I am sure I've done something wrong but can't quite pin it.

Please ignore all of my shitty practices, as I'm using this to familiarize myself with the API whilst I learn.

 

EDIT: Also would appreciate any tips one may have to offer.
 


import org.osbot.rs07.api.NPCS;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.script.API;

import java.awt.*;


@ScriptManifest(name = "TzTok Wine Maker", author = "TzTok Jad", version = 1.0, info = "", logo = "") 
public class WineMaker extends Script {

	public int wineMade;
	public int expGained;
	public String grapes = "Grapes";
	public String jugwater = "Jug of water";
	public String unfwine = "Unfermented wine";
	
	NPC banker = npcs.closest("Banker");

    @[member='Override']
    public void onStart() throws InterruptedException {
        //Code here will execute before the loop is started
    	log("Starting TzTok Wine Maker");

    }
    
    @[member='Override']
    public void onExit() {
        //Code here will execute after the script ends


    }
	public enum scriptState{
		MAKEWINE, BANK, NULL, END
	}
	
	public scriptState getState() {
		if (inventory.contains(grapes) && inventory.contains(jugwater)){
			return scriptState.MAKEWINE;
		}
		if (inventory.isEmptyExcept(unfwine)){
			return scriptState.BANK;
		}
		else{
			return scriptState.NULL;
		}
			
		}


    @[member='Override']
    public int onLoop() throws InterruptedException {
    	

    	switch(getState()){

    	case MAKEWINE:
    		inventory.getItem(grapes).interact();
    		sleep(random(400,1200));
    		inventory.getItem(jugwater).interact();
    		if(getWidgets().get(305, 2).isVisible()){
        		sleep(random(400,1200));
    			getWidgets().get(305, 2).interact("Make All");
    			sleep(random(10000,16000));
    		}
    		break;
    	case BANK:
    		banker.interact("Bank");
    		sleep(random(400,1200));
    		bank.depositAll();
    		sleep(random(400,1200));
    		bank.withdraw(jugwater, 14);
    		sleep(random(400,1200));
    		bank.withdraw(grapes, 14);
    		
    		break;
    	case NULL:
    		log("NULL");
    		break;
		default:
			getState();
			break;
    		
    	}
    	
        return 800; //The amount of time in milliseconds before the loop starts over
    }


    @[member='Override']
    public void onPaint(Graphics2D g) {
        //This is where you will put your code for paint(s)




    }


}

Edited by TzTok Jad

  • Author
NPC banker = npcs.closest("Banker");

 

Thanks, you have saved much frustration.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

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.