Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Looking for help understandig the docs and with sleepUntil().


    Sophisticated

    Recommended Posts

    Posted

    Hi guys, yesterday I wrote a simple script that picked wheat and banked it.

    I noticed some things that weren't really optimal. Like when he walks to pick some wheat, he spam clicks a bit to much.

    That should be easy to fix with something like sleepUntil() (if I'm correct).

     

    Now I also noticed that most of the times the script would be picking wheat with left click, but sometimes it would use right click.

    But besides using right click, it right clicks 2-3 times in a row and sometimes misses them all.

    I guess this is some form of anti ban, but it happened a bit to much to my likings.

     

    Right now I'm testing my goblin killer script, I think the script kills the goblins to fast.

    Like he kills one and immediately goes to attack the other.
    I want a bit control over this, at the moment the script looks like this: https://pastebin.com/pjZtBPKp

    Is someone willing to help me out how to fix my problem? So adding a counter or something like that, so the script waits a bit before continuining.

     

    Now regarding my questions, I've a hard time understanding the docs and I'm curious if there is a search function in it?

    I'm also curious about how I would know for example, how to attack a NPC.

    Yesterday I first thought a NPC was just a gameobject, but I quickly found out it wasn't.

    I've looked up some code of other people so I would understand that I should first

    get a reference to a NPC and then interact with it and then choose "Attack".

    But without the snippets of code I found on the forums, I wouldn't know.

     

    So could someone explain the process of 'understanding/knowing' what to do with the docs, in order to find out what you have to type, so you can do an action in runescape.

     

    I'm also curious about how sleepUntil() works, I saw some code that looked like this sleepUntil(()-> .....).

    I guess that has something to do with lambda's right?

     

    I hope someone can help me out!

     

    TL;DR;

    Since my story/question is a bit messy, here's a TL;DR;

    - Does the docs have a search function?

    - Let's say I want to learn how to change my spell in my spellbook, how would I do that using the docs?

    - Is this code I've seen a few times a lambda: sleepUntil(()-> .....) ?

    Posted

    a easy way of saying what sleepUntil does is  just the same as sleep until the boolean is true so for examle

     

    SleepUntil(() -> getBank().isOpen(), 5000);

     

    this will sleep untill the bank is open or 5 seconds has passed if after 2 seconds the bank is open  then it wil move onto the next line

     

    a quick/easy fix i would suggest for you're wheat picking problem would be

     

    int wheat = getInventory().count("Wheat");

    (you're wheat picking up method)

    sleepUntil(() -> wheat != getInventory().count("Wheat"), a random amount of waiting time here);

     

    basicly what this does is before you perform the wheat picking action you save the amount of wheat in you're inventory so if you're current amount in inventory is not the same as it was after picking up wheat it means you have succesfully picked up the wheat which wil make the wheat != getInventory().count("Wheat"); result true

     

    (this is by no ways a perfect/the best way of doing it but its a easy example)

    Posted

    - Does the docs have a search function?

    yes 

    lrW63nS.gif

     

    - Let's say I want to learn how to change my spell in my spellbook, how would I do that using the docs?

    search for 'Spell' and search around

     

    - Is this code I've seen a few times a lambda: sleepUntil(()-> .....) ?

    lamda expressions. google this

     

    different way of doing sleepUntil

    sleepUntil(new Condition{

              . . . .

    });


    http://www.dummies.com/programming/java/how-to-use-lambda-expressions-in-java-8/

    Posted

    a easy way of saying what sleepUntil does is  just the same as sleep until the boolean is true so for examle

     

    SleepUntil(() -> getBank().isOpen(), 5000);

     

    this will sleep untill the bank is open or 5 seconds has passed if after 2 seconds the bank is open  then it wil move onto the next line

     

    a quick/easy fix i would suggest for you're wheat picking problem would be

     

    int wheat = getInventory().count("Wheat");

    (you're wheat picking up method)

    sleepUntil(() -> wheat != getInventory().count("Wheat"), a random amount of waiting time here);

     

    basicly what this does is before you perform the wheat picking action you save the amount of wheat in you're inventory so if you're current amount in inventory is not the same as it was after picking up wheat it means you have succesfully picked up the wheat which wil make the wheat != getInventory().count("Wheat"); result true

     

    (this is by no ways a perfect/the best way of doing it but its a easy example)

    Thanks for the explanation, this definitely helped me out!

     

    - Does the docs have a search function?

    yes 

    lrW63nS.gif

     

    - Let's say I want to learn how to change my spell in my spellbook, how would I do that using the docs?

    search for 'Spell' and search around

     

    - Is this code I've seen a few times a lambda: sleepUntil(()-> .....) ?

    lamda expressions. google this

     

    different way of doing sleepUntil

    sleepUntil(new Condition{

              . . . .

    });

    http://www.dummies.com/programming/java/how-to-use-lambda-expressions-in-java-8/

     

    Thanks for your reaction.

    The searching function is quite handier then just searching from the standard left bar, but it would be better if I could just type something in and search for it.

    I've searched for spell, trying to figure it out. But I can't seem to find my way of learning how to change a spell in the spellbook.

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.