June 9, 20205 yr Hi I am trying to figure out how to get the current RS2Object that the bot is interacting with. I am looking for something like; myPlayer().isInteracting(getObjects().closest(getObjects().getAll()); If someone knows a way to do this, feel free to comment
June 9, 20205 yr Hey pigfarmer, I don't know if this works public RS2Object something() { for (RS2Object x:getObjects().getAll()) { if (myPlayer().isInteracting((org.osbot.rs07.api.model.Character<?>) x)){ return x; } } return null; } Also you might want to put questions in https://osbot.org/forum/forum/249-scripting-help/ not https://osbot.org/forum/forum/251-snippets/
June 9, 20205 yr Author 1 hour ago, Nbacon said: Hey pigfarmer, I don't know if this works public RS2Object something() { for (RS2Object x:getObjects().getAll()) { if (myPlayer().isInteracting((org.osbot.rs07.api.model.Character<?>) x)){ return x; } } return null; } Also you might want to put questions in https://osbot.org/forum/forum/249-scripting-help/ not https://osbot.org/forum/forum/251-snippets/ This dose not work unfortunately:( It seems like you can not cast a RS2Object to a Character Anyone else that knows who this could be done???
June 9, 20205 yr Author 11 minutes ago, Nbacon said: what are doing? does it it have an inteface or animation? I just want to know if the bot is interacting with a object and if so, what is the object?
June 12, 20205 yr On 6/9/2020 at 3:08 PM, pigfarmer said: I just want to know if the bot is interacting with a object and if so, what is the object? Try this Entity interacting = myPlayer().getInteracting(); if (interacting != null) { if (interacting instanceof RS2Object) { RS2Object object = (RS2Object) interacting; } else if (interacting instanceof NPC) { NPC npc = (NPC) interacting; } }
February 5, 20214 yr On 6/12/2020 at 9:03 AM, BravoTaco said: Try this Entity interacting = myPlayer().getInteracting(); if (interacting != null) { if (interacting instanceof RS2Object) { RS2Object object = (RS2Object) interacting; } else if (interacting instanceof NPC) { NPC npc = (NPC) interacting; } } Did this work?
Create an account or sign in to comment