Jump to content

How to know if I picked the item up?


Recommended Posts

Posted

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?

Posted

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.

Posted

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
Posted

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.

Posted (edited)

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
Posted

 

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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