PancakePuncher Posted September 19, 2016 Share Posted September 19, 2016 I am having a hard time finding a way to check if the player is inside a specific area. Anyone shed of light for me? Also, do someone have any good methods for walking/pathing? I don't need specific code, just some simple logic on whats a good way to do it? Quote Link to comment Share on other sites More sharing options...
Team Cape Posted September 19, 2016 Share Posted September 19, 2016 (edited) I am having a hard time finding a way to check if the player is inside a specific area. Anyone shed of light for me? Also, do someone have any good methods for walking/pathing? I don't need specific code, just some simple logic on whats a good way to do it? 1. Checking if player is in an area: Area a = new Area(1, 2, 3, 4); Player p = myPlayer(); if(a.contains(p)) { //'contains' in the API refers to all entities - a player is a character, which is a type of entity //do x } 2. Walking / pathing getWalking().webWalk(area or position); //or use a webwalkevent if you want webwalking figures out the pathing for you and deals with common obstacles. If you don't need to deal with obstacles, it will be less intensive to use getWalking().walk() or just a regular walkingevent. if you dont want to do either of those, use explv.github.io (website) to figure out pathing and use getWalking().walkPath(list of positions gathered from the site). Edited September 19, 2016 by Imateamcape 2 Quote Link to comment Share on other sites More sharing options...
PancakePuncher Posted September 19, 2016 Author Share Posted September 19, 2016 This works for "your" character? Because I feel like this might looked for other players as well which wouldn't be right. Does the client refer to you as the "LocalPlayer" but the issue is in the API I can only find .getLocalPlayer. Can I turn it into a variable like you stated above? Quote Link to comment Share on other sites More sharing options...
Team Cape Posted September 19, 2016 Share Posted September 19, 2016 This works for "your" character? Because I feel like this might looked for other players as well which wouldn't be right. Does the client refer to you as the "LocalPlayer" but the issue is in the API I can only find .getLocalPlayer. Can I turn it into a variable like you stated above? myPlayer() returns your own character, yes. Never others. And yes... It returns a player, hence you can say something like: Player player = myPlayer(); if(area.contains(player)) { // do something } Or if you want, you don't need to define it... if(area.contains(myPlayer())) { // do something } same thing, really Quote Link to comment Share on other sites More sharing options...
PancakePuncher Posted September 19, 2016 Author Share Posted September 19, 2016 This is what I wanted, thank you! Quote Link to comment Share on other sites More sharing options...
PancakePuncher Posted September 19, 2016 Author Share Posted September 19, 2016 myPlayer() returns your own character, yes. Never others. And yes... It returns a player, hence you can say something like: Player player = myPlayer(); if(area.contains(player)) { // do something } Or if you want, you don't need to define it... if(area.contains(myPlayer())) { // do something } same thing, really Thanks for the help, not looking to make another Thread I only have a few more questions if you don't mind. Firstly, other bot API's use "sleep" as a method to sort of pause or idle their bots. As far as I can gather is that OSBot uses "random" to do this? Am I correct? Secondly, how would I go about properly interacting with items on the ground? I want my bot to search/identify a specific item on the ground, pick it up, and then bank it. I am having a hard time figuring this out for some reason. Lastly, would it be ok to message you with any further questions I may have? Quote Link to comment Share on other sites More sharing options...
Team Cape Posted September 19, 2016 Share Posted September 19, 2016 Thanks for the help, not looking to make another Thread I only have a few more questions if you don't mind. Firstly, other bot API's use "sleep" as a method to sort of pause or idle their bots. As far as I can gather is that OSBot uses "random" to do this? Am I correct? Secondly, how would I go about properly interacting with items on the ground? I want my bot to search/identify a specific item on the ground, pick it up, and then bank it. I am having a hard time figuring this out for some reason. Lastly, would it be ok to message you with any further questions I may have? 1. random and sleep have nothing to do with each other. Script is just a type of thread - sleep stalls the thread (makes it sleep) for a random amount of time, given by an int. random returns an int, so its used to randomize the amount of time that hte bot sleeps for. 2. GroundItem g = groundItems.get(name / id); g.interact("Take"); Explore the API a little more before making scripts. It'll help. Quote Link to comment Share on other sites More sharing options...
Lemons Posted September 19, 2016 Share Posted September 19, 2016 (edited) 1. random and sleep have nothing to do with each other. Script is just a type of thread - sleep stalls the thread (makes it sleep) for a random amount of time, given by an int. random returns an int, so its used to randomize the amount of time that hte bot sleeps for. 2. GroundItem g = groundItems.get(name / id); g.interact("Take"); Explore the API a little more before making scripts. It'll help. groundItems.get(x, y) is the only "get" there is, you're probably thinking groundItems.closest(name/id). @@PancakePuncher But you should read/search the API, links at the top of the page (or here: http://osbot.org/api/ ) Edited September 19, 2016 by Lemons Quote Link to comment Share on other sites More sharing options...
Team Cape Posted September 19, 2016 Share Posted September 19, 2016 groundItems.get(x, y) is the only "get" there is, you're probably thinking groundItems.closest(name/id). But you should read/search the API, links at the top of the page (or here: http://osbot.org/api/) yeah my bad it is .closest() i had just woken up when i wrote that Quote Link to comment Share on other sites More sharing options...
PancakePuncher Posted September 19, 2016 Author Share Posted September 19, 2016 (edited) I have been using the API. Usually I have no problem finding the method I need to perform a task. I was just having a hard time determine which "Item" method checked against the items name. I was using poopbot API, but the community over there is rather dead it seems so I transitioned to here. The bots methods a somewhat similar though not entirely. Believe me though I am not asking questions until I do my own research and testing before hand. Edited September 19, 2016 by PancakePuncher Quote Link to comment Share on other sites More sharing options...