Jump to content

Open Lamp and choose xp


Bjotorsflav

Recommended Posts

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
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.
Note: Your post will require moderator approval before it will be visible.

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