Jump to content

Simple Feather Buyer | Need a little help


Chambo

Recommended Posts

So it buys the Feather packs just fine but when it begins opening the packs it freezes the client. Any suggestions?

import java.awt.*;

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

@ScriptManifest(author = "Chambo", info = "A simple Feather pack buyer!", name = "Chambo's Feather Buyer", version = 0.3, logo = "")

public class Main extends Script {
 
    private enum State {
        BUY, OPEN
    };
 
    private State getState() {
        if (inventory.isFull()){
            return State.OPEN;
        }else{
        	return State.BUY;
        }
    }
 
    @Override
    public void onStart() {
        log("Script successfully started!");
    }
 
    @Override
    public int onLoop() throws InterruptedException {
        switch (getState()) {
            case BUY:
            	if (getInventory().getAmount("Coins") >= 300 ){
            		NPC shop = npcs.closest("Gerrant");
            		 
            		if (shop != null && shop.isVisible()) {
            		shop.interact("Trade");
            		sleep(random(500, 600));
            		
            		if (!inventory.isFull()){
	            		store.buy("Feather pack", 20);
						sleep(random(500, 600));
						store.buy("Feather pack", 20);
						sleep(random(500, 600));
						store.close();
            		}
            		}
            	}else{
                	log("Not enough coins! Stopping Script!");
                	stop();
                }
                break;
            case OPEN:
            	if (getInventory().contains("Feather pack")){
                	inventory.interact("Feather pack", "Open");
    				sleep(random(400, 100));
    				
                }
                break;
        }
        return random(200, 300);
    }
 
    @Override
    public void onExit() {
        log("Thanks for using Chambo's Feather Buyer!");
    }
 
    @Override
    public void onPaint(Graphics2D g) {
 
    }
 
}

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