Jump to content

elemt

Members
  • Posts

    16
  • Joined

  • Last visited

  • Feedback

    0%

Profile Information

  • Gender
    Male

Recent Profile Visitors

741 profile views

elemt's Achievements

Newbie

Newbie (1/10)

1

Reputation

  1. It does get logged and yea I know I'm permanently setting it right now
  2. The put() method in a map replaces the old value for an existing key.
  3. I updated my run() method in a previous post. Here it is again. I am getting a new RS2Object TimerTask task = new TimerTask() { @Override public void run() { int x = rock.getX(); int y = rock.getY(); List<RS2Object> objects = getObjects().get(x, y); for(RS2Object obj : objects) { if(obj.getName().equals("Rocks")) { log("get's here"); rockMap.put("rock", obj); break; } } rockMap.put("mineable", true); } };
  4. I do get a new object. After the timertask executes and the run() is invoked, I get a new rock instance and put it in the map
  5. sleep(random(350,450)); for(final Map<String, Object> rockMap : rockDetailsList) { Well I added a sleep before checking if they're mineable and it works sometimes. I don't know why it doesn't every time
  6. What do you mean by refreshing the cache? I added this to my code to put a new RS2Object in my list but it's still returning false for the interact() method. Once the TimerTask run() executes it should update the map key "rock" with a new rock. private void mineOre() { for(final Map<String, Object> rockMap : rockDetailsList) { if((boolean) rockMap.get("mineable")) { final RS2Object rock = (RS2Object) rockMap.get("rock"); boolean interacted = rock.interact("Mine"); log("Mining: " + interacted); rockMap.put("mineable", !interacted); canMine = false; TimerTask task = new TimerTask() { @Override public void run() { int x = rock.getX(); int y = rock.getY(); List<RS2Object> objects = getObjects().get(x, y); for(RS2Object obj : objects) { if(obj.getName().equals("Rocks")) { rockMap.put("rock", obj); break; } } rockMap.put("mineable", true); } }; new Timer().schedule(task, 6500); return; } } }
  7. Hi again, I have the following code for a simple powerminer that I'm making. It works and mines the first set of ores. After the ores respawn, my mineOre() method is invoked but the RS2Object.interact("Mine") returns false. Why is it working the first time and not the second?
  8. Thank you! I did this to get cardinal direction ores around my player. @SuppressWarnings("unchecked") private void filterRocks() { this.rocks = getObjects().filter(new Filter<RS2Object>() { @Override public boolean match(RS2Object v) { if(v instanceof InteractableObject) { if(((InteractableObject)v).getName().equals("Rocks")) { int myX = myPlayer().getX(); int myY = myPlayer().getY(); int rockX = v.getX(); int rockY = v.getY(); return (Math.abs(myX - rockX) == 1 && myY == rockY) || (Math.abs(myY - rockY) == 1 && myX == rockX); } } return false; } }); }
  9. How can I get a list or array of InteractableObjects that are around my player?
  10. I did not. Thank you, that fixed it!
  11. I made a script and exported the jar file. I placed it in the OSBot/scripts directory, ran OSBot and hit refresh on my scripts. The script won't show up and the console output in OSBot shows 'Loaded 0 local scripts and 0 custom random solvers!' when I click the refresh option. Is is checking in the wrong directory somehow? Can I change or verify the location it's searching for my script?
  12. I'll try that. Another thing I was thinking of was checking my player's HP before and after the knockout. How do I get my player's HP with this API? I'm new at OSBot.
  13. I'm trying to make a script for blackjacking menaphite thugs. After I create an npc object, I need to do npc.interact("Knock-out"). The problem is that the knock-out can fail. How can I detect when I have successfully knocked out the NPC and when I need to atempt knock-out again?
×
×
  • Create New...