Jump to content

Pick Item Up From Ground


vexumy

Recommended Posts

I am learning how to script with OSBot and am having a small problem. I am writing a hunter script that catches birds currently. The part of the script to lay a bird snare works, but the issue is picking up the snare. If the snare is caught, I am trying to Check the bird snare, and then lay the snare from the inventory. If the snare fails, dismantle it and then lay it. If the snare times out, dismantle it and then lay it. I can't quite find out a way to pick up the bird snare off of the ground. I have tried GameObject because the snare counts as a GameObject. I have tried to check the tile it is on, and then if it is valid, and then convert it to string, and then check if it contains "Check" for the snare option. Nothing I am writing has worked and i've tried loads of things. Anything that points me towards the right direction is appreciated. I think i'm just over thinking it.

EDIT: So I found out how to actually pick up the bird snare, but I don't know how to set the coordinate for the tile to place it at the exact tile every time. Any help with that? 

Edited by vexumy
Link to comment
Share on other sites

If you want to place it in the same tile you took it from you can store the position before you pick it up like this

GroundItem groundItem;
Position itemPosition;
groundItem = getGroundItems().closest(e -> e != null && e.getName().contains("Bird snare"));
if(groundItem != null) {
    itemPosition = groundItem.getPosition();
    groundItem.interact("Take");
}

Or you can make an array of positions around your character when the script starts and check to see if there is a snare in them with RS2Object getPosition() on nearby snares. You would also want to track which snares were yours incase someone started laying traps in your positions.

Edited by Cloxygen
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...