Jump to content

Mysteryy

Scripter II
  • Posts

    2568
  • Joined

  • Last visited

  • Days Won

    3
  • Feedback

    100%

Everything posted by Mysteryy

  1. He means why are you doing this: npc.getName().contains("Cow") && !npc.getName().contains("Dairy") && npc != null null checking npc after you call npc.getName is pointless. If there is an NPE you will get it on npc.getName, and thus null checking after you call a method from that object is pointless. The NPE will not be avoided at all.
  2. Make a filter for it. A filter will basically only accept npcs that meet a specific criteria, i.e. the cow is not under attack. There might be something in the api for this already, but this is a way you can do it without an api method.
  3. Try to be more specific? Maybe post your code? Im guessing you didn't add a manifest or something of that nature.
  4. Oh yea, dropAll is a slow action. There isnt a way to fix it that I know of other than writing your own method.
  5. If im understanding you, you are asking if its necessary to have: if(inventory.isFull()) { return State.DROP; } and then again have this: case DROP: if(inventory.isFull()) { inventory.dropAllExcept("Small fishing net"); } break; ? If that is your question, then its not really necessary. What you are doing could be called "Defensive programming". Basically its checking the crap out of everything to make sure that its what you want, which prevents any unwanted results or nulls etc. I am not a fan of state based scripting, I always use task based. Case gets too messy imo, but thats just me. ^_^
  6. Either way. If you make that enum one time, you can just call it from the enum each time you need that area. I keep all of my scripts in the same project, that way I can reuse every bit of my custom API code, web walker, etc. and I never have to rewrite code for any script twice if I have already written it. Then when I compile, I just compile the one script class that I want to submit. ^_^
  7. I think you have a misunderstanding of the concept of reuse. Enums are made exactly for things such as this.
  8. Mysteryy

    2 Questions

    That's not how it works. The person who accepted it would put 100 percent of the blame on alek and say the bot is bad and got him banned.
  9. Mysteryy

    2 Questions

    Scripters can make random solvers last I checked. Making random solvers is a big time sink and they will never be 100 percent. There are a ton if higher priority items that should and are being addressed first. Would you rather the bot ignore randoms, or would you rather come back to find out your stuck in a random?
  10. See this post I made, it should help you out. It basically has everything you are looking for, you can just change the area implementation. http://osbot.org/forum/topic/64420-banking-enum-with-areas-and-methods/#entry707698
  11. Should just be able to call super() and then add the additional file output afterwards (inside of the overridden log method).
  12. Fair enough. Im not disagreeing with you necessarily I am just saying it is a safe assumption if you are familiar with the api here. Where I work I write alot of code documentation, and I will always specify something like you stated, "otherwise returns null". For the scope of OSBot, its pretty safe to assume that it will be null though. ^_^
  13. Why should it mention that? If you ever try to get an object, interface, npc, or anything else, assume that if its not there it will return null. That is the only logical thing for a method to return when it is supposed to return an object and it fails.
  14. I went to a Linkin park/incubus concert a couple of years back. They both performed really well, I am sure you will like it. ^_^
  15. Its just the way I like to do things. I dont like to depend on things if I dont have to. Just my personal preference, not saying its bad to use the API. :P
  16. The less that you can rely on the API the better. Making your own banking enum will abstract this from the api and make it more reusable.
  17. Hey i had to make the files. Thats alot of work. xD
  18. Since Novak is a lazy bum I made a banking enum. I needed this for my web walker anyway. Banking enum (with areas): Useful methods inside of a banking class that use the enum: You can use the methods in something like this: /** * Created by zach on 1/5/15. */ @ScriptManifest(name = "Test", author = "Mysteryy", info = "Testing", version = 1.0, logo = "none") public class Test extends Script { Banking banking = new Banking(); @Override public void onStart(){ Player player = myPlayer(); if(player != null){ this.log(banking.getNearestBankArea(player.getPosition()).getMinX() + ", " + banking.getNearestBankArea(player.getPosition()).getMaxY()); this.log(banking.getNearestBankCentralPosition(player.getPosition()).getX() + ", " + banking.getNearestBankCentralPosition(player.getPosition()).getY()); this.log(BankAreas.DRAYNOR.getCentralPosition().getX() + ", " + BankAreas.DRAYNOR.getCentralPosition().getY()); this.log(BankAreas.DRAYNOR.areaContainsPosition(player.getPosition())); } } @Override public int onLoop() throws InterruptedException { return 50; } } which would output [iNFO][bot #1][01/14 10:35:12 PM]: 3092, 3246 [iNFO][bot #1][01/14 10:35:12 PM]: 3093, 3243 [iNFO][bot #1][01/14 10:35:12 PM]: 3093, 3243 [iNFO][bot #1][01/14 10:35:12 PM]: true Let me know if you have any questions or suggestions.
  19. The methods I make are the ones you need. No more no less. Mysteryy knows what you need better than you do. Trust me I'm not a doctor.
  20. Yea but that could add tiles that are actually outside of the bank. Xd
×
×
  • Create New...