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.

Dialogue help?

Featured Replies

Trying to make a Range Guild script, but the dialogue seems to be messing up on me. Here's what I have:

                NPC judge = npcs.closestThatContains("Competition Judge");
                if (!getInventory().contains("Bronze Arrow") && !getEquipment().contains("Bronze Arrow"))
                    judge.interact("Talk-to");
                    getDialogues().clickContinue();
                    sleep(1500);
                    getDialogues().selectOption("Sure, I'll give it a go.");
                    sleep(1500);
                    getDialogues().clickContinue();
                    sleep(1000);

It just loops back to "Talk-to" and clicks continue once, then restarts again and talks to the judge. A never ending cycle. I tried removing the if statement and even adding another but it didn't work. Can't test the latter part of my script because I can't even get passed the dialogue portion, lol. Help?

Trying to make a Range Guild script, but the dialogue seems to be messing up on me. Here's what I have:

                NPC judge = npcs.closestThatContains("Competition Judge");
                if (!getInventory().contains("Bronze Arrow") && !getEquipment().contains("Bronze Arrow"))
                    judge.interact("Talk-to");
                    getDialogues().clickContinue();
                    sleep(1500);
                    getDialogues().selectOption("Sure, I'll give it a go.");
                    sleep(1500);
                    getDialogues().clickContinue();
                    sleep(1000);

It just loops back to "Talk-to" and clicks continue once, then restarts again and talks to the judge. A never ending cycle. I tried removing the if statement and even adding another but it didn't work. Can't test the latter part of my script because I can't even get passed the dialogue portion, lol. Help?

 

you need to change the structure, it isn't a very efficient way of doing it.

 

NPC judge = npcs.closestThatContains("Competition Judge");

         if(judge != null) {
             if (!getInventory().contains("Bronze Arrow") && !getEquipment().contains("Bronze Arrow")) {
                 if(getDialogues().isPendingContinuation()) {
                     getDialogues().clickContinue();
                     sleep(850);
                 }
                 else if(getDialogues().inDialogue()) {
                      getDialogues().selectOption("Sure, I'll give it a go.");
                      sleep(850);
                 } else {
                      judge.interact("Talk-to");
                 }
            }
         }

Edited by Precise

Even with that, don't use a static wait time. That's a sure sign of a bot. At least randomize your sleep time.

 

that's up for him to do ;)

  • Author

Even with that, don't use a static wait time. That's a sure sign of a bot. At least randomize your sleep time.

 

 

 

you need to change the structure, it isn't a very efficient way of doing it.

 

NPC judge = npcs.closestThatContains("Competition Judge");

         if(judge != null) {
             if (!getInventory().contains("Bronze Arrow") && !getEquipment().contains("Bronze Arrow")) {
                 if(getDialogues().isPendingContinuation()) {
                     getDialogues().clickContinue();
                     sleep(850);
                 }
                 else if(getDialogues().inDialogue()) {
                      getDialogues().selectOption("Sure, I'll give it a go.");
                      sleep(850);
                 } else {
                      judge.interact("Talk-to");
                 }
            }
         }

 

 

Worked, thanks :D Changed to this now, hope I did the sleeping right:

                NPC judge = npcs.closestThatContains("Competition Judge");
                if(judge != null) {
                    if (!getInventory().contains("Bronze Arrow") && !getEquipment().contains("Bronze Arrow")) {
                        if(getDialogues().isPendingContinuation()) {
                            getDialogues().clickContinue();
                            sleep(MethodProvider.gRandom(400, 850));
                        }
                        else if(getDialogues().inDialogue()) {
                            getDialogues().selectOption("Sure, I'll give it a go.");
                            sleep(MethodProvider.gRandom(400, 850));
                        } else {
                            judge.interact("Talk-to");
                        }
                    }
                }

Might I ask why I always see if (  != null ) in scripts? What is it significant about that condition? Can't it just not be used with the same outcome?

Worked, thanks biggrin.png Changed to this now, hope I did the sleeping right:

                NPC judge = npcs.closestThatContains("Competition Judge");
                if(judge != null) {
                    if (!getInventory().contains("Bronze Arrow") && !getEquipment().contains("Bronze Arrow")) {
                        if(getDialogues().isPendingContinuation()) {
                            getDialogues().clickContinue();
                            sleep(MethodProvider.gRandom(400, 850));
                        }
                        else if(getDialogues().inDialogue()) {
                            getDialogues().selectOption("Sure, I'll give it a go.");
                            sleep(MethodProvider.gRandom(400, 850));
                        } else {
                            judge.interact("Talk-to");
                        }
                    }
                }

Might I ask why I always see if (  != null ) in scripts? What is it significant about that condition? Can't it just not be used with the same outcome?

 

well if the NPC isn't there it will return null, and when you invoke the method judge.interact("Talk-to") it will throw a null pointer error.

  • Author

well if the NPC isn't there it will return null, and when you invoke the method judge.interact("Talk-to") it will throw a null pointer error.

 

Got it :) I've tried it on my own, and everything runs smooth now except for the part where it has to close the new interface that opens once an arrow is fired. Here's the new code:

                if(judge != null) {
                    if (!getInventory().contains("Bronze Arrow") && !getEquipment().contains("Bronze Arrow")) {
                        if(getDialogues().isPendingContinuation()) {
                            getDialogues().clickContinue();
                            sleep(MethodProvider.gRandom(400, 850));
                        }
                        else if(getDialogues().inDialogue()) {
                            getDialogues().selectOption("Sure, I'll give it a go.");
                            sleep(MethodProvider.gRandom(400, 850));
                        } else {
                            judge.interact("Talk-to");
                        }
                    }
                }
                while (getInventory().contains("Bronze Arrow")) {
                    getEquipment().equip(EquipmentSlot.ARROWS, "Bronze Arrow");
                }
                while (getEquipment().isWearingItem(EquipmentSlot.ARROWS, "Bronze Arrow")) {
                    Targets.interact("Fire-at");
                    sleep(MethodProvider.gRandom(600, 1250));
                    getInterfaces().closeOpenInterface();
                }

I tried using interfaces, Interfaces, getInterfaces().getOpenInterfaces().close()

 

Anything I could think of. Do I have to create a static variable for the open interface, and add .close() to it or something?

You could do it several ways:

  1. Interact with the interface child when its parent becomes visible
  2. Close the open interface using the default methods when the interface becomes visible

#2 is the easiest and can be done like so: 

interfaces.closeOpenInterface();

Of course these will both require checks that the interface is visible + not null before interacting with them.

I added a method in the dialogues class for completing a dialogue with the specified actions, just so it's easier.

 

Might I ask why I always see if (  != null ) in scripts? What is it significant about that condition? Can't it just not be used with the same outcome?

Instance variables don't hold the object itself but instead a pointer to the objects data out on the heap. If that variable is pointing to nothing it will contain a "null" reference and throw NullPointerExceptions if you try to use the object it's pointing (or not, in this case) to. The variable itself just contains an empty pointer.

 

I would recommend reading this: http://osbot.org/forum/topic/47833-java-pass-by-value/

  • Author

You could do it several ways:

  1. Interact with the interface child when its parent becomes visible
  2. Close the open interface using the default methods when the interface becomes visible

#2 is the easiest and can be done like so: 

interfaces.closeOpenInterface();

Of course these will both require checks that the interface is visible + not null before interacting with them.

 

Like so?

if (interfaces.getOpenInterface().isVisible() && interfaces.getOpenInterface() != null)
                        interfaces.closeOpenInterface();

Tested and it returns an error :/ I might just try the parent/child method but I'll have to look at the API because I know nothing about that lol

You shouldn't be relying on static sleeps to get you to the next dialogue. If it takes any longer than 1500ms to the next dialogue, your script will fail. What if the mouse misclicks? What if you're connected to a laggy server? 

 

 

 

  • Author

You shouldn't be relying on static sleeps to get you to the next dialogue. If it takes any longer than 1500ms to the next dialogue, your script will fail. What if the mouse misclicks? What if you're connected to a laggy server? 

 

Eric had mentioned that so I changed the script to be random sleep times smile.png If I did something wrong with the new sleep times please let me know:

         if(judge != null) {
                    if (!getInventory().contains("Bronze Arrow") && !getEquipment().contains("Bronze Arrow")) {
                        if(getDialogues().isPendingContinuation()) {
                            getDialogues().clickContinue();
                            sleep(MethodProvider.gRandom(400, 850));
                        }
                        else if(getDialogues().inDialogue()) {
                            getDialogues().selectOption("Sure, I'll give it a go.");
                            sleep(MethodProvider.gRandom(400, 850));
                        } else {
                            judge.interact("Talk-to");
                        }
                    }
                }
                while (getInventory().contains("Bronze Arrow")) {
                    getEquipment().equip(EquipmentSlot.ARROWS, "Bronze Arrow");
                }
                while (getEquipment().isWearingItem(EquipmentSlot.ARROWS, "Bronze Arrow")) {
                    Targets.interact("Fire-at");
                    sleep(MethodProvider.gRandom(600, 1250));
                    getInterfaces().closeOpenInterface();
                }

Still getting the interface issue, just sits there when the results of the arrow pop up. Perhaps it's not recognized as an interface? Idk

Edited by igetbanned

Guest
This topic is now closed to further replies.

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.