Jump to content

Help assigning a Method value to a String


Recommended Posts

Posted (edited)

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
Posted
 
 
 
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;
}
Posted
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.

Posted (edited)

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...