Vogelbekdier Posted May 22, 2019 Share Posted May 22, 2019 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(); } Quote Link to comment Share on other sites More sharing options...
Naked Posted May 22, 2019 Share Posted May 22, 2019 Widget IDs change. You should always check for != null and .isVisible() for widgets before grabbing details fromthem. Perhaps a better naming scheme? 1 Quote Link to comment Share on other sites More sharing options...
Czar Posted May 22, 2019 Share Posted May 22, 2019 You are declaring the same 'clueTask' name twice, one as a method and one as a variable, change the private String clueTask name, and make sure to initialize it in onLoop or something, instead of outside a method. 1 Quote Link to comment Share on other sites More sharing options...
HeyImJamie Posted May 22, 2019 Share Posted May 22, 2019 (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 May 22, 2019 by HeyImJamie Quote Link to comment Share on other sites More sharing options...
Vogelbekdier Posted May 22, 2019 Author Share Posted May 22, 2019 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; } Quote Link to comment Share on other sites More sharing options...
HeyImJamie Posted May 22, 2019 Share Posted May 22, 2019 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. Quote Link to comment Share on other sites More sharing options...
NukeDropper Posted May 23, 2019 Share Posted May 23, 2019 (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 May 23, 2019 by NukeDropper Quote Link to comment Share on other sites More sharing options...
HeyImJamie Posted May 23, 2019 Share Posted May 23, 2019 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. Quote Link to comment Share on other sites More sharing options...