Jump to content
pinto

Need help on 2 things

Recommended Posts

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

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

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"

Link to comment
Share on other sites

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

 

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

 

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

  • Like 1
Link to comment
Share on other sites

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 :doge:

  • Like 6
Link to comment
Share on other sites

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 :doge:

How do you know that's not a void method

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.

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...