Jump to content

senpai jinkusu

Members
  • Posts

    22
  • Joined

  • Last visited

  • Feedback

    0%

Everything posted by senpai jinkusu

  1. noob question, i thought you couldn't instantiate interfaces, so why is this allowed? edit: nvm it's an anon class so im guessing java understands it's a class and not a filter, i did not know this functionality was possible as my understanding of anon class is somehwat limited
  2. Im still pretty new when it comes to osbot scripts ( and rs bots in general) but I'll definitely keep that in mind
  3. if i instantiate it like so ent= getObjects().closest(new Area(...,tree id); and it is not null, i chop it, it respawns, will this still be valid
  4. this is off topic but i also have another question and i dont want to make another topic, are references to entities still valid after the entity changes (ie. when you chop down a tree and becomes a tree stump that entity changes) , so basically if i could still interact with the same tree instance after it respawns
  5. this was driving me nuts lol, i could not get the bot to find my script, until i figured out it only allows up to 1 local script, so i just deleted the other jar i had in there
  6. Nifty, I will look further into this when I get the chance
  7. i don't know where this was discussed, also not even this seems to work so i think all hope is lost for this method lol. for now i will stick with the following code mouse.move(260,410); mouse.click(true); mouse.click(253,460,false); isSmelting = true;
  8. I am almost sure im using the correct one https://gyazo.com/3283400a03e61ea57100240ab3cd20c1
  9. ill give that a try, however the widget doesn't seem to be working, this is my code for steel bars RS2Widget smeltMenu = widgets.get(311,30); if(smeltMenu != null && smeltMenu.isVisible()) smeltMenu.interact("Smelt 10"); i can successfully interact with the furnace, however it doesn't interact with the steel bar widget, is there anything I could be missing?
  10. thanks! one more question, how do i check if the player is currently performing the action stated by the widget, ie. if i smelt 10 bars how can i check if the action was completed?, or if the player is currently smelting ( i could simply make a routine to count for the items created in the inventory but is there an easier way?) edit: ill just store in a boolean to see if the player is currently smelting for now
  11. i know how to do simple interaction with entity.interact(); however how would you interact with entities such as a furnace that bring up a menu afterwards?
  12. you know im glad you mentioned the getInventory function, whenever i use just "inventory" it will return the correct number of ores on the first cycle then the next 3 it returns 0, either way here is the final code minus the removal of generics <T extends ItemContainer>int getOreCount ( T itemContainer, int... IDs) { if (itemContainer != null) return (int)itemContainer.getAmount(IDs); return 0; } public int onLoop() throws InterruptedException { log(Integer.toString(getOreCount(getInventory(),IDs[0],IDs[1]))); return random(200, 300); } which so far is working fine and ended up being way more efficient than the old code, although Im not sure if checking for a null ItemContainer reference is necessary since that never seems to be the case, tho i suppose if i don't need to check if it's null i could just narrow it down to log(Long.toString(getInventory().getAmount(IDs[0],IDs[1])));
  13. I think my misunderstanding was thinking of the ItemContainer as an interface rather than a class, so I was only limited to those methods explicitly stated by the API under a given child class, so does this mean I can call any ItemContainer method and expect a relevant result?, also that link cleared a lot of things up for me as well
  14. http://osbot.org/api/org/osbot/rs07/api/Inventory.html the Inventory subclass doesn't override the ItemContainer's "getItemInSlot" abstract method, meaning it's always gonna use the same method definedd in the parent class
  15. that's the whole point of me using generics , T is a type parameter, meaning it can be any type that extends ItemContainer that way inventory.getItems(); or bank.getItems(); could be replaced with: (note the T would be replaced by a variable such as "foo",etc) T.getItems(); one last note, this seems to work with generics , however getItems always seems to default to 1 when i use the bank instance
  16. this just worked without generics, ill try with generics this time and see the results, it seems that empty inventory slots are null rather than a default value, never thought of that this is where I am confused, if you call the getItems method from the upperClass what are you checking exactly?(inventory,bank,etc) , also how can i call the getItems method from the itemContainer superClass if one can't instantiate an abstract class? the only way is to use one of the subclass methods
  17. if im checking the amount of coal in the players bank , players inventory ,etc then i would just have to call getOres(arg0, ItemContainer subclass)
  18. before it threw the exception the client would crash and recursively print errors and I'm sure it led to an npe, which let me know what exception to catch here's the complete code: http://pastebin.com/hTznFb8C here's the stack trace: https://gyazo.com/92cc578ca49b9137652665f9c3479bd4 not sure yet, not sure how it could be null either
  19. //can anyone explain how to fix my code? <T extends ItemContainer> int getOreCount (int mode,T itemContainer) { try { Item Items [] = itemContainer.getItems(); .... .... return oreCount; } catch (NullPointerException e) { log("NullPointerExeption"); } return -1; } //thanks in advance
×
×
  • Create New...