- Joined
- Aug 7, 2013
- Messages
- 262
- Thread Author
- #1
An interface closer should be added to the client.
I suggest having this "event solver" customizable per script, where a script can add or remove specific interfaces depending on the needs of the script.
OSRS report screen closer, as dynamic as possible:
I suggest having this "event solver" customizable per script, where a script can add or remove specific interfaces depending on the needs of the script.
OSRS report screen closer, as dynamic as possible:
Code:
package com.skelware.runemate.bot.script.flax;
import com.runemate.game.api.hybrid.local.hud.interfaces.Interface;
import com.runemate.game.api.hybrid.local.hud.interfaces.InterfaceComponent;
import com.runemate.game.api.hybrid.local.hud.interfaces.Interfaces;
import com.runemate.game.api.hybrid.util.Filter;
import com.runemate.game.api.script.Execution;
import com.sjbijzitter.bot.script.engine.impl.Condition;
import com.sjbijzitter.bot.script.engine.impl.Executable;
public final class ReportScreenCloser implements Condition, Executable {
private InterfaceComponent closebutton;
private static final Filter<InterfaceComponent> FILTER_TEXT = Interfaces.getTextContainsFilter("Report abuse");
private static final Filter<InterfaceComponent> FILTER_TEXTURE = Interfaces.getTextureFilter(535);
@Override
public boolean validate() {
closebutton = null;
top: for (final Interface iface : Interfaces.getVisible()) { //iterate over all visible interfaces
for (final InterfaceComponent titlebar : iface.getComponents(FILTER_TEXT)) { //make sure the current interface is the report screen
for (final InterfaceComponent closebutton : iface.getComponents(FILTER_TEXTURE)) { //find the close button on the report screen
this.closebutton = closebutton;
break top; //stop iterating over all visible interfaces
}
}
}
return closebutton != null;
}
@Override
public int execute() {
if (closebutton.interact("Cancel")) { //click the close button on the report screen
for (int i = 0; i < 10 && validate(); i++) {
Execution.delay(100); //Wait a bit for the report screen to close
}
}
return 0;
}
}
Last edited: