April 9, 201510 yr I'm getting two errors on Line 2 of this code. public int onLoop() { public void onMessage(Message message) throws InterruptedException { String txt = message.getMessage().toLowerCase(); if (txt.contains("Overload")) { return inv.interactWithName(Overload, "Drink"); } else return false; } 1 - it's saying void is an invalid variable for OnMessage. What else should it be? 2 - the second message it's saying is returning a syntax error. Saying I need to insert ";" to complete the local variable declaration statement. Edited April 9, 201510 yr by pinto
April 9, 201510 yr Author You've only stated what you want to write. What's your question? Will the Message listener in the API work for the overload? How do I pull the information from the absorption display in order to know when to sip the absorption pot?
April 9, 201510 yr Well, if you get a message that the overload effect has run out, then yes, you can use message listener. Alternatively, you can use a timer for overload, if the effect last for 5 minutes like you said. For the absorption, you can use widgets. Read the value of the widget where the amount of absorption displays. Then you can determine whether you should take a sip or not. Edited April 9, 201510 yr by Woody
April 9, 201510 yr Idk much about coding, but you can do something like if your hp is greater than or equal to 41 then interact with overload, or you can use a timer or find the chatbox text. For absorptions, they tell you in the chatbox how much absorbed hits you have left, so try using the message listener to find the first number of how much you have left. Example would be "You have 242 hits left" make it find "You have 2"
April 9, 201510 yr Author Your making a method in a method, doesn't work. I'm new at this, I don't really know what that means... What should I do then?
April 9, 201510 yr I'm new at this, I don't really know what that means... What should I do then? First off prob go read up on Java and such. I know its not any fun, but having a basic understanding of progamming will help a ton with making scripts, else everything is seen as just "magic", not cause and effect. Anyways, how you would do this is: public int onLoop() { // We start the onLoop method // This is out main loop } // We close off this method public void onMessage(Message message) throws InterruptedException { // We start onMessage if (message.getMessage().toLowerCase().contains("Overload")) // Check if there is an overload return inv.interactWithName(Overload, "Drink"); // Drink said overload? no Overload variable though, meant to be String? return false; // We return false incase nothing is needed } // We close this method
April 9, 201510 yr Author First off prob go read up on Java and such. I know its not any fun, but having a basic understanding of progamming will help a ton with making scripts, else everything is seen as just "magic", not cause and effect. Anyways, how you would do this is: public int onLoop() { // We start the onLoop method // This is out main loop } // We close off this method public void onMessage(Message message) throws InterruptedException { // We start onMessage if (message.getMessage().toLowerCase().contains("Overload")) // Check if there is an overload return inv.interactWithName(Overload, "Drink"); // Drink said overload? no Overload variable though, meant to be String? return false; // We return false incase nothing is needed } // We close this method Yeah, i need to do that... It's meant to check if overload is contained in a message. Meaning when the message appears that the overload has run out, this script will execute, find the overload in the inventory, and drink it. Edited April 9, 201510 yr by pinto
April 9, 201510 yr First off prob go read up on Java and such. I know its not any fun, but having a basic understanding of progamming will help a ton with making scripts, else everything is seen as just "magic", not cause and effect. Anyways, how you would do this is: public int onLoop() { // We start the onLoop method // This is out main loop } // We close off this method public void onMessage(Message message) throws InterruptedException { // We start onMessage if (message.getMessage().toLowerCase().contains("Overload")) // Check if there is an overload return inv.interactWithName(Overload, "Drink"); // Drink said overload? no Overload variable though, meant to be String? return false; // We return false incase nothing is needed } // We close this method .toLowerCase().contains("Overload") :P
April 9, 201510 yr .toLowerCase().contains("Overload") I didn't really clean the code, just fixed the big issues. Can't spoon feed everything :p
April 9, 201510 yr public void onMessage(Message message) throws InterruptedException { // We start onMessage if (message.getMessage().toLowerCase().contains("Overload")) // Check if there is an overload return inv.interactWithName(Overload, "Drink"); // Drink said overload? no Overload variable though, meant to be String? return false; // We return false incase nothing is needed } // We close this method Interesting how you're returning booleans in a void method
April 10, 201510 yr public void onMessage(Message message) throws InterruptedException { // We start onMessage if (message.getMessage().toLowerCase().contains("Overload")) // Check if there is an overload return inv.interactWithName(Overload, "Drink"); // Drink said overload? no Overload variable though, meant to be String? return false; // We return false incase nothing is needed } // We close this method Interesting how you're returning booleans in a void method How do you know that's not a void method
Create an account or sign in to comment