Posts posted by imancity
-
-
-
-
-
-
cause "auto" is not the name of your Autocaster instance, its "caster".
so !caster.isAutocasting()
I realized that and fixed it, but then it gives an error for the autocastSpell and isAutocasting things. When I compile it says can't read the autocaster in private autocaster caster = new Autocaster(this).
It doesn't show red underline errors but once compiled it does and then it doesn't actually work. Sorry if its a completely stupid question.
-
So I made a simple and short script a few hrs ago, it was running perfectly. No bugs nada. Now I added a paint, and then ran it again and it'll bank when the banking condition is met but when the others are it just sits and gives this error:
[ERROR][Bot #1][06/08 04:44:12 PM]: Error in bot executor! java.lang.NoClassDefFoundError: Could not initialize class org.osbot.QA at org.osbot.Lpt7.IiiiiiiIIiII(nl:227) at org.osbot.Lpt7.IiiiiiiIIiII(nl:131) at org.osbot.kB.IiiiiiiIIiII(pj:102) at org.osbot.rs07.event.WebWalkEvent.execute(ki:92) at org.osbot.rs07.event.EventExecutor$2.run(mi:73) at org.osbot.rs07.event.EventExecutor.execute(mi:24) at org.osbot.rs07.script.MethodProvider.execute(aj:461) at org.osbot.rs07.api.Walking.webWalk(yo:256) at FlaxSpinner.onLoop(FlaxSpinner.java:67) at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(hj:81) at java.lang.Thread.run(Unknown Source)
I can PM someone the code if they want to see, but I don't believe there's any errors. Don't wanna post it here public cause its for a friend.
-
Here's my own autocaster I made:
Autocaster.java
import org.osbot.rs07.api.ui.Tab; import org.osbot.rs07.script.MethodProvider; public class Autocaster { private static final int AUTOCAST_CONFIG = 108; private CachedWidget openPanel = new CachedWidget(593, 25); private CachedWidget panel = new CachedWidget(548, 61); //private CachedWidget cancel = new CachedWidget(201, 0, 0); private CachedWidget spellWidget; private MethodProvider api; public Autocaster(MethodProvider api) { this.api = api; } public boolean isAutocasting() { return api.getConfigs().get(AUTOCAST_CONFIG) != 0; } public boolean isAutocasting(Items spell) { return api.getConfigs().get(AUTOCAST_CONFIG) == spell.getConfigValue(); } public void openPanel(Items spell) throws InterruptedException { if (api.getTabs().getOpen() != Tab.ATTACK) { TabHotkey.COMBAT.openTab(api); } else { if (openPanel.getWidget(api.getWidgets()) != null) { if (openPanel.getWidget(api.getWidgets()).interact()) { new CSleep(() -> isSpellVisible(spell), 2_500).sleep(); } } } } public void selectSpell(Items spell) { if (isSpellVisible(spell)) { if (spellWidget.getWidget(api.getWidgets()).interact()) { new CSleep(() -> isAutocasting(), 2_500).sleep(); } } } public void autoCastSpell(Items spell) throws InterruptedException { if (!isSpellVisible(spell)) openPanel(spell); else { selectSpell(spell); } } public boolean isPanelOpen() { return panel.getWidget(api.getWidgets()) != null; } public boolean isSpellVisible(Items spell) { spellWidget = new CachedWidget(spell.getRoot(), spell.getChild(), spell.getChild2()); return spellWidget.getWidget(api.getWidgets()) != null; } }CachedWidget.java
import org.osbot.rs07.api.Widgets; import org.osbot.rs07.api.ui.RS2Widget; public class CachedWidget { private Integer parentID; private Integer childID; private Integer child2ID; private String text; private RS2Widget widget; public CachedWidget(final int parentID, final int childID, final int child2ID) { this.parentID = parentID; this.childID = childID; this.child2ID = child2ID; } public CachedWidget(final int parentID, final int childID) { this.parentID = parentID; this.childID = childID; } public CachedWidget(final String text) { this.text = text; } public RS2Widget getWidget(final Widgets widgets) { if (widget == null) cacheWidget(widgets); return widget; } private void cacheWidget(final Widgets widgets) { RS2Widget widget; if (text != null) widget = widgets.getWidgetContainingText(text); else if (child2ID != null) widget = widgets.get(parentID, childID, child2ID); else widget = widgets.get(parentID, childID); this.widget = widget; } }Items.java
import org.osbot.rs07.api.ui.MagicSpell; import org.osbot.rs07.api.ui.RS2Widget; import org.osbot.rs07.api.ui.Spells.NormalSpells; import org.osbot.rs07.script.MethodProvider; public enum Items { AIR_STRIKE("Wind strike", NormalSpells.WIND_STRIKE, 201, 0, 1, 3), WATER_STRIKE("Water strike", NormalSpells.WATER_STRIKE, 201, 0, 2, 5), EARTH_STRIKE("Earth strike", NormalSpells.EARTH_STRIKE, 201, 0, 3, 7), FIRE_STRIKE("Fire strike", NormalSpells.FIRE_STRIKE, 201, 0, 4, 9), AIR_BOLT("Wind bolt", NormalSpells.WIND_BOLT, 201, 0, 5, 11), WATER_BOLT("Water bolt", NormalSpells.WATER_BOLT, 201, 0, 6, 13), EARTH_BOLT("Earth bolt", NormalSpells.EARTH_BOLT, 201, 0, 7, 15), FIRE_BOLT("Fire bolt", NormalSpells.FIRE_BOLT, 201, 0, 8, 17), AIR_BLAST("Wind blast", NormalSpells.WIND_BLAST, 201, 0, 9, 19), WATER_BLAST("Water blast", NormalSpells.WATER_BLAST, 201, 0, 10, 21), EARTH_BLAST("Earth blast", NormalSpells.EARTH_BLAST, 201, 0, 11, 23), FIRE_BLAST("Fire blast", NormalSpells.FIRE_BLAST, 201, 0, 12, 25), WIND_WAVE("Wind wave", NormalSpells.WIND_WAVE, 201, 0, 13, 27), WATER_WAVE("Water wave", NormalSpells.WATER_WAVE, 201, 0, 14, 29), EARTH_WAVE("Earth wave", NormalSpells.EARTH_WAVE, 201, 0, 15, 31), FIRE_WAVE("Fire wave", NormalSpells.FIRE_WAVE, 201, 0, 16, 33), IBAN_BLAST("Iban blast", NormalSpells.IBAN_BLAST), CRUMBLE_UNDEAD("Crumble undead", NormalSpells.CRUMBLE_UNDEAD, 201, 0, 0, 35), MAGIC_DART("Magic dart", NormalSpells.MAGIC_DART, 201, 0, 0, 37), CLAWS_OF_GUTHIX("Claws of Guthix", NormalSpells.CLAWS_OF_GUTHIX), SARADOMIN_STRIKE("Saradomin strike", NormalSpells.SARADOMIN_STRIKE), FLAMESS_OF_ZAMORAK("Flames of Zamorak", NormalSpells.FLAMES_OF_ZAMORAK), CONFUSE("Confuse", NormalSpells.CONFUSE), WEAKEN("Weaken", NormalSpells.WEAKEN), CURSE("Curse", NormalSpells.CURSE), STUN("Stun", NormalSpells.STUN); Items(String name, MagicSpell spell, int root, int child, int child2, int configValue) { this.name = name; this.magicSpell = spell; this.root = root; this.child = child; this.child2 = child2; this.configValue = configValue; } Items(String name, MagicSpell spell) { this.name = name; this.magicSpell = spell; } private MagicSpell magicSpell; private String name; private int root, child, child2, configValue; @Override public String toString() { return name; } public MagicSpell getMagicSpell() { return magicSpell; } public int getRoot() { return root; } public int getChild() { return child; } public int getChild2() { return child2; } public int getConfigValue() { return configValue; } public RS2Widget getWidget(MethodProvider api) { return api.getWidgets().get(getRoot(), getChild(), getChild2()); } }TabHotkey.java (@FrostBug)
import java.awt.event.KeyEvent; import org.osbot.rs07.api.ui.Tab; import org.osbot.rs07.script.MethodProvider; public enum TabHotkey { COMBAT(Tab.ATTACK, 0, 1224), SKILLS(Tab.SKILLS, 1, 1224), QUEST(Tab.QUEST, 2, 1224), INVENTORY(Tab.INVENTORY, 3, 1224), EQUIPMENT(Tab.EQUIPMENT, 4, 1224), PRAYER(Tab.PRAYER, 5, 1224), MAGIC(Tab.MAGIC, 0, 1225), CLAN(Tab.CLANCHAT, 1, 1225), FRIENDS(Tab.FRIENDS, 2, 1225), IGNORE(Tab.IGNORES, 3, 1225), SETTINGS(Tab.SETTINGS, 4, 1225), EMOTES(Tab.EMOTES, 5, 1225), LOGOUT(Tab.LOGOUT, 1, 1226); private final Tab tab; private final int index; private final int register; private final static int[] KEYCODES = { -1, KeyEvent.VK_F1, KeyEvent.VK_F2, KeyEvent.VK_F3, KeyEvent.VK_F4, KeyEvent.VK_F5, KeyEvent.VK_F6, KeyEvent.VK_F7, KeyEvent.VK_F8, KeyEvent.VK_F9, KeyEvent.VK_F10, KeyEvent.VK_F11, KeyEvent.VK_F12, KeyEvent.VK_ESCAPE }; private TabHotkey(Tab tab, int index, int register) { this.tab = tab; this.index = index; this.register = register; } public Tab getTab() { return tab; } public int getHotkey(MethodProvider parent) { int config = parent.getConfigs().get(this.register); int kcIndex = (config >> (this.index * 5)) & 0b11111; return KEYCODES[kcIndex]; } public boolean openTab(MethodProvider parent) throws InterruptedException { if(!isAssigned(parent)) return false; int hkey = getHotkey(parent); parent.getKeyboard().pressKey(hkey); try { MethodProvider.sleep(MethodProvider.random(20, 50)); } finally { parent.getKeyboard().releaseKey(hkey); } return true; } public boolean isAssigned(MethodProvider parent) { return getHotkey(parent) != -1; } public static TabHotkey forTab(Tab tab) { for(TabHotkey thk : values()) { if(thk.getTab() == tab) { return thk; } } return null; } }CSleep: (@Explv)
import java.util.function.BooleanSupplier; import org.osbot.rs07.utility.ConditionalSleep; public final class CSleep extends ConditionalSleep { private final BooleanSupplier condition; public CSleep(final BooleanSupplier condition, int timeout) { super(timeout); this.condition = condition; } @Override public boolean condition() throws InterruptedException { return condition.getAsBoolean(); } }Usage:
private Autocaster caster = new Autocaster(this); private Items spell; //onloop if (!auto.isAutocasting()) { if (getMagic().canCast(NornalSpells.AIR_BLAST)) auto.autoCastSpell(spell); else stop(); }Amazing! Thanks that helps solve the other problem where I didn't have botre's package so it wasn't reading the TabHotKey.
Hey Acerd, any idea why its giving me these errors? The rest of the class files I made are fine.


-
-
Ohh sweet so there's no built-in one. So I added the Autocast class but it's giving me errors for the botre stuff, any ideas?
-
-
-
-
-
Edited by imancity
/** * Created by Sinatra_PC on 06/01/2016. */ public enum QuestsAPI { /*Thanks dogerina*/ TUTORIAL_ISLAND(406, true), ABYSS_SUBQUEST(492), BLACK_KNIGHTS_FORTRESS(130, true), // 4 COOKS_ASSISTANT(29, true), // 2 DEMON_SLAYER(222, true), // 2561 3 DORICS_QUEST(31, true), // 199 DRAGON_SLAYER(176, true), // 10 ERNEST_THE_CHICKEN(32, true), // 3 GOBLIN_DIPLOMACY(62, true), // 6 IMP_CATCHER(160, true), // 2 THE_KNIGHTS_SWORD(122, true), // 7 PIRATES_TREASURE(160, true), // 2 PRINCE_ALI_RESCUE(273, true), // 110 THE_RESTLESS_GHOST(107, true), // 5 ROMEO_AND_JULIET(144, true), RUNE_MYSTERIES(63, true), // 6 SHEAP_SHEARER(179, true), // SHIELD_OF_ARRAV(145, true), //logged 146 too, might be different for gang VAMPIRE_SLAYER(178, true), WITCHS_POTION(67, true), ANIMAL_MAGNETISM(939), ANOTHER_SLICE_OF_HAM(997), BETWEEN_A_ROCK(433), BIG_CHOMPY_BIRD_HUNTING(293), BIOHAZARD(68), CABIN_FEVER(655), CLOCK_TOWER(10), COLD_WAR(968), CONTACT(964), CREATURE_OF_FENKENSTRAIN(399), DARKNESS_OF_HALLOWVALE(869), DEATH_PLATEAU(314), DEATH_TO_THE_DORGESHUUN(794), DESERT_TREASURE(440), DEVIOUS_MINDS(622), THE_DIGSITE(131), DREAM_MENTOR(1003), DRUIDIC_RITUAL(80), DWARF_CANNON(69), //wrong EADGARS_RUSE(335), EAGLES_PEAK(934), ELEMENTAL_WORKSHOP_I(299), ELEMENTAL_WORKSHOP_II(896), ENAKHRAS_LAMENT(641), ENLIGHTENTED_JOURNEY(912), THE_EYES_OF_GLOUPHRIE(844), FAIRYTALE_I(671), FAIRYTALE_II(810), FAMILY_CREST(148), THE_FEUD(435), FIGHT_ARENA(17), FISHING_CONTEST(11), FORGETTABLE_TALE(521), THE_FREMMENIK_ISLES(970), THE_FREMMENIK_TRIALS(347), GARDEN_OF_TRANQUILITY(188), GERTRUDES_CAT(180), GHOSTS_AHOY(408), THE_GIANT_DWARF(482), THE_GOLEM(437), THE_GRAND_TREE(150), THE_GREAT_BRAIN_ROBBERY(980), GRIM_TALES(1016), THE_HAND_IN_THE_SAND(635), HAUNTED_MINE(382), HAZEEL_CULT(223), HEROES_QUEST(188), HOLY_GRAIL(5), HORROR_FROM_THE_DEEP(351), ICTHLARINS_LITTLE_HELPER(445), IN_AID_OF_THE_MYREQUE(705), IN_SEARCH_OF_THE_MYREQUE(387), JUNGLE_POTION(175), KINGS_RANSOM(1049), LEGENDS_QUEST(139), LOST_CITY(147), THE_LOST_TRIBE(465), LUNAR_DIPLOMACY(823), MAKING_HISTORY(604), MERLINS_CRYSTAL(14), MONKS_FRIEND(30), MONKEY_MADNESS(365), MOUNTAIN_DAUGHTER(423), MOURNINGS_END_PART_I(517), MOURNINGS_END_PART_II(574), MURDER_MYSTERY(192), MY_ARMS_BIG_ADVENTURE(905), NATURE_SPIRIT(307), OBSERVATORY_QUEST(112), OLAFS_QUEST(994), ONE_SMALL_FAVOUR(416), PLAGUE_CITY(165), PRIEST_IN_PERIL(302), RAG_AND_BONE_MAN(714), RAT_CATCHERS(607), RECIPE_FOR_DISASTER(69),//will need to get the index for each subquest RECRUITMENT_DRIVE(496), REGICIDE(328), ROVING_ELVES(402), ROYAL_TROUBLE(730), RUM_DEAL(600), SCORPION_CATCHER(76), SEA_SLUG(159), SHADES_OF_MORTTON(339), SHADOW_OF_THE_STORM(602), SHEEP_HERDER(60), SHILO_VILLAGE(116), THE_SLUG_MENACE(874), A_SOULS_BANE(709), SPIRITS_OF_THE_ELID(616), SWAN_SONG(723), TAI_BWO_WANNAI_TRIO(320), A_TAIL_OF_TWO_CATS(568), TEARS_OF_GUTHIX(499), TEMPLE_OF_IKOV(26), THRONE_OF_MISCELLANIA(359), THE_TOURIST_TRAP(197), TOWER_OF_LIFE(977), TREE_GNOME_VILLAGE(111), TRIBAL_TOTEM(200), TROLL_ROMANCE(385), TROLL_STRONGHOLD(317), UNDERGROUND_PASS(161), //logged 161 and 162 WANTED(571), WATCHTOWER(212), WATERFALL_QUEST(65), WHAT_LIES_BELOW(499), WITCHS_HOUSE(226), ZOGRE_FLESH_EATERS(455); int getConfigValue; boolean isF2P; QuestsAPI(int config) { this.getConfigValue = config; } QuestsAPI(int config, boolean isF2P) { this.getConfigValue = config; this.isF2P = isF2P; } public boolean isStarted(QuestsAPI quest, MethodProvider api) { return api.getConfigs().get(quest.getConfigValue()) != 0; } public int getConfigValue(){ return this.getConfigValue; } }2) For cutscenes during Quests, how do I make it so the player doesn't spam click the NPC (like a conditional sleep while cutscene goes on).
if condition && npc isnt null {
talkToNPC
new Conditional Sleep(x ms){
return -> getDialogues().inDialogue() || getDialogues().isPendingOption;
}.sleep;
simple way to do that
Omg a ton of help, thanks!
Hey Christopher, for that QuestAPI, how would I implement it in the code? I tried writing a check to see if its started and did:
if (!QuestsAPI.IMP_CATCHER.isStarted())
but the isStarted wants something in the ()
-
-
you could use something like this:
public enum Quests { QUEST(0); private int configValue; public int getConfigValue() { return configValue; } public boolean isStarted(Quests quest, MethodProvider api) { return api.getConfigs(quest.getConfigValue()) != 0; } }Could you possibly explain what that is doing? I'm having trouble reading it

-
-
-
1) I'm not sure if I am using it incorrectly, but I was trying to use the getQuest().isComplete/isStarted as criteria for moving onto other parts, but it seems even though I have it talk to the NPC only when !getQuest().isStarted(...), it still keeps talking to her.
2) For cutscenes during Quests, how do I make it so the player doesn't spam click the NPC (like a conditional sleep while cutscene goes on).
Thanks!

-
You can define a area with z = 3
Doing this ; new Area(new Position(x y z), new Position(x y z))
OR
Position t = new position(x y z)
Or tile t im not sure, not at home
if (myPlayer().getPosition() == t){
\\something
}
Ohh forreal?? That helps a ton. Thanks man!
Area AREA = new Area(x1, y1, x2, y2).setPlane(z);
Totally missed this post, thanks appreciate it!!
-
-
-
-
INodeRouteFinder
in Scripting Help
Explv helped me with my looter and used it to generate new random paths to look for loot on the ground if none was nearby I believe.