Jump to content

How to know if I picked the item up?


Spork

Recommended Posts

So hey OSBot, even though I'll probably get called a leecher like I was in my last thread lol, I'm having another issue. I've finished my cowhide script, and it's pretty efficient. Fills an inventory in about 2 mins (~100k/hr profit), but I want to record how many of the hides I've actually picked up.

My paint includes the time ran, but I want to know how many hides I've looted in that time. How do I know if I actually picked that hide up, since 1 out of 3 hides my script goes after are looted by other people.

 

Any ideas?

Link to comment
Share on other sites

Haven't written a script here before;

 

But can't you add something along this, count how many cowhides in inventory at start; and iterate it whenever you call your pickup method and it's sucessfull +1?

 

This is what I intended on doing, but I wasn't sure if it was the best way, or even the most accurate.

Link to comment
Share on other sites

Not really, as sometimes pickup fails leaving the counter incremented without actually collecting another cowhide smile.png

 

@OP if you want a super simple way, you can make a counter and add 28 to it every time you bank. If you want to do it properly, you're going to need to, when picking up an item, check that it is added to your inventory, and only then can you increment a counter. 

 

Yeah that's what  I meant with being sucessfully picked up, so he'll have to add failsafe/checks if the script looted the cowhide & shows in inventory.

 

  • Like 1
Link to comment
Share on other sites

These questions you ask are very basic things you can figure out by checking out the API: http://osbot.org/api not only you need this but basic understanding of what your script needs to do. How can you as a legitimate player check if you picked up an item? By checking your inventory. That's what your script has to do then aswell. 

 

For your scripts I suggest you first analyze what your script has to do and how it would do these procedures. To know how to do it, just log in on runescape and to it manually. Then you can start going to the API and apply the knowledge you gathered from doing it manually and search the right method for your procedure.

Link to comment
Share on other sites

So hey OSBot, even though I'll probably get called a leecher like I was in my last thread lol, I'm having another issue. I've finished my cowhide script, and it's pretty efficient. Fills an inventory in about 2 mins (~100k/hr profit), but I want to record how many of the hides I've actually picked up.

My paint includes the time ran, but I want to know how many hides I've looted in that time. How do I know if I actually picked that hide up, since 1 out of 3 hides my script goes after are looted by other people.

 

Any ideas?

 

firstly, this isn't a tutorial. next time, post in scripting help. 

 

secondly,

GroundItem foundHide = groundItems.closest("Cowhide");
if(foundHide != null) {
    long pastHide = inventory.getAmount("Cowhide");
    if(foundHide.interact("Take")) {
        new ConditionalSleep(5000) {
             @ Override
             public boolean condition() throws InterruptedException {
                      return !foundHide.exists();
             }
        }.sleep();
        if(inventory.getAmount("Cowhide") > pastHide) {
            paintCounter++;
       }
    }
}
Edited by Imateamcape
Link to comment
Share on other sites

 

firstly, this isn't a tutorial. next time, post in scripting help. 

 

secondly,

GroundItem foundHide = groundItems.closest("Cowhide");
if(foundHide != null) {
    long pastHide = inventory.getAmount("Cowhide");
    if(foundHide.interact("Take")) {
        new ConditionalSleep(5000) {
             @ Override
             public boolean condition() throws InterruptedException {
                      return inventory.getAmount("Cowhide") > pastHide;
             }
        }.sleep();
        if(inventory.getAmount("Cowhide") > pastHide) {
            paintCounter++;
       }
    }
}

This would make him sleep even if he did not pick it up. It would be better to make a conditional on when the grounditem isn't visible anymore. 

  • Like 1
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...