-
-
Save anonymous/86628d433f7f7cb444f20b4463c25d41 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pw.botting.pepe; | |
import org.osbot.rs07.api.model.Item; | |
import org.osbot.rs07.script.Script; | |
import java.util.ArrayList; | |
import java.util.List; | |
public class Example extends Script { | |
private List<Task> tasks = new ArrayList<>(); | |
@Override | |
public void onStart() throws InterruptedException { | |
tasks.add(new Task() { | |
@Override | |
public boolean isValid(Script client) { | |
return client.getInventory().getAmount("Lobster") > 3; | |
} | |
@Override | |
public int execute(Script client) { | |
Item item = client.getInventory().getItem("Lobster"); | |
if (item != null) { // This should never happen. | |
item.interact("Drop"); | |
} | |
return 1000; | |
} | |
}); | |
} | |
@Override | |
public int onLoop() throws InterruptedException { | |
Task selected = tasks.stream().filter(task -> task.isValid(this)).findFirst().orElse(null); | |
if (selected != null) { | |
return selected.execute(this); | |
} | |
return 1000; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pw.botting.pepe; | |
import org.osbot.rs07.script.Script; | |
public interface Task { | |
boolean isValid(Script client); | |
int execute(Script client); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment