Famous Scripts
Would you like to react to this message? Create an account in a few clicks or log in to continue.


Scripts for RSBot made by Famous
 
HomePortalLatest imagesRegisterLog in
New scripts being created everyday! Go to GameKiller.net!

 

 Account Picture Capture

Go down 
AuthorMessage
Famous
Administrator
Administrator
Famous


Posts : 50
Join date : 2009-10-23
Age : 29
Location : Chicago

Account Picture Capture Empty
PostSubject: Account Picture Capture   Account Picture Capture EmptySun Jul 18, 2010 10:51 pm

This was made upon
request. This will only work with the new API


Requirements:

Start Logged in, in front of any bank

Features:
Takes screenshots of the following things:
Combat Level
Stats
Quests
Achievements
Equipment
Bank
Welcome Screen


If you would like more pictures of certain areas, please post here with
your requests.

Save as: AccountCapture.java

Code:
import  java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.util.Map;

import org.rsbot.event.events.ServerMessageEvent;
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.event.listeners.ServerMessageListener;
import org.rsbot.script.script;
import org.rsbot.script.scriptManifest;
import org.rsbot.script.methods.Bank;
import org.rsbot.script.methods.Game;
import org.rsbot.script.wrappers.RSNPC;
import org.rsbot.script.wrappers.RSObject;
import org.rsbot.script.wrappers.RSTile;

@scriptManifest(authors = { "Famous" }, category = "Other", name =  "Account Picture Capture", version = 1.0, description =  "<html><head></head><body>This will take  screenshots of your account. Made on request for  ***********</body></html\n")
public class AccountCapture extends script implements PaintListener,
        ServerMessageListener {

    final scriptManifest properties = getClass().getAnnotation(
            scriptManifest.class);

    public boolean onStart(Map<String, String> args) {
        if (game.getCurrentTab() != Game.TAB_ATTACK) {
            sleep(random(200, 400));
            game.openTab(Game.TAB_ATTACK);
            sleep(random(200, 400));
        }
        return true;
    }

    private RSTile nearestBank() {
        final RSObject Booth = objects.getNearest(Bank.BANK_BOOTHS);
        RSNPC BankerNPC = npcs.getNearest(Bank.BANKERS);
        RSObject BankChest = objects.getNearest(Bank.BANK_CHESTS);
        int minDist = 30;
        if (BankChest != null) {
            minDist = calc.distanceTo(BankChest);
        }
        if (BankerNPC != null && calc.distanceTo(BankerNPC) <  minDist) {
            minDist = calc.distanceTo(BankerNPC);
            BankChest = null;
        }
        if (Booth != null && calc.distanceTo(Booth) <  minDist) {
            BankerNPC = null;
        }
        if (BankerNPC != null) {
            return BankerNPC.getLocation();
        }
        if (BankChest != null) {
            return BankChest.getLocation();
        }
        if (Booth != null) {
            return Booth.getLocation();
        }
        return null;
    }

    private RSTile checkTile(final RSTile tile) {
        if (calc.distanceTo(tile) < 17) {
            return tile;
        }
        final RSTile loc = getMyPlayer().getLocation();
        final RSTile walk = new RSTile((loc.getX() + tile.getX()) / 2,  (loc
                .getY() + tile.getY()) / 2);
        return calc.distanceTo(walk) < 17 ? walk : checkTile(walk);
    }

    private boolean openBank() {
        final RSTile bankLoc = nearestBank();
        if (bankLoc == null) {
            walking.walkTo(bankLoc);
        }
        if (!calc.tileOnScreen(bankLoc)) {
            camera.turnToTile(bankLoc, 15);
        }
        final RSObject booth = objects.getNearest(Bank.BANK_BOOTHS);
        if (calc.distanceTo(new RSTile(3183, 3434)) > 40) {
            return bank.open();
        } else if (booth == null) {
            return false;
        } else if (calc.tileOnScreen(booth.getLocation())) {
            return booth.doAction("Use-quickly");
        } else {
            walking.walkTo(checkTile(booth.getLocation()));
        }
        return false;
    }

    public void click6() {
        mouse.click(true);
        sleep(random(500, 1000));
        mouse.click(true);
        sleep(random(500, 1000));
        mouse.click(true);
        sleep(random(500, 1000));
        mouse.click(true);
        sleep(random(500, 1000));
        mouse.click(true);
        sleep(random(500, 1000));
        mouse.click(true);
        sleep(random(500, 1000));
    }

    public enum Action {
        COMBAT, STATS, QUEST, BANK, ACHIEVE, WAIT
    }

    public Action getAction() {
        try {
            if (game.getCurrentTab() == Game.TAB_ATTACK) {
                return Action.COMBAT;
            } else if (game.getCurrentTab() == Game.TAB_STATS) {
                return Action.STATS;
            } else if (game.getCurrentTab() == Game.TAB_QUESTS) {
                return Action.QUEST;
            } else if (bank.isOpen()) {
                return Action.BANK;
            }
        } catch (final Exception e) {
            e.printStackTrace();
        }
        return Action.WAIT;
    }

    public int loop() {
        switch (getAction()) {
        case BANK:
            if (interfaces.get(Bank.INTERFACE_BANK).isValid()) {
                mouse.move(489, 285, 4, 4);
                sleep(random(1000, 2000));
                takeScreenshot(true);
                sleep(random(1000, 2000));
                click6();
                takeScreenshot(true);
                sleep(random(1000, 2000));
                click6();
                takeScreenshot(true);
                sleep(random(1000, 2000));
                bank.close();
                sleep(random(1000, 2000));
                game.logout(true);
                sleep(random(1000, 2000));
                takeScreenshot(true);
                sleep(random(1000, 2000));
                stopscript();
            }
            break;
        case COMBAT:
            if (game.getCurrentTab() != Game.TAB_ATTACK) {
                sleep(random(200, 400));
                game.openTab(Game.TAB_ATTACK);
                sleep(random(200, 400));
            }
            takeScreenshot(true);
            sleep(random(1000, 2000));
            game.openTab(Game.TAB_STATS);
            sleep(random(1000, 2000));
            break;
        case STATS:
            if (game.getCurrentTab() != Game.TAB_STATS) {
                sleep(random(200, 400));
                game.openTab(Game.TAB_STATS);
                sleep(random(200, 400));
            }
            takeScreenshot(true);
            sleep(random(1000, 2000));
            game.openTab(Game.TAB_QUESTS);
            sleep(random(1000, 2000));
            break;
        case QUEST:
            if (game.getCurrentTab() != Game.TAB_QUESTS) {
                sleep(random(200, 400));
                game.openTab(Game.TAB_QUESTS);
                sleep(random(200, 400));
            }
            takeScreenshot(true);
            sleep(random(1000, 2000));
            mouse.move(727, 336);
            sleep(random(500, 1000));
            mouse.click(true);
            sleep(random(500, 1000));
            takeScreenshot(true);
            sleep(random(500, 1000));
            mouse.move(728, 360);
            sleep(random(500, 1000));
            mouse.click(true);
            sleep(random(500, 1000));
            takeScreenshot(true);
            sleep(random(500, 1000));
            mouse.move(728, 383);
            sleep(random(500, 1000));
            mouse.click(true);
            sleep(random(500, 1000));
            takeScreenshot(true);
            sleep(random(500, 1000));
            mouse.move(728, 407);
            sleep(random(500, 1000));
            mouse.click(true);
            sleep(random(500, 1000));
            takeScreenshot(true);
            sleep(random(500, 1000));
            mouse.move(728, 434);
            sleep(random(500, 1000));
            mouse.click(true);
            sleep(random(500, 1000));
            takeScreenshot(true);
            sleep(random(500, 1000));
            // //////////////////////
            mouse.move(626, 186);
            sleep(random(500, 1000));
            mouse.click(true);
            sleep(random(500, 1000));
            takeScreenshot(true);
            sleep(random(1000, 2000));
            mouse.move(728, 371);
            sleep(random(500, 1000));
            mouse.click(true);
            sleep(random(500, 1000));
            takeScreenshot(true);
            sleep(random(500, 1000));
            mouse.move(728, 433);
            sleep(random(500, 1000));
            mouse.click(true);
            sleep(random(500, 1000));
            takeScreenshot(true);
            sleep(random(500, 1000));
            // ////////////////////////
            mouse.move(687, 188);
            sleep(random(500, 1000));
            mouse.click(true);
            sleep(random(500, 1000));
            takeScreenshot(true);
            sleep(random(500, 1000));
            // /////////////////////////
            openBank();
            break;
        }
        return 1000;
    }

    public void onFinish() {
        log("Finished. Your images have been saved at:");
        log("C:/My Documents/RSBot/Screenshots");
        log("Thank you for using Account Picture Capture.");
        log("For More scripts, visit:");
        log("Famousscripts.forumotion.com");
    }

    public void onRepaint(final Graphics g) {
        // ///////////////Paint Mouse////////////////
        Point m = mouse.getClientLocation();
        g.setColor(new Color(0, 0, 255, 180));
        g.drawRoundRect(m.x - 6, m.y, 15, 3, 5, 5);
        g.drawRoundRect(m.x, m.y - 6, 3, 15, 5, 5);
        g.setColor(new Color(0, 0, 255, 180));
        g.fillRoundRect(m.x - 6, m.y, 15, 3, 5, 5);
        g.fillRoundRect(m.x, m.y - 6, 3, 15, 5, 5);
        // //////////////////////////////////////////
    }

    public void serverMessageRecieved(ServerMessageEvent e) {
    }

}
Back to top Go down
https://famousscripts.forumotion.com
 
Account Picture Capture
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Famous Scripts :: Scripts :: Other-
Jump to: