hey, so I'm having a fair few issues with a script I'm trying to make here. Basically the script is supposed to make pizzas once the player reaches a certain cooking level. Here are my problems.
1. The IDE I am using, IntelliJ, is telling me that the Class 'Main' is never used, in spite of there being no other class.
2. The script its self is not showing up in my OSBot Client. I have built it to a JAR file and ported it over via USB to my PC with OSBot on it and it isn't showing, even when in the script folder.
This is what I have done so far:
- Checked the IDE is building properly, Artifacts are set to compile to output root, I have triple checked everything is in order.
- Removing certain parts of the script that were never used, no change.
I have posted in the Discord but wanted to put something out here to reach more people and hopefully be able to help others if they get this issue. Cheers
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.api.map.*;
import org.osbot.rs07.api.ui.RS2Widget;
import org.osbot.rs07.utility.ConditionalSleep;
@ScriptManifest(name = "Pizza bot", author = "", version = 1.0, info = "", logo = "")
public class Main extends Script {
Position edgeBank = new Position(3096, 3494, 0);
Position edgeRang = new Position(3078, 3495, 0);
@Override
public int onLoop() throws InterruptedException {
if(!isCookingLevel()){
if(haveAnchovy())
cookAnchovy();
else
fetchIngredients("Raw anchovies", 28);
}//end if
else{
getWalking().webWalk(edgeBank);
putTomato();
putCheese();
putAnchovies();
cookUncooked();
}
return(100);
}
private boolean haveAnchovy(){
if(getInventory().onlyContains("Raw anchovies"))
return(true);
else
return(false);
}//end haveAnchovy
private void cookAnchovy() throws InterruptedException {
getWalking().webWalk(edgeRang);
objects.closest("Cooking range").interact("Cook");
sleep(2000);
widgets.interact(270, 14, "Cook");
}
private boolean isCookingLevel(){//returns true if the required cooking level is met
if((getSkills().getDynamic(Skill.COOKING)) == 35)
return(true);
else
return(false);
}//end isCookingLevel
private void fetchIngredients(String item, int amt) throws InterruptedException {
getWalking().webWalk(edgeBank);
getBank().open();
getBank().withdraw(item, amt);
sleep(500);
getBank().close();
}
private void putTomato() throws InterruptedException {
fetchIngredients("Pizza base", 14);
fetchIngredients("Tomato", 14);
if (getInventory().getItem("Pizza base").interact("Use", "Pizza base")) //select "use" for pizza base
if (getInventory().getItem("Tomato").interact("Use", "Tomato"))//select "use" for tomato
sleep(1000);//chill for 1000
makeAll();//call the makeAll method. SEE LINE 23
}
private void putCheese() throws InterruptedException{
fetchIngredients("Cheese", 14);
if (getInventory().getItem("Incomplete pizza").interact("Use", "Incomplete pizza"))//use pizza
if (getInventory().getItem("Cheese").interact("Use", "Cheese"))//use cheese
sleep(800);//chill
makeAll();//call makeAll
}
private void putAnchovies() throws InterruptedException{
fetchIngredients("Cooked anchovy", 14);
if (getInventory().getItem("Plain pizza").interact("Use", "Plain pizza"))//use pizza
if (getInventory().getItem("Anchovies").interact("Use", "Anchovies"))//use anchovy
sleep(800);//chill
makeAll();//call makeAll
}
public void makeAll() throws InterruptedException {
RS2Widget PizzaWidget;
PizzaWidget = getWidgets().get(309, 6);
if (PizzaWidget != null && PizzaWidget.isVisible())
if (PizzaWidget.interact("Make all"))
sleep(18000);
}
public void cookAll() throws InterruptedException {//just cooks all
RS2Widget Uncooked = widgets.get(307, 4);//declare widget called Uncooked
if (Uncooked != null && Uncooked.isVisible()) //do if Uncooked is not null and is visible
sleep(500); //chill for 500
Uncooked.interact("Cook All"); //use the uncooked to do the "cook all" interaction
new ConditionalSleep(1000000) { //chill for a long time
@ Override //override the condition method
public boolean condition() throws InterruptedException {
return !getInventory().contains("Uncooked pizza");
}
}.sleep();
}
public void cookUncooked () throws InterruptedException {//cooks uncooked pizza on a range
sleep(300); {
fetchIngredients("Uncooked pizza", 28);//fetch 28 uncooked pizzas
getWalking().webWalk(edgeRang);//walk to the edgeville range
RS2Widget UnpizzaWidget = widgets.get(307, 4);//make a widget object
RS2Object Range = objects.closest("Range");{ //grab the closest range
if (Range.isVisible());//if you see the range
if (getInventory().getItem("Uncooked pizza").interact("Use", "Uncooked pizza"))//use pizza
if (Range.interact("Use"));//use on range
new ConditionalSleep(10000) {//chill for 10000
@ Override
public boolean condition() throws InterruptedException {//override condition
return (UnpizzaWidget != null && (UnpizzaWidget.isVisible()));
}
}.sleep();//sleep
cookAll();//call cookAll method SEE LINE 77
}
}
}//end cookUncooked
}//end main