Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Is there a more efficient way to handle dialogue whilst incorporating random sleep intervals?

Featured Replies

Just started on a Romeo and Juliet script and I was wondering if there was a more efficient way to write a dialogue handler?

When interacting with NPCs, I'm adding each specific dialogue option manually when required and then calling another Method to get through the regular ("Click to continue") dialogue. This is how my script looks so far:

    @Override
    public int onLoop() throws InterruptedException {
    	Position julietHouse = new Position(3159, 3425, 1);
    	WebWalkEvent walkToJuliet = new WebWalkEvent(julietHouse);
    	walkToJuliet.setMinDistanceThreshold(1);
    	Area romeo = new Area (3209, 3422, 3215, 3425);
    	if (!romeo.contains(myPlayer())) {
    	log("Walking to Romeo");
    	getWalking().webWalk(romeo.getRandomPosition());
    	}
    	log("Starting quest...");
    	npcs.closest("Romeo").interact("Talk-to"); 
    	new ConditionalSleep(5000) {
            @Override
            public boolean condition() throws InterruptedException {
                return getDialogues().inDialogue();
            }
            }.sleep();
    	randSleep();
    	getThroughDialogue();
    	getDialogues().selectOption(1);
    	randSleep();
    	getThroughDialogue();
    	getDialogues().selectOption(1);
    	randSleep();

My getThroughDialogue method:

	public void getThroughDialogue() throws InterruptedException {
		for (getDialogues().isPendingContinuation(); getDialogues().clickContinue() ; randSleep());
		}

Is there a better/cleaner way to navigate dialogue while implementing sleeps? I'm really enjoying writing this quest script and I figured I should learn now as I'm planning to make several more. 

I saw in the API there is a completeDialogue method but I wasn't confident on how to use it, and wanted to add my own random interval sleeps during the dialogue to simulate a player reading the text.

Note: my getThroughDialogue method works fine when I run it but it's my first time using a for loop so it may be incorrect

I recommend going to the api, and googling that api with"site:osbot.org" attached at the end. there is an api that if you have an array of dialogues you want the bot to read through, it will. issues with this is if you have more complex dialogues to go through that each question has to be answered which iirc, RandJ does not have. i dont have the code on hand for what you want but the api will be something of:

getDialogues().completeDialogues(String ... ArrayOfDiags)
  • Author
2 hours ago, popshopadop said:

I recommend going to the api, and googling that api with"site:osbot.org" attached at the end. there is an api that if you have an array of dialogues you want the bot to read through, it will. issues with this is if you have more complex dialogues to go through that each question has to be answered which iirc, RandJ does not have. i dont have the code on hand for what you want but the api will be something of:

getDialogues().completeDialogues(String ... ArrayOfDiags)

Great tip thank you, I'll look into this and search the api + site:osbot.org in future ❤️

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.