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.

Help assigning a Method value to a String

Featured Replies

Trying to assign the value of the Method clueTask() to the String clueTask and have it log to the console using log(clueTask);

private String clueTask = clueTask();
private String clueTask() {
    RS2Widget clueTaskAnagram = (RS2Widget) getWidgets().get(203,2);
    return clueTaskAnagram.getMessage();
}

Widget IDs change.

You should always check for != null and .isVisible() for widgets before grabbing details fromthem.

Perhaps a better naming scheme?

 

Clues have IDs. I suggest using them rather than trying to figure out which clue is what from the interface. I'd also suggest either starting with a simpler script, or stopping and learning basic java before trying to progress onto something this 'advanced'. It'll save you a lot of hassle 😛

 

Edited by HeyImJamie

  • Author
 
 
 
2
2 hours ago, HeyImJamie said:

Clues have IDs. I suggest using them rather than trying to figure out which clue is what from the interface. I'd also suggest either starting with a simpler script, or stopping and learning basic java before trying to progress onto something this 'advanced'. It'll save you a lot of hassle 😛

 

All beginner clues got ID 23182 and model ID 37162.

Yes, I might have been too ambitious making a clue solver as one of my first Scripts however, I have learned a lot from what I've got so far.

Unfortunately, the way I wanted to structure the script is not working out for me.

I was planning on opening the clue and grabbing the Message from the widget and applying it to a variable that I want to use in a switch() to complete the task.

I came up with the following code for my onLoop() but it's not working.

@Override
public int onLoop() throws InterruptedException {
    
    String clue = clueTask();
    
    if(clue == null) {
        getClueTask();
    } else if(clue != null) {
        switch (clue) {
            case xyz:
                //complete task
                break;
            case xyz:
                //complete task

        }
    }

    return 3000;
}
16 minutes ago, Vogelbekdier said:

All beginner clues got ID 23182 and model ID 37162.

Yes, I might have been too ambitious making a clue solver as one of my first Scripts however, I have learned a lot from what I've got so far.

Unfortunately, the way I wanted to structure the script is not working out for me.

I was planning on opening the clue and grabbing the Message from the widget and applying it to a variable that I want to use in a switch() to complete the task.

I came up with the following code for my onLoop() but it's not working.


@Override
public int onLoop() throws InterruptedException {
    
    String clue = clueTask();
    
    if(clue == null) {
        getClueTask();
    } else if(clue != null) {
        switch (clue) {
            case xyz:
                //complete task
                break;
            case xyz:
                //complete task

        }
    }

    return 3000;
}

I'm pretty sure that's not the case. I don't have a beginner clue to test, but I know for every other clue type they all have their own individual IDs. With IDs, you can store each clue in an enum.

Should not the string be inside of the method?

 

String clueOne = "";
private String clueTask() {
    RS2Widget clueTaskAnagram = (RS2Widget) getWidgets().get(203,2);
    return clueOne = clueTaskAnagram.getMessage();
}

then

{

WriteLine(clueOne)

}

or whatever you wanted to do with the String.

 

Edited by NukeDropper

21 minutes ago, NukeDropper said:

Should not the string be inside of the method?

 


private String clueTask(String clueTaskOne) {
    RS2Widget clueTaskAnagram = (RS2Widget) getWidgets().get(203,2);
    return clueTaskAnagram.getMessage();
}

? What lmao.

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.