-
Posts
81 -
Joined
-
Last visited
-
Feedback
0%
Everything posted by omni4life
-
Thanks very much for the advice. With point 2, !combat.isFighting checks of my player is interacting, but not being interacted yes? I'm away from my pc/api at the minute, but which class is interacted under? MyPlayer()?Thanks for any and all input everyone!
-
Hey all, back again for yet another round of questions. I wrote an ultra quick Yak killer today for personal use, however, I have some issues with the combat method and I would love some more experienced users input. This is my method as it stands at the moment: case ATTACK: NPC yak = npcs.closest("Yak"); if (yak != null && !combat.isFighting() && !yak.isUnderAttack()) { yak.interact("Attack"); status = "Interacting with Yak"; sleep(random(500,800)); } break; These are my questions: As my character kills the NPC, the NPC enters its death animation thus rendering !combat.isFighting() false and the method continues to click the NPC attempting to re initiate combat. Is there a check I can implement so that once the NPC I'm fighting begins its death animation I can instantly move onto the next? The clicking a dying NPC looks very botlike, but I'm unsure how to combat it. Sometimes, despite the fact my character is already under attack from a Yak it will ignore it and attempt to fight a different Yak, spam clicking it and being unable to attack as it isn't a multicombat zone. Is there a reason it's doing this that I can't see or is the !combat.isFighting method just a little bit iffy? Thanks for any and all help as always! I really appreciate all of your input, ideas and advice. -Omni.
-
I thought Deadman was going to have safe zones to handle any commerce, wasn't it? I only read the in game poll about it, I don't really know a whole heap.
-
Are there any errors being output to the OSBot console? You enable the console in the top right where the interaction lock and settings etc are.
-
If you set a bank pin on Tutorial Island, you can deactivate Iron Man mode at any time by talking to the people in Lumbridge (it takes 7 days in case you're hacked).
-
The website is currently having some issues with DDoS attacks. This is likely related. The download at the top of the website is still working though so you can download the .jar from that link instead. The link is found here.
-
Apologies for making another thread, I didn't actually realise that this was on ongoing issue. Most of my "scripting" is 9/10'ths fiddling until something works and 1/10'th coughing in surprise when it actually does. I'd merely assumed I was using the method incorrectly. Best of luck with chasing down the problem and thanks for posting
-
Haha, I don't even want to imagine that nightmare. If I branch out from my iron man, I think I'll be paying for any fiddly scripts rather than writing them myself. I take it from the likes that this is a known issue that's bugging quite a few people ?
-
Hey guys, I was wondering if there is a way to increase the accuracy of the .interact method? I have the following code snippet, but sometimes it misclicks the bank chest, clicks through the wall and runs outside looking suspicious and damaging xp/ph Entity chest = objects.closest(true, bankChest); .... other code here chest.interact("Use"); Thanks for any help or suggestions! -Omni.
-
Why do my scripts get stuck in a state after I add paint?
omni4life replied to omni4life's topic in Scripting Help
You're right, silly error. the localWalker walked me to the tile exactly beside the right side of the bank chest which I hadn't included in my bankArea so when the the banking state was checking for my player to be in bank area, it was never executed! Thank's for everyones help! I'll toy around with that one when I get home this evening ! There are so many functions hidden away in the API I'm really struggling to know what to use and when. Thanks for the feedback! -
getItems(); throws NullPointerException
omni4life replied to senpai jinkusu's topic in Scripting Help
That's really up to you, you can change it in the first part. I.e. inventory.getItems() or bank.getItems() If you check in the API and look at each of the types (inventory, bank etc) you can determine what methods you can call from them. In that case, .getItems() is predefined for both so you don't have to create any custom code (unless you have a reason I'm overlooking, and I'm still learning all of this myself so that's possible) -
Why do my scripts get stuck in a state after I add paint?
omni4life posted a topic in Scripting Help
Hey guys, I've made a few scripts now for personal use and what not and eventually I'd quite like to be decent enough to share it around on the SDN, but I've noticed I have the same issue in virtually all of the scripts. They all work perfectly fine right up until the moment I add my paint to the script at which point it usually executes 4/5's properly and get's jammed in a state. In this instance, my character cuts the logs fine, walks to the bank and gets stuck standing there in the WALK2BANK state constantly outputting "Walking to Bank" in the log. I just can't see my error and I'd absolutely love a second set of eyes. Code removed, thank you to all for assistance. Any and all feedback is appreciated, both on my in general code and my issue. I'm headed off to bed now so I'll check responses tomorrow. I hugely appreciate everyone's help in advance. -
getItems(); throws NullPointerException
omni4life replied to senpai jinkusu's topic in Scripting Help
I believe I've had this issue before and I solved it by adding into the item check code, if item!=null execute item check else do something I might let someone more experienced wade in, but that should be a quick thing to test in the interim . Best of luck with it! -
My advise would be to walk using the method outlined within this tutorial . To do it, simply add Divine Utility (found under the 'Other' section of the SDN) to your list of scripts and collect the full path you wish you walk. Once you have the path, all you need to is add it to the top of your script and use: localWalker.walkPath(path); Best of luck with it! Feel free to message me or reply if you need a hand getting it working. I also believe that earlier this week I saw a post saying that Web Walking should be implemented within about a week so all of these methods will likely become obsolete at that time.
-
Hey man, I guess it's my chance to return the help I got . You're correct in saying the area I defined was wrong and should only have two points. That was my fault, I didn't properly know how to use Divine Utility yet and I was clicking the tiles for the area I wanted as opposed to selecting the two corners. Using Divine Utility, you select your top right and bottom left corners (or whatever two corners you see fit). This is the corrected code to define the area within the Barbarian Outpost bank: Area bankArea = new Area(new Position(2536, 3575, 0), new Position(2535, 3571, 0)); This defines the two corners and creates a square/rectangle between them. To walk to the bank I did the following: private Position[] bankPos = new Position[] { new Position(2519, 3580, 0), new Position(2525, 3571, 0), new Position(2531, 3571, 0), new Position(2533, 3573, 0), new Position(2535, 3574, 0), new Position(2536, 3573, 0), }; private State getState() { if (inventory.isFull()) { return State.WALK2BANK; } } public int onLoop() throws InterruptedException { switch (getState()) { case WALK2BANK: status = "Walking to bank"; localWalker.walkPath(bankPos); break; } } My banking method was as follows. Note the area check in line three: case BANK: log("Case Change to Bank"); if (inventory.isFull() && bankArea.contains(myPlayer())) { status = "Banking"; log("Status Change and condition check"); Entity chest = objects.closest(true, bankChest); if (!bank.isOpen()) { if (chest != null) { if (chest.isVisible()) { if (!myPlayer().isMoving()) { chest.interact("Use"); sleep(random(1000, 1500)); } } } else { camera.toEntity(chest); } } else if (getInventory().contains( "Bronze axe, Iron axe, Steel axe, Black axe, Mithril axe, Adamant axe, Rune axe, Dragon axe")) { bank.depositAllExcept( "Bronze axe, Iron axe, Steel axe, Black axe, Mithril axe, Adamant axe, Rune axe, Dragon axe"); } else { bank.depositAll(); sleep(random(200, 300)); } } break; I hope this helps you, if you need any more help just say the word. I know the learning curve is steep, but it can be damn rewarding!
-
I think it might be worth my time to not try and dive head first into scripting overnight and instead take the time to take some Java courses first. I actually started John Purcell's "Java Tutorial for Complete Beginners" on Udemy and that's definitely going to help me out I think. The next thing I want to tackle is GUI's because at the minute, I'm creating separate scripts for the same skill as I level (i.e. willow cutter, maple, iron miner, coal miner etc) so I think I might take a Swing class. Do you have any recommendations as to good resources for it?
-
Yeah haha, I spotted your scripts last night and saw the issue. Don't worry, I won't be encroaching on your turf . I used to release under Omni on rscheata/iBot but I haven't had anything to do with this for years. I'll definitely not put Omni in any names or similar Also, regarding nodes, I haven't used Java for years. I had a look at it and for the time being, I think it's beyond my abilities. I'm trying to work towards being able to use it, but in the interim I'm just creating scripts that I actually have a use for to learn.
-
I actually used it once he suggested it, I'm definitely a fan of it. It makes life a lot easier and no doubt saved me a lot of time and fiddling. If I may make a suggestion (as someone with no experience so this might be a nightmare to do), when you have the auto collect path option selected you could be able to right click one of the recorded tiles in the GUI and delete it from the log and the output as I misclicked a few times and didn't want to have to return to the start of my path to re-record a more accurate version. I just manually edited it out of the Array after I got the code so no biggie, but that might make things a tiny bit easier.
-
I'll toy around with that in the morning and see if I can get it working properly. I really appreciate you and everyone else taking the time to help me . I think the script is actually almost ready to be left alone for more than 20 minutes.
-
That fixed it perfectly , Thank you to everyone! It was so simple when I actually think about it. If you don't mind, I just have two more questions for now if anyone has time. I'm looking to create a simple safeguard the says "if no xp is gained in 10 minutes, terminate script, logout". I'm not too sure how to implement it. I know how to track XP gains as I've been using it in a paint I created thanks to Pugs tutorial, but I'm not totally sure how to actually write it. Would this be a simple enough job? I have my character set to dismiss randoms events. When it did this in my mining script, it actually caused to script to stop working. It didn't crash or anything, it was still running it just simply stood there as opposed to resuming mining. Is there any code I have to add in to say "pause script on random"? Thanks again to everyone here, I really appreciate how patient and helpful the community is.
-
That makes for way cleaner code, thank you . I'm basically entirely new to Java and more or less coding in general so I'm learning as I run here. I think I've implemented what you're suggesting however I'm still having some issues with my walking. I now successfully walk to the bank, however, once I get there it doesn't change state from WALK2BANK to BANK and I'm not entirely sure why. I'm almost certain is has something to do with my bankArea.contains(myPlayer()) however I can't work out what exactly. This is my updated code. Any insight is more than welcome from anyone . Also, apologies for spamming this forum over the last few days. I'm quite eager to learn to script however my lack of background is showing though. import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.api.model.GroundItem; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(name = "Willow Cutter", author = "Omni", version = 1.0, info = "A simple Willow Cutter for Barbarian Assault", logo = "") public class OmniCutter extends Script { public static String status; private Position[] barbWillows = new Position[] { new Position(2536, 3573, 0), new Position(2522, 3571, 0), new Position(2519, 3581, 0), }; private Position[] bankPos = new Position[] { new Position(2519, 3579, 0), new Position(2527, 3571, 0), new Position(2529, 3571, 0), new Position(2531, 3571, 0), new Position(2533, 3573, 0), new Position(2535, 3574, 0), }; Area bankArea = new Area( new Position[] { new Position(2536, 3573, 0), new Position(2536, 3574, 0), new Position(2535, 3574, 0), new Position(2535, 3573, 0), new Position(2535, 3572, 0), new Position(2536, 3572, 0), }); private int bankChest = 19051; @Override public void onStart() { status = "OmniCutter is beginning."; } private enum State { CUT, BANK, SLEEP, WALK2TREE, WALK2BANK, NESTGRAB }; private State getState() { Entity tree = objects.closest("Willow"); GroundItem nest = groundItems.closest("Birds Nest"); if (inventory.isFull()) { return State.WALK2BANK; } if (myPlayer().isAnimating()) { return State.SLEEP; } if (tree != null && !myPlayer().isAnimating()) { return State.CUT; } if (inventory.isEmptyExcept("Hatchet")) { return State.WALK2TREE; } if (nest != null && nest.exists()) { return State.NESTGRAB; } if (inventory.isFull() && bankArea.contains(myPlayer())) { return State.BANK; } return State.SLEEP; } @Override public void onExit() { log("OmniCutter is exiting. Thank you for running."); } @Override public int onLoop() throws InterruptedException { switch (getState()) { case CUT: Entity tree = objects.closest("Willow"); if (!inventory.isFull() && !myPlayer().isAnimating() && !myPlayer().isMoving()) { camera.toEntity(tree); tree.interact("Chop Down"); status = "Clicking Willow"; sleep(random(2500, 3000)); } break; case BANK: if (inventory.isFull() && bankArea.contains(myPlayer())) { status = "Banking"; Entity chest = objects.closest(true, bankChest); if (!bank.isOpen()) { if (chest != null) { if (chest.isVisible()) { if (!myPlayer().isMoving()) { chest.interact("Use"); sleep(random(1000, 1500)); } } } else { camera.toEntity(chest); } } else if (getInventory().contains( "Bronze axe, Iron axe, Steel axe, Black axe, Mithril axe, Adamant axe, Rune axe, Dragon axe")) { bank.depositAllExcept( "Bronze axe, Iron axe, Steel axe, Black axe, Mithril axe, Adamant axe, Rune axe, Dragon axe"); } else { bank.depositAll(); sleep(random(200, 300)); } } break; case WALK2TREE: status = "Returning to Willows"; localWalker.walkPath(barbWillows); break; case WALK2BANK: status = "Walking to bank"; localWalker.walkPath(bankPos); break; case NESTGRAB: GroundItem nest = groundItems.closest("Birds Nest"); if (nest != null && nest.exists()) { nest.interact("Take"); } break; case SLEEP: status = "Sleeping"; sleep(random(200, 300)); break; } return random(500, 800); } @Override public void onPaint(Graphics2D g) { g.drawString("Status: " + status, 4, 333); // This is where you will put your code for paint(s) } }
-
Hey guys, I'm currently just throwing together a quick Willow Cutter for Barbarian Assault. At present it cuts fine, RETURNS from the bank fine but it won't WALK to the bank. This is my banking case: Variable from start of script (private Position[] bankPos = { new Position(2535, 3574, 0) }; ) case BANK: if (inventory.isFull()) { localWalker.walkPath(bankPos); status = "Banking"; Entity chest = objects.closest(true, bankChest); if (!bank.isOpen()) { if (chest != null) { if (chest.isVisible()) { if (!myPlayer().isMoving()) { chest.interact("Use"); sleep(random(1000, 1500)); } } } else { camera.toEntity(chest); } } else if (getInventory().contains( "Bronze axe, Iron axe, Steel axe, Black axe, Mithril axe, Adamant axe, Rune axe, Dragon axe")) { bank.depositAllExcept( "Bronze axe, Iron axe, Steel axe, Black axe, Mithril axe, Adamant axe, Rune axe, Dragon axe"); } else { bank.depositAll(); } } break; When I manually override and walk my character to the bank chest within the building, it begins to walk perfectly fine and interacts with the chest and banks properly and walks back to the willows without any issues, however, it just won't walk to the chest under its own power. I'm not too sure what I'm not seeing that's causing this issue. It enters the 'banking' state in the paint. Any and all advice is most welcome. -Omni. (Complete code in case it is required) import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.api.model.GroundItem; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(name = "Willow Cutter", author = "Omni", version = 1.0, info = "A simple Willow Cutter for Barbarian Assault", logo = "") public class OmniCutter extends Script { public static String status; private Position[] barbWillows = { new Position(2518, 3576, 0) }; private Position[] bankPos = { new Position(2535, 3574, 0) }; private int bankChest = 19051; @Override public void onStart() { status = "OmniCutter is beginning."; } private enum State { CUT, BANK, SLEEP, WALK2TREE, NESTGRAB }; private State getState() { Entity tree = objects.closest("Willow"); if (inventory.isFull()) { return State.BANK; } else { if (myPlayer().isAnimating()) { return State.SLEEP; } else { if (tree != null && !myPlayer().isAnimating()) { return State.CUT; } else { if (inventory.isEmptyExcept("Hatchet")) { return State.WALK2TREE; } else { GroundItem nest = groundItems.closest("Birds Nest"); if (nest != null && nest.exists()) { return State.NESTGRAB; } else { return State.SLEEP; } } } } } } @Override public void onExit() { log("OmniCutter is exiting. Thank you for running."); } @Override public int onLoop() throws InterruptedException { switch (getState()) { case CUT: Entity tree = objects.closest("Willow"); if (!inventory.isFull() && !myPlayer().isAnimating() && !myPlayer().isMoving()) { camera.toEntity(tree); tree.interact("Chop Down"); status = "Clicking Willow"; sleep(random(2500, 3000)); } break; case BANK: if (inventory.isFull()) { localWalker.walkPath(bankPos); status = "Banking"; Entity chest = objects.closest(true, bankChest); if (!bank.isOpen()) { if (chest != null) { if (chest.isVisible()) { if (!myPlayer().isMoving()) { chest.interact("Use"); sleep(random(1000, 1500)); } } } else { camera.toEntity(chest); } } else if (getInventory().contains( "Bronze axe, Iron axe, Steel axe, Black axe, Mithril axe, Adamant axe, Rune axe, Dragon axe")) { bank.depositAllExcept( "Bronze axe, Iron axe, Steel axe, Black axe, Mithril axe, Adamant axe, Rune axe, Dragon axe"); } else { bank.depositAll(); } } break; case WALK2TREE: status = "Returning to Willows"; localWalker.walkPath(barbWillows); break; case NESTGRAB: GroundItem nest = groundItems.closest("Birds Nest"); if (nest != null && nest.exists()) { nest.interact("Take"); } case SLEEP: status = "Sleeping"; sleep(random(200, 300)); break; } return random(500, 800); } @Override public void onPaint(Graphics2D g) { g.drawString("Status: " + status, 4, 333); // This is where you will put your code for paint(s) } }
-
You can definitely do all of those things, but it's a learning curve. You should familiarise yourself with the API which is, in essence, a list of OSBot's built in functions so that you don't have to create them yourself. You can find the API here. The xp/hr, time run and items gained etc tracker is all part of what is called the 'paint'. If you want to learn to create a paint, I highly suggest the tutorial that was written by Pug. It can be found here. That will run you through how to do most of what you want to know for that part. As for the others, there are built in functions for most of it that you can use. I would love to be more helpful but I'm still very much learning myself, however, if you have any general questions I'm always happy to do what I can to lend a hand. My advise on how to begin would be start by creating a script that attacks Men and loots their bones/drops of your choice. That's a fairly simple script that would be manageable for anyone beginning to learn I believe and removes the complexities of eating and similar. As you begin to feel more comfortable, just add new elements such as eating and change the target NPC from Men to something like Lessor Demons (anything that can't immediately kill you if there's an error with the script).
-
First Script Issues, Wont enter Mining State
omni4life replied to omni4life's topic in Scripting Help
I'll definitely toy around with that and your dropping during null ore idea tomorrow when I get home. I really appreciate you and everyone else taking the time to answer simple questions for me, it's hugely helpful in wrapping my head around Java and the api