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
  • Speaking to an npc twice?


    Xero

    Recommended Posts

    Hi all,

    I'm trying to create a working tutorial bot; however, conversation cuts short when talking to the same NPC twice. This is an issue when talking to the Quest npc as you need to speak with him fully on the second conversation; however, it is cut short when I go click the ladder. Here's my code for the tutorial npc (it cuts short but isnt an issue.):

    			NPC guide = getNPCs("RuneScape Guide");
    			interactWithCharacter(guide, "Talk-to");
    			sleep(2500,5000);
    			this.getWidgets().getChildWidget(548, 39).interact();
    			sleep(2500,5000);
    			interactWithCharacter(guide, "Talk-to");
    			GameObject door = getGameObject("Door");
    			sleep(2500,5000);
    			openDoor(door);
    			sleep(2500,5000);
    			if(this.getLocalPlayer().getTile().equals(new Tile(3098,3107,0))){
    				moveCharacter(treeArea);
    				open = true;
    			}
    
    	private void interactWithCharacter(NPC npc, String interact){
    		npc.interact(interact);
    		sleepUntil(() -> npc.isInteracting(getLocalPlayer()), 15000);
    		while (this.getDialogues().canContinue() == true) {
    			log("Is in Dialogue? " + this.getDialogues().canContinue());
    			this.getDialogues().clickContinue();
    			sleep(2500, 4000);
    		}
    	}
    
    
    	private NPC getNPCs(String object) {
    		return this.getNpcs().closest(npc -> npc != null && npc.getName().equals(object));
    	}
    

    Any suggestions?

     

     

    Link to comment
    Share on other sites

    I would suggest making your code less linear and more conditional.

     

    Example:

     

     

     
    if (finishedQuestDialogue) {
        goDownLadder();
    } else {
        if (interacting with quest guy) {
            if (in dialogue) {
                do dialogue stuff;
            }
        } else {
            interact;
        }
    }
    

     

    This may not exactly answer your question, but it may help. It's a bit confusing trying to understand what your issue is, so if you could explain a bit more I can help further :)

    Link to comment
    Share on other sites

    Thanks for the help and suggestions for my overall outlook on creating this script.

    As for my solution that seems to work, I added sleep(2500,4500); after the sleepUntil in my interactingWithCharacter and it started to work correctly (perhaps the dialogue occurs too quickly for the client to catch).

    I'll be looking up what you mean by configs and see as to how i can make my bot more conditional rather than linear. 

    Link to comment
    Share on other sites

    Thanks for the help and suggestions for my overall outlook on creating this script.

     

    As for my solution that seems to work, I added sleep(2500,4500); after the sleepUntil in my interactingWithCharacter and it started to work correctly (perhaps the dialogue occurs too quickly for the client to catch).

     

    I'll be looking up what you mean by configs and see as to how i can make my bot more conditional rather than linear. 

     

    configs are 

    playerSettings().getConfig(123)

    the little progress bar you see along the bottom of the screen when on the island is a ascending number which is found in the configs, use the game debugger>player settings to see which number it is that changes.

    Link to comment
    Share on other sites

    configs are 

    playerSettings().getConfig(123)

    the little progress bar you see along the bottom of the screen when on the island is a ascending number which is found in the configs, use the game debugger>player settings to see which number it is that changes.

     

     

    EDIT: Wow, sorry, I didn't read the whole sentence.

     

    Thanks!

    Link to comment
    Share on other sites

    Instead of using sleep, i prefer  this code. It helps to prevent it from getting stuck

     

    sleepUntil(new Condition(){
    public boolean verify(){
    return (Enter what ever code you want here without parenthesis);
    }
    },Calculations.random(10000, 11000));

    Link to comment
    Share on other sites

    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.