All pastes #2047032 Raw Edit

Stuff

public text v1 · immutable
#2047032 ·published 2011-04-16 02:31 UTC
rendered paste body
import java.awt.*;
import net.c2d.sharpf2.api.*;
import net.c2d.sharpf2.api.wrappers.*;
import net.c2d.sharpf2.api.model.*;

/**
 *
 * @author Rick
 */
@ScriptData(
name = "VarrockCopperMiner",
author = "Rick",
version = "1.0.0",
description = "Mines copper and banks it in Varrock",
category = ScriptCategory.Mining)
class ObjectScript extends Script {
    Point[] PATH_TO_MINE = [new Point(3253, 3424), new Point(3261, 3429), new Point(3269, 3429), new Point(3279, 3428), new Point(3283, 3419), new Point(3287, 3412), new Point(3290, 3406), new Point(3292, 3398), new Point(3291, 3392), new Point(3292, 3389), new Point(3293, 3381), new Point(3288, 3376), new Point(3286, 3370)] as Point[];
    Point[] PATH_TO_BANK = [new Point(3286, 3370), new Point(3292, 3377), new Point(3292, 3387), new Point(3291, 3400), new Point(3287, 3414), new Point(3287, 3421), new Point(3284, 3424), new Point(3282, 3427), new Point(3280, 3427), new Point(3278, 3429), new Point(3274, 3429), new Point(3266, 3430), new Point(3260, 3430), new Point(3257, 3429), new Point(3253, 3423)] as Point[];
    int loadsDropped;


    void start() {
        enableTimer();
        objects.setInteractionPolicy(InteractionPolicy.WAIT_FOR_INTERACTABLE); // When clicking an object also react on its dissapearance
    }

    int tick() {
        if (!inventory.isFull()) {
            if (objects.objectExists(11962, 11960, 11961)) {
                objects.interactWith("Mine", 11962, 11960, 11961);
            } else {
                walking.walkPath(PATH_TO_MINE);
            }
        } else {
            walking.walkPath(PATH_TO_BANK);
            bank.open();
            bank.depositAll();
            bank.close();
            walking.walkPath(PATH_TO_MINE);
        }
        return 200;
    }

    void paint(Graphics g) {
        g.drawString("Running PowerMiner by Rick", 10, 30);
        g.drawString("Dropped "+ loadsDropped+" loads..", 10, 50);
        g.drawString("Runtime: "+getElapsedTime(), 10, 70);
    }
}