Jump to content

Open Lamp and choose xp


Recommended Posts

Posted

Somebody asked for it and it only supports attack at the moment.

Opens inventory, clicks on "Lamp" then clicks on Attack and then Confirm: Attack

Checks again if there are any lamps, if not then it stops. The plan is to make it support every single lamp ingame and stats.

I guess this is just version 1.0 and we move on the other day.

import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.api.model.Item;
import org.osbot.rs07.api.ui.RS2Widget;

@ScriptManifest(name = "Lamp", author = "Bjotorsflav", version = 1.0, info = "", logo = "")
public class Lamp extends Script {

    @Override
    public int onLoop() throws InterruptedException {
        // Check if "Lamp" is in the inventory
        Item lamp = getInventory().getItem("Lamp");

        if (lamp != null) {
            // Interact with the "Lamp" by clicking "Rub"
            lamp.interact("Rub");

            // Sleep for a short duration to allow the interaction to occur
            sleep(random(500, 800));

            // Click on the first widget with coordinates (240, 2, 4)
            RS2Widget widget1 = getWidgets().get(240, 2, 4);
            if (widget1 != null) {
                widget1.interact();
            }

            // Sleep for a short duration to allow the interaction to occur
            sleep(random(500, 800));

            // Click on the second widget with coordinates (240, 26, 0)
            RS2Widget widget2 = getWidgets().get(240, 26, 0);
            if (widget2 != null) {
                widget2.interact();
            }
        } else {
            // If "Lamp" is not in the inventory, stop the script
            stop();
        }

        return 500; // Sleep for 500 milliseconds before running the script again
    }
}
  • Like 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...