Jump to content

Help assigning a Method value to a String


Vogelbekdier

Recommended Posts

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
Link to comment
Share on other sites

 
 
 
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;
}
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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