Adblock breaks this site

This script works put won't open door......

Discussion in 'Scar/Simba Help' started by monster1570, Nov 18, 2008.

Thread Status:
Not open for further replies.
  1. monster1570

    monster1570 Guest

    Referrals:
    0
    This script works put won't open door......

    I can't get my script to open the door could someone help me out please?





    import java.awt.*;
    import java.awt.event.KeyEvent;

    import com.speljohan.rsbot.bot.Bot;
    import com.speljohan.rsbot.event.listeners.PaintListener;
    import com.speljohan.rsbot.script.Script;
    import com.speljohan.rsbot.script.wrappers.*;

    public class MSNewtEyes extends Script implements PaintListener {
    public double getVersion() {
    return(1.0);
    }

    public String getName() {
    return("Monster1570's Newt Eye Buyer");
    }

    public String getAuthor() {
    return("Monster1570 - [email protected]");
    }

    public String getScriptCategory() {
    return("Monster1570's Scripts");
    }

    public String getScriptDescription( ) {
    String html = "";

    html += "<html>\n";
    html += "<body>\n";
    html += "<h2>" + getName() + " v" + getVersion() + "</h2><br>\n";
    html += "Author: " + getAuthor() + "<br><br>\n";
    html += "Start where ever you want, really doesnt matter just have nothing in inventory except money.";
    //html += "<center>\n";
    //html += "Arguments:<input type=\"text\" name=\"args\">\n";
    //html += "</center>\n";
    html += "</body>\n";
    html += "</html\n";

    return(html);
    }

    public boolean onStart(String[] args) {
    Bot.getEventManager( ).addListener(PaintListener.class, this);

    return(true);
    }

    public void onFinish() {
    Bot.getEventManager().removeListener(PaintListener.class, this);
    }

    int waitAfterMoving = -1;

    int failCount = 0;

    public int loop() {

    if(!isLoggedIn()) {
    return random(100,200);
    }
    if(checkCamera()) {
    return random(500, 800);
    }
    if(getMyPlayer().isMoving()) {
    return random(150, 200);
    }
    if(waitAfterMoving != -1) {
    int toReturn = waitAfterMoving;
    waitAfterMoving = -1;
    return toReturn;
    }
    if(checkAttack()) {
    return random(800, 1000);
    }
    if(getMyPlayer().getAnimation() != -1) {
    return random(150, 200);
    }
    int result = work();
    if(result != -1) {
    failCount = 0;
    return result;
    }
    if(walkBack()) {
    failCount = 0;
    return random(500, 800);
    }
    failCount ++;
    if(failCount >= 10) {
    failCount = 0;
    homeTele();
    return random(2000, 3000);
    }
    return random(1000, 2000);
    }

    boolean cameraMoving = false;

    public boolean checkCamera() {
    if(cameraMoving) {
    if(Bot.getClient().getCameraCurveY() >= 380) {
    Bot.getInputManager().releaseKey((char) KeyEvent.VK_UP);
    cameraMoving = false;
    }
    return true;
    } else if (Bot.getClient().getCameraCurveY() < 380) {
    Bot.getInputManager().pressKey((char) KeyEvent.VK_UP);
    cameraMoving = true;
    return true;
    }
    return false;
    }

    public boolean checkAttack() {
    if(getMyPlayer().isInCombat()) {
    return runFromCombat();
    } else {
    return false;
    }
    }

    public boolean runFromCombat() {
    if(atShop()) {
    shopToBank();
    return true;
    }
    if(atBank()) {
    bankToShop();
    return true;
    }
    return false;
    }

    int loads = 0;

    public void onRepaint(Graphics g) {
    g.setColor(Color.YELLOW);
    g.drawString("Monster1570's Newt Eye Buyer", 260, 20);
    g.drawString("Loads: " + loads, 260, 38);
    }

    public int work() {
    if(getInventoryCount() != 28) {
    return buy();
    } else {
    triedBuy = false;
    return bank();
    }
    }

    public void runOn() {
    setRun(true);
    openTab(TAB_INVENTORY);
    }

    public int buy() {
    if(atShop()) {
    if(shopOpen()) {
    if(triedBuy) {
    openStock();
    }
    buyFromShop();
    triedBuy = true;
    return random(800, 1000);
    } else {
    runOn();
    if(openDoor()) {
    return random(500, 800);
    }
    if(openShop()) {
    waitAfterMoving = random(200, 300);
    return random(500, 800);
    } else {
    dpWalkTile(shopTile);
    waitAfterMoving = random(300, 400);
    return random(500, 800);
    }
    }
    } else {
    if(bankToShop()) {
    return random(500, 800);
    } else {
    return -1;
    }
    }
    }

    public int bank() {
    if(atBank()) {
    if(RSInterface.getInterface(INTERFACE_BANK).isValid()) {
    bank.depositAllExcept(coinID);
    loads ++;
    return random(500, 800);
    } else {
    if(distanceTo(bankTile) > 1) {
    if(dpWalkTile(bankTile)) {
    waitAfterMoving = random(200, 300);
    return random(500, 800);
    } else {
    return -1;
    }
    } else {
    RSObject object = findObject(bankBoothID);
    if(atObject(object, "uickly")) {
    return random(500, 800);
    } else {
    if(dpWalkTile(bankTile)) {
    return random(500, 800);
    } else {
    return -1;
    }
    }
    }
    }
    } else {
    if(openDoor()) {
    return random(500, 800);
    }
    if(shopToBank()) {
    return random(500, 800);
    } else {
    return -1;
    }
    }
    }

    public boolean dpWalkPath(RSTile[] path) {
    for(int I = path.length - 1; I >= 0; I--) {
    if(dpWalkTile(path)) {
    return true;
    }
    }
    return false;
    }

    public boolean dpWalkTile(RSTile tile) {
    if(distanceTo(tile) <= 16) {
    walkTileMM(tile);
    return true;
    } else {
    return false;
    }
    }

    public void homeTele() {
    openTab(Script.TAB_MAGIC);
    castSpell(1);
    openTab(TAB_INVENTORY);
    }

    public boolean walkBack() {
    return dpWalkPath(walkBackPath);
    }

    public boolean shopToBank() {
    return dpWalkPath(shopToBankPath);
    }

    public boolean bankToShop() {
    return dpWalkPath(bankToShopPath);
    }

    public boolean shopOpen() {
    return RSInterface.getInterface(620).isValid();
    }

    public boolean openShop() {
    return atNPC(getNearestNPCByID(583), "Trade");
    }

    public boolean openDoor() {
    RSObject object = findObject(1533);
    if (object !=null) {
    if (distanceTo(object) <= 5) {
    atDoor(object, "East", "Open");
    return true;
    }
    }
    return false;
    }

    boolean triedBuy = false;

    public void openStock() {
    int x = 61 + random(0, 3);
    int y = 72 + random(0, 3);
    moveMouse(x, y);
    clickMouse(x, y, true);
    wait(random(800, 1000));
    }

    public void buyFromShop() {
    int x = 384 + random(0, 3);
    int y = 105 + random(0, 3);
    moveMouse(x, y);
    clickMouse(x, y, false);
    wait(random(150, 200));
    if(atMenu("Buy X")) {
    wait(random(700, 800));
    sendText("99", true);
    }
    }

    public boolean atShop() {
    return distanceTo(shopTile) < 6;
    }

    public boolean atBank() {
    return distanceTo(bankTile) < 5;
    }

    public RSTile bankTile = new RSTile(3092, 3245);

    public RSTile shopTile = new RSTile(3014, 3259);

    public int coinID = 995;

    public static int bankBoothID = 2213;

    public RSTile[] bankToShopPath = {new RSTile(3092,3245),new RSTile(3087,3249),new RSTile(3083,3254),new RSTile(3082,3260),new RSTile(3078,3266),new RSTile(3075,3272),new RSTile(3070,3276),new RSTile(3064,3276),new RSTile(3058,3276),new RSTile(3052,3276),new RSTile(3046,3276),new RSTile(3040,3276),new RSTile(3034,3276),new RSTile(3030,3271),new RSTile(3025,3267),new RSTile(3021,3262),
    new RSTile(3017,3259),};

    public RSTile[] shopToBankPath = {new RSTile(3017,3259),new RSTile(3021,3265),new RSTile(3027,3267),new RSTile(3032,3272),new RSTile(3037,3276),new RSTile(3043,3276),new RSTile(3049,3276),new RSTile(3055,3276),new RSTile(3061,3276),new RSTile(3067,3276),new RSTile(3072,3271),new RSTile(3077,3267),new RSTile(3080,3261),new RSTile(3081,3255),new RSTile(3086,3250),new RSTile(3092,3247),
    new RSTile(3092,3245),};

    public RSTile[] walkBackPath = {new RSTile(3222, 3219), new RSTile(3232, 3224), new RSTile(3227, 3234), new RSTile(3222, 3244), new RSTile(3211, 3246), new RSTile(3200, 3247), new RSTile(3189, 3246), new RSTile(3178, 3243), new RSTile(3168, 3238), new RSTile(3157, 3236), new RSTile(3146, 3232), new RSTile(3136, 3227), new RSTile(3125, 3227), new RSTile(3114, 3228), new RSTile(3108, 3238), new RSTile(3103, 3248),
    new RSTile(3092, 3245)};

    }
     
  2. Jethr0x

    Jethr0x Grand Master
    Banned

    Joined:
    Jan 24, 2007
    Posts:
    3,070
    Referrals:
    13
    Sythe Gold:
    0
    This script works put won't open door......

    (1) RSBot is GAY.
    (2) This is a scar forum
    (3) Reported as spam
     
  3. Tgump

    Tgump Hero
    Retired Global Moderator Zombie

    Joined:
    Jan 21, 2007
    Posts:
    6,541
    Referrals:
    8
    Sythe Gold:
    0
    Two Factor Authentication User
    This script works put won't open door......

    You don't have to be a dick, RSBot rules.

    It's his first post.
     
  4. monster1570

    monster1570 Guest

    Referrals:
    0
    This script works put won't open door......

    Thanks, and im sorry ill repost it
     
  5. HyperSecret

    HyperSecret Active Member

    Joined:
    Jun 5, 2007
    Posts:
    123
    Referrals:
    0
    Sythe Gold:
    0
    This script works put won't open door......

    I don't see a problem in him posting it here :p.

    Maybe put some standards in? Kind of hard to debug it. Also put in code tags. Maybe changed the distanceTo in the openDoor method to a higher distance.
     
  6. Macroman

    Macroman Hero
    Do Not Trade

    Joined:
    Jan 21, 2007
    Posts:
    6,919
    Referrals:
    9
    Sythe Gold:
    12
    This script works put won't open door......

    Closed etc, Try rsbot.com or something.
     
< [URGENT] All SCAR users read! | move mouse random location then click >
Thread Status:
Not open for further replies.


 
 
Adblock breaks this site