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.

local script won't startup/load?

Featured Replies

So i'm trying to test this script. And it won't load. Doesn't show anything in the logger either. Any suggestions? Thanks!

import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.model.Player;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
 
import java.awt.*;

@ScriptManifest(author = "Chambo", name = "Chambo's SMC", version = 1, logo = "")
public class main extends Script {
	
public long pCash = inventory.getAmount(995);
public long tradeCash = pCash - 300000;
	
public Area veBank = new Area(3250, 3420, 3257, 3423);
 
    @[member=Override]
    public void onStart() {
        log("Welcome to Chambo's SMC!");
    }

	private enum State {
		TRADE, WAIT, WALK
	};

	private State getState() {
		Player m = getPlayers().closest("username");
		if (m != null && veBank.contains(myPlayer()))
			return State.TRADE;
		if (m == null && veBank.contains(myPlayer()))
			return State.WAIT;
		if (!veBank.contains(myPlayer()))
			return State.WALK;
		return null;
	}

	@[member=Override]
	public int onLoop() throws InterruptedException {
		switch (getState()) {
		case TRADE:
			Player m = getPlayers().closest("username");
			
			if(inventory.contains(995) && pCash >= 300001){
				if (m != null) {
					m.interact("Trade");
					sleep(random(4980, 5632));
					if(trade.isCurrentlyTrading() == true){
						if (trade.getOtherPlayer() == "username"){
							//do the trade
							trade.offer(995, (int) tradeCash); //if this doesn't work then use trade.offerAll(995) then put trade.remove(995, 300000)
							trade.acceptTrade();
							log("1st trade window accepted!");
							sleep(random(500, 700));
							trade.acceptTrade();
							log("2nd trade window accepted!");
						} else {
							trade.declineTrade();
						}
					} else {
						sleep(random(10280, 16024));
					}
				}
			}
			
			
			break;
		case WAIT:
			sleep(random(1213, 3611));
			//add more stuff here for anti-ban (click stats, move camera, etc)
			break;
		case WALK:
				sleep(random(500, 700));
				//walk to Varrock East Bank
				settings.setRunning(true);
				walking.webWalk(veBank);
			break;
		}
		return random(200, 300);
	}

	@[member=Override]
	public void onExit() {
		log("Thanks for using Chambo's SMC!");
	}

	@[member=Override]
	public void onPaint(Graphics2D g) {

	}

}

you dont have info in script manifest so it wont show up. use this template:

 

@ScriptManifest(name = "", author = "Imateamcape", version = 1.0, info = "", logo = "")

public long pCash = inventory.getAmount(995);

This is causing it.

 

initialize the variable in onLoop()

  • Author

I noticed this a bit after I posted this lol facep.gif

 

Anyway thanks for the help guys!

public long pCash = inventory.getAmount(995);

This is causing it.

 

initialize the variable in onLoop()

 

 

Could you explain why. It is declared public inside the class?

Still learning OO programming.

Create an account or sign in to comment

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.