senpai jinkusu
Members-
Posts
22 -
Joined
-
Last visited
-
Feedback
0%
Profile Information
-
Gender
Male
Recent Profile Visitors
684 profile views
senpai jinkusu's Achievements
Bronze Poster (2/10)
1
Reputation
-
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
-
Im still pretty new when it comes to osbot scripts ( and rs bots in general) but I'll definitely keep that in mind
-
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
-
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
-
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
-
how do you interact with objects such as furnaces
senpai jinkusu replied to senpai jinkusu's topic in Scripting Help
Nifty, I will look further into this when I get the chance -
how do you interact with objects such as furnaces
senpai jinkusu replied to senpai jinkusu's topic in Scripting Help
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; -
how do you interact with objects such as furnaces
senpai jinkusu replied to senpai jinkusu's topic in Scripting Help
is that what i type as the argument then? -
how do you interact with objects such as furnaces
senpai jinkusu replied to senpai jinkusu's topic in Scripting Help
I am almost sure im using the correct one https://gyazo.com/3283400a03e61ea57100240ab3cd20c1 -
how do you interact with objects such as furnaces
senpai jinkusu replied to senpai jinkusu's topic in Scripting Help
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? -
how do you interact with objects such as furnaces
senpai jinkusu replied to senpai jinkusu's topic in Scripting Help
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 -
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?
-
getItems(); throws NullPointerException
senpai jinkusu replied to senpai jinkusu's topic in Scripting Help
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]))); -
getItems(); throws NullPointerException
senpai jinkusu replied to senpai jinkusu's topic in Scripting Help
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 -
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