liverare
Scripter II-
Posts
1300 -
Joined
-
Last visited
-
Days Won
3 -
Feedback
0%
liverare last won the day on March 27 2018
liverare had the most liked content!
About liverare
Contact Methods
-
MSN
test
-
Website URL
http://test
-
ICQ
test
-
Yahoo
test
-
Skype
test
Profile Information
-
Gender
Male
-
Location:
test
-
Interests
test
liverare's Achievements
Adamantite Poster (7/10)
941
Reputation
-
Have you checked out bot.getMouseEventHandler().generateBotMouseEvent ? If not, try that before using Robot - I've included you in a PM where somebody else asked how I got around OSBot's slow keyboard/mouse problem. Also, you shouldn't need to use JNativeHook library as you can add listeners to the client itself gl dude, my script blows so I hope you do a ton better
-
Script works fine. The experimental keyboard feature is broken, but the script isn't dependent on it.
-
Something like... Position tile = null; RS2Object box = null; Item boxItem = null; if (tile != null) { box = getBox(tile); if (box.hasActions("Check")) { // loot } } else { boxItem = inventory.getItem("Box trap"); if (boxItem != null && boxItem.interact("Lay")) { tile = myPosition(); } } // other stuff..... public RS2Object getBox(Position tile) { return objects.getAll().stream().filter(obj -> obj != null && obj.exists() && obj.getName().equals("Box trap") && obj.getX() == tile.getX() && obj.getY() == tile.getY()) .findFirst().orElse(null); }
-
Looking good! In your AttackCow code, you're finding a suitable cow on the activate method and on the execute method. Perhaps create a cow variable up top and reuse the same cow? Also, you could filter out any cows that are being attacked by other players: private boolean isCow(NPC npc) { return npc.getName().equals("Cow") && npc.getAnimation() != Cow.DYING.getAnimation() && (ctx.myPlayer().equals(npc.getInteracting()) || npc.getInteracting() == null); // So either we're the dude the cow's focused on OR the cow's not focused on anybody right now } NPC cow = ctx.getNpcs().singleFilter(ctx.getNpcs().getAll(), (Filter<NPC>) this::isCow); Also, you could make your Task a little easier to use by having it extend MethodProvider and then exchanging the context. You can find it under the MethodProvider section here:
-
Item tuna = inventory.getItem("Tuna"); if (tuna != null) { tuna.interact("Eat"); }
-
if (getInventory().isFull()) { Crashes script / NPE
liverare replied to Phoenix's topic in Scripting Help
I'm assuming if you have to do this.api.store. then I'm guessing you also need to do this.api.getInventory().isFull() either way, look into this: -
Interaction Problem. How to implement this kind of method.
liverare replied to Derogan's topic in Scripting Help
Fishing spots are NPCs which means that when you interact with it, you can check for it: Character<?> c = myPlayer().getInteracting(); if (c != null && c.exists() && c.getName().equals("Fishing spot")) { // we're fishing } else { // we're not fishing } -
I doubt it. The botting client acts on the game, not the scripts. The scripts are just the instructions the botting clients have to act on.
-
The 'fast keyboard' feature is broken...again. It's an experimental feature that breaks whenever the devs decide it's time to break it. Please restart the script and turn off the fast keyboard feature before submitting the GUI. The bot will revert to using OSBot's default keyboard mechanics. I tested this and it works. I will look into fixing the fast keyboard feature when I have some time.
-
I recall one of the changes from OSBot v1 to v2 was that bots could no longer read/write to the same static variables, so that's likely it.
-
Figure out what you want. When the script starts, take note of what your stats are and create a list of items you can use and prioritise them by usefulness. Figure out what you need. You might not get what you want, but you'll get what you need. A dragon axe is better than an rune one, but if you don't have a dragon axe or if your woodcutting level isn't 61, then that rune axe is your best friend. Once your bot knows what it's got, what it's not got, and where it's at, you can plan for the bot to progress. Depending on the complexity, you may need to look into using a data-structure. It'll be a lot less code than having 20+ IF's for each axe, pick axe, etc.
-
The rules are a bit ridiculous for scriptwriters, but I believe it's to protect the customers and OSBot's brand. Making it so only the higher ranked scriptwriters get to make & sell the hardest and most complicated scripts not only makes it more likely the customer is getting a higher quality service, but also prevents the market from being over-saturated with potentially worse ones. However, that doesn't mean you can't release your scripts publicly or sell them privately.
-
A combination of: And a looting API that remembers which items it couldn't pick up so as to avoid them completely.
-
You don't need to watch for animations: // Some basic mathematics... long barsInInventory = inventory.getAmount("Bronze bar"); long barsPerPlatebody = 5; long platebodiesWeCanMake = (barsInInventory / barsPerPlatebody); // let's figure out how long we need to sleep long timeToMakeEachPlatebody = 1500; // 1.5 seconds (might be more or less don't know) long timeToMakePlatebodies = (platebodiesWeCanMake * timeToMakeEachPlatebody); long timeToMakePlatebodiesWithRandomOffset = (timeToMakePlatebodies + random(500, 1500)); // + 0.5 to 1.5 seconds if (anvil.interact("Smith")) { new ConditionalSleep(timeToMakePlatebodiesWithRandomOffset) { @Override public boolean condition() { // if any of the following happen, then we need to wake up! return getDialogues().isPendingContinuation() // level up message || inventory.getAmount("Bronze bar") == 0 // we're out of bronze bars || (inventory.getAmount("Bronze bar") / barsPerPlatebody) == 0; // we don't have enough bars to make another platebody } }.sleep(); }
-
Try avoid re-checking the same logic cases and instead structure your code to run the fewest number of checks as possible: private void smithPlateBodys() throws InterruptedException { if(smithArea.contains(myPosition())) { RS2Object anvil = getObjects().closest("Anvil"); RS2Widget smithMenu = getWidgets().getWidgetContainingText("What would you like to make?"); RS2Widget plateBody = getWidgets().get(312,15,2); if (getDialogues().isPendingContinuation()) { log("Handling dialogue..."); if (getDialogues().clickContinue()) { sleep(random(500,700)); } } else if (smithMenu != null && plateBody != null) { log("Smithing Platebody's..."); new ConditionalSleep(10000) { @Override public boolean condition() { return !readyToSmith() || getInventory().getAmount("Iron platebody") == 5; } }.sleep(); } else if (anvil != null && !myPlayer().isAnimating()) { log("Interacting with Anvil..."); if (anvil.interact("Smith")) { new ConditionalSleep(5000) { @Override public boolean condition() { return getWidgets().getWidgetContainingText("What would you like to make?") != null; } }.sleep(); } } } else { log("Walking to Anvil..."); if (getWalking().webWalk(smithArea)) { sleep(random(500,700)); } } }