Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Need help on 2 things

Featured Replies

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

You've only stated what you want to write.

 

What's your question?

 

  • 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?

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

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"

  • 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?

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
  • 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 by pinto

 

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

.toLowerCase().contains("Overload")

 

tongue.png

 

I didn't really clean the code, just fixed the big issues. Can't spoon feed everything :p

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:

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

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.