jimmmy23 Posted August 14, 2018 Posted August 14, 2018 Hey, I'm new to scripting. Something i've noticed is when using the standard someNpc.interact() and the NPC is clipped by an object like a wall or tree, someNpc.isVisible() is true, even if the NPC cannot be seen. I'm assuming this is because the NPC is on the screen but simply behind an object. Is there a method that works for object clipping or a way to move the camera so that the npc isn't clipped by anything?
Night Posted August 14, 2018 Posted August 14, 2018 I believe isVisible returns true for 30% or more of the object/npc being visible, but I'm not 100% on that. Are you feeding .interact() a String paramter so it knows what option to click?
jimmmy23 Posted August 14, 2018 Author Posted August 14, 2018 (edited) 5 minutes ago, Night said: I believe isVisible returns true for 30% or more of the object/npc being visible, but I'm not 100% on that. Are you feeding .interact() a String paramter so it knows what option to click? Yes I am. I tried completely covering the NPC with a tree/wall, and isVisible was still true. Here's an example snippet: Entity man = getNpcs().closest("Man"); man.interact("Pickpocket"); Edited August 14, 2018 by jimmmy23 Example
Night Posted August 14, 2018 Posted August 14, 2018 Could always just use getCamera().toEntity to move the camera to the man
jimmmy23 Posted August 14, 2018 Author Posted August 14, 2018 (edited) 9 minutes ago, Night said: Could always just use getCamera().toEntity to move the camera to the man Is it a bad idea to call this before every pickpocket? Or is there a way to check if the NPC is clipped by anything before calling it? Edited August 14, 2018 by jimmmy23
Night Posted August 14, 2018 Posted August 14, 2018 5 minutes ago, jimmmy23 said: Is it a bad idea to call this before every pickpocket? Probably, it might slightly adjust the camera each time. You can check the success of interact() since it returns a boolean, if it fails then just rotate camera to the npc.
jimmmy23 Posted August 14, 2018 Author Posted August 14, 2018 (edited) Deleted Edited February 23, 2023 by jimmmy23
Khaleesi Posted August 14, 2018 Posted August 14, 2018 (edited) 24 minutes ago, jimmmy23 said: Yes I am. I tried completely covering the NPC with a tree/wall, and isVisible was still true. Here's an example snippet: Entity man = getNpcs().closest("Man"); man.interact("Pickpocket"); isVisible doesn't check if an object is behind something else ... isVisible only checks if the actual entity is on the screen, no matter whats in front or behind it AS far as I know, there is no method to check what you need Edited August 14, 2018 by Khaleesi
Night Posted August 14, 2018 Posted August 14, 2018 4 minutes ago, jimmmy23 said: But it can still successfully interact with the man even when it's clipped, what exactly does the bool tell me? Is there a better documentation anywhere? it just says The boolean returns true if successfully interacted yes, if the interaction works why are you concerned about the camera?
jimmmy23 Posted August 14, 2018 Author Posted August 14, 2018 (edited) Deleted Edited February 23, 2023 by jimmmy23
Khaleesi Posted August 14, 2018 Posted August 14, 2018 (edited) 1 minute ago, jimmmy23 said: It just seems kind of bot-like to repeatedly right click through a tree to interact with something. Are there any methods that can achieve what I want? Thanks to both of you for the help btw. Not that I'm aware, I also don't think that's somehting jagex actual can check ... Edited August 14, 2018 by Khaleesi
jimmmy23 Posted August 14, 2018 Author Posted August 14, 2018 (edited) deleted Edited February 23, 2023 by jimmmy23
Khaleesi Posted August 14, 2018 Posted August 14, 2018 6 minutes ago, jimmmy23 said: Do you manipulate the camera at all in your scripts or just let the API handle it? You can manipulate the camera youself if you want or just let osbot do it for you If you make an Interactionevent yourself you can disable camera movements or player movement
jimmmy23 Posted August 14, 2018 Author Posted August 14, 2018 (edited) deleted Edited February 23, 2023 by jimmmy23
Khaleesi Posted August 14, 2018 Posted August 14, 2018 (edited) 7 minutes ago, jimmmy23 said: Do you do that in your scripts? Thanks for the help. Some of them Edited August 14, 2018 by Khaleesi