bigd123 Posted February 13, 2019 Share Posted February 13, 2019 I'm copy and pasting the conditional sleep all the times I need it, but it's giving me the error "The method condition() of type Enchanter must override or implement a supertype method." I've commented where the errors are. Code: private void withdrawAmulets() { ctx.log("Withdrawing Topaz amulets"); if (!ctx.getEquipment().isWearingItem(EquipmentSlot.WEAPON, "Staff of fire")) { if(ctx.getBank().withdraw("Topaz amulet", 26)){ new ConditionalSleep(1000,1250) { @Override public boolean condition() { return !needAmulets(); } }.sleep(); } } else { if(ctx.getBank().withdraw("Topaz amulet", 26)){ new ConditionalSleep(1000,1250) { //Syntax error, insert "}" to complete MethodBody @Override public boolean condition() { //The method condition() of type Enchanter must override or implement a supertype method return !needAmulets(); } }.sleep(); // Syntax error on token "}", delete this token } } // Syntax error on token "}", { expected } Help appreciated Quote Link to comment Share on other sites More sharing options...
luciuspragg Posted February 13, 2019 Share Posted February 13, 2019 (edited) I don't want to get too into detail with the problem you're having because there seem to be more than just the override error. But with a quick glance here's what I can tell: // Syntax error on token "}", { expected Your script has 10 opening and 12 closing braces which is causing this error, make sure you're closing all your braces properly. //The method condition() of type Enchanter must override or implement a supertype method If i recall correctly this means that your parameters don't match up with the class you're trying to override: //the super class/method being overrun class foo (int x, String s) { ... } //the class/method you're wanting to override with class foo (int y, int x) { ... } Notice how the parameters are out of order and/or don't match up, since the signatures aren't a match there's *nothing* to be overrun. My best guess as to what's causing it is the time parameters in your conditional sleep declaration. AFAIK conditional sleep only takes one parameter for time instead of a range. You could try using random() to generate a number in that range and use that instead. Edited February 13, 2019 by luciuspragg 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.