- Thread Author
- #1
So I'm trying to make a simple prif burner and my enum states are the only part giving me a hard time. I made one script before and they worked fine so now I'm just confused...
and this is my State
I'm getting the error code: java: the enum switch case must be the unqualified name of the enumeration constant.
and when I hover BANK I see
Also, I have inserted the AbstractBot.State but it says it is not being used. So I'm confused....
Never-mind found a fix
Here is the full script if anyone wants to once-over. I haven't tested it yet but hey it compiles!
Code:
public enum State {
BANK,
BURN,
}
and this is my State
Code:
public void onLoop() {
switch (getState()) {
case BANK:
if (Bank.isOpen()) {
Execution.delayUntil(Bank::isOpen, 250, 500);
Bank.loadPreset(2);
Bank.close();
} else {
Bank.open();
Execution.delayUntil(Bank::isOpen, 250, 2000);
Bank.loadPreset(2);
Bank.close();
}
I'm getting the error code: java: the enum switch case must be the unqualified name of the enumeration constant.
and when I hover BANK I see
Code:
Required: com.runemate.game.api.script.framework.AbstractBot.State
Found: PrifBurner.Prifburner.State
Also, I have inserted the AbstractBot.State but it says it is not being used. So I'm confused....
Never-mind found a fix
Here is the full script if anyone wants to once-over. I haven't tested it yet but hey it compiles!
Code:
package PrifBurner;
import com.runemate.game.api.hybrid.region.GameObjects;
import com.runemate.game.api.hybrid.entities.GameObject;
import com.runemate.game.api.hybrid.entities.Player;
import com.runemate.game.api.hybrid.local.Camera;
import com.runemate.game.api.hybrid.local.hud.interfaces.Bank;
import com.runemate.game.api.hybrid.local.hud.interfaces.Inventory;
import com.runemate.game.api.hybrid.location.Area;
import com.runemate.game.api.hybrid.location.Coordinate;
import com.runemate.game.api.hybrid.location.navigation.Path;
import com.runemate.game.api.hybrid.location.navigation.basic.BresenhamPath;
import com.runemate.game.api.hybrid.region.Players;
import com.runemate.game.api.hybrid.util.StopWatch;
import com.runemate.game.api.script.Execution;
import com.runemate.game.api.script.framework.listeners.InventoryListener;
import com.runemate.game.api.script.framework.listeners.SkillListener;
import com.runemate.game.api.script.framework.LoopingBot;
public class PrifBurner extends LoopingBot implements InventoryListener, SkillListener {
private final static Player player = Players.getLocal();
private final static Area fireArea = new Area.Rectangular(new Coordinate(2199, 3369, 1), new Coordinate(2197, 3374, 1)); //find coordinates for bonfire
private final static StopWatch runtime = new StopWatch();
private static boolean isAtFireArea() {
return fireArea.contains(player);
}
private boolean isIdle() {
return player.getAnimationId() == -1 && !player.isMoving();
}
@Override
public void onStart(String... args) {
setLoopDelay(2000, 3000);
getEventDispatcher().addListener(this);
runtime.start();
}
@Override
public void onLoop() {
switch (getCurrentState()) {
case BANK:
if (Bank.isOpen()) {
Execution.delayUntil(Bank::isOpen, 250, 500);
Bank.loadPreset(2);
Bank.close();
} else {
Bank.open();
Execution.delayUntil(Bank::isOpen, 250, 2000);
Bank.loadPreset(2);
Bank.close();
}
break;
case BURN:
GameObject fire = GameObjects.newQuery().names("Bon Fire").visible().actions("Add Logs").results().nearest();
if (fire != null) {
Camera.turnTo(fire);
if (!fire.isVisible()) {
Camera.turnTo(fire);
} else if (fire.interact("Add Logs")) {
// System.out.println("Starting burning");
Execution.delay(2000, 3000);
}
if(fire.interact("Add Logs")) {
Execution.delayUntil(Inventory::isEmpty,18000, 22000);
/* switch(antibanType) {
Status = "Lets not get banned";
if (!InterfaceWindows.getInventory().isOpen());
InterfaceWindows.getInventory().open();
}
}
else
{
InterfaceWindows.getSkills().isOpen();
} */
if (fire != null && fire.getDefinition() != null) {
if (!isAtFireArea() && !fire.isVisible());
Path p = BresenhamPath.buildTo(fire);
if (p != null) {
p.step();
Camera.turnTo(fire);
Execution.delayUntil(() -> Players.getLocal().getAnimationId() != -1, 3000, 3500);
}
}
if (fire.interact("Add Logs")) {
Execution.delayUntil(() -> Inventory.isEmpty(), 20000, 25000);
break;
}
}
}
}
}
private PrifBurner.State getCurrentState() {
return Players.getLocal().getAnimationId() == -1? State.BURN: State.BURN;
}
private enum State {
BANK,
BURN;
State() {
}
}
}