import java.awt.*; import java.util.*; import com.speljohan.rsbot.script.*; import com.speljohan.rsbot.bot.*; import com.speljohan.rsbot.script.wrappers.*; import com.speljohan.rsbot.event.listeners.*; import com.speljohan.rsbot.event.events.*; public class SmartPC extends Script implements PaintListener{ public String getName() { return "SmartPC"; } public double getVersion() { return 3.6; } public String getAuthor() { return "Jan274"; } public String getmodifier() { return "Cheeseiznice, Exile, Fatality"; } public String getScriptCategory() { return "Minigames"; } public String getScriptDescription() { String html = ""; html += "\n"; html += "\n"; html += "

" + getName() + " v" + getVersion() + "


\n"; html += "Script by: " + getAuthor() + "
\n"; html += "Modified by: " + getmodifier() + "
\n"; html += "

Description:

SmartPC is a modified version of 'Jan274s Pest Control' script. The script has been altered for faster, more consistent execution, lower detectability, and will now spend points correctly."; html += "
"; html += "

Instructions:

-Start script at lander dock (Optional-'BreakHandler')
"; html += "-Make sure you have a working Autologin script in your AntiRandom folder."; html += "
"; html += "
";html += "Args: NONE= 0, Attack= 1, Strength= 2, Defence= 3, Range= 4, Prayer= 5, Magic= 6, Hitpoints= 7 && for prayer: Strength=1, Range=2, Mage=3 "; html += "
"; html += "
"; html += "Enter Argument (one number only): "; html += "\n"; html += "= 100) { setRun(true); } if (getSetting(Methods.SETTING_AUTO_RETALIATE) != 0) { openTab(Methods.TAB_ATTACK); wait(random(300,600)); clickMouse(random(578,708), random(362,398), true); wait(random(800, 1000)); } setCameraRotation(1); if(getMyPlayer().isMoving()){ return random(400, 500); } if(state != 2 && findVoid() && distanceTo(temp) < 9){ makeTile(); currentp="none"; while(getMyPlayer().isMoving()){ wait(random(500, 900)); } setRun(true); walkToCenter(); while(getMyPlayer().isMoving()){ wait(random(500, 900)); } wait(random(500, 600)); state=3; } if(distanceTo(bridge) > 2 && distanceTo(boat) > 2 && distanceTo(bridge) < 20){ if(distanceTo(bridge) > 17){ RSTile bridg = bridge; int bX= bridg.getX(); int bY= bridg.getY(); RSTile a = new RSTile(bX,bY+5); myWalkTile(a,1); wait(random(3000, 4000)); while(getMyPlayer().isMoving()){ wait(random(500, 900)); } } myWalkTile(bridge,1); wait(2000); while(getMyPlayer().isMoving()){ wait(random(500, 900)); } } if(distanceTo(bridge) < 2){ notyet=true; currentp="none"; wait(random(1000,1350)); if(interfaceExists(242) || interfaceExists(211)) { lost++; } else if(interfaceExists(243)){ won++; } while(interfaceExists(242) || interfaceExists(211) || interfaceExists(243)) { pressContinue(); wait(random(650,750)); } if(bridge==first){ if(jpoints >= 100){ log("You reached over 100 points; spending now!"); spendPoints(); myWalkTile(bridge,1); points=0; jpoints=0; if(distanceTo(bridge) < 4 || !(interfaceExists(242) || !(interfaceExists(211) || !(interfaceExists(243))))){ atObject(findObject(gangplank), "Cross"); }else{ return random(20,100); } wait(random(700, 1000)); state=2; } } if(bridge==second){ if(jpoints >= 100){ log("You reached over 100 points; spending now!"); spendPoints(); myWalkTile(bridge,1); points=0; jpoints=0; if(distanceTo(bridge) < 4){ atObject(findObject(gangplank), "Cross"); }else{ return random(20,100); } wait(random(700, 1000)); state=2; } } if(bridge==third){ if(jpoints >= 100){ log("You reached over 100 points; spending now!"); spendPoints(); setCameraRotation(1); clickMouse(556,74,true); wait(random(4000, 5000)); myWalkTile(bridge,1); points=0; jpoints=0; if(distanceTo(bridge) < 4){ atObject(findObject(gangplank), "Cross"); }else{ return random(20,100); } wait(random(700, 1000)); state=2; } } wait(random(700, 1000)); if(distanceTo(bridge) < 4){ atObject(findObject(gangplank), "Cross"); }else{ return random(20,100); } wait(random(700, 1000)); state=2; } switch(state){ case 0: if(getMyPlayer().getAnimation() != -1 || getMyPlayer().isInCombat()) { antiBan(); wait(250); }else{ state = prev; } return random(500, 1000); case 1: if(distanceTo(boat) < 2){ state=2; } return random(20,100); case 2: if(distanceTo(boat) < 2 || distanceTo(bridge) < 2){ RSInterfaceChild a = RSInterface.getChildInterface(407,16); String text = a.getText(); jpoints=extract(text); if(jpoints == 240 || jpoints >= 240){ log("Ending Script, you have over 240 points"); return -1; } antiBan(); return random(20,100); }else{ setRun(true); RSNPC squire = getNearestNPCByID(3781); if(squire==null){ return random(20,100); } usePrayer(); makeTile(); if(distanceTo(center) > 30){ currentp="none"; if(getMyPlayer().isMoving()) { return random(20,100); } walkToCenter(); if(getMyPlayer().isMoving()) { return random(20,100); } } state=3; } return random(20,100); case 3: RSNPC Atta; Atta = getNearestNPCByName("Shifter", "Defiler", "Torcher", "Brawler", "Ravager"); if(Atta != null && distanceTo(Atta) < 7) { atNPC2(Atta, "Attack"); state= 0; prev= 3; return random(20,100); }else{ state=5; prev=4; } return random(20,100); case 4: stayNearPortal(); RSNPC mons; mons = getNearestNPCByName("Spinner"); avoidBrawler(mons); if(mons != null && distanceTo(mons) < 7) { atNPC2(mons, "Attack"); state= 0; prev= 4; return random(20,100); } stayNearPortal(); RSNPC Portal; Portal = getNearestNPCByID(portal); avoidBrawler(Portal); if(Portal != null && distanceTo(Portal) < 5){ atNPC2(Portal, "Attack"); state= 0; prev= 4; return random(20,100); } stayNearPortal(); RSNPC monst; monst = getNearestNPCByName("Shifter", "Defiler", "Torcher", "Brawler", "Ravager"); if(monst != null && distanceTo(monst) < 7) { atNPC2(monst, "Attack"); state= 0; prev= 4; return random(20,100); }else{ stayNearPortal(); wait(random(100, 500)); state = 5; prev=4; } return random(20,100); case 5: if(!(newPortal())){ if(distanceTo(bridge) > 2 && distanceTo(boat) > 2 && distanceTo(bridge) < 20){ myWalkTile(bridge,1); wait(2000); if(getMyPlayer().isMoving()){ return random(20,100); } } return 100; }else{ state=prev; } return random(20,100); } }catch(Exception e){ e.printStackTrace(); } return random(20,100); } public void setMaxAltitude() { Bot.getInputManager().pressKey((char) 38); wait(random(500,1000)); Bot.getInputManager().releaseKey((char) 38); } public void pressContinue(){ clickMouse(254+random(0,20), 455+random(0,4), true); } public int getSpec() { return getSetting(300); } public boolean specEnabled() { return (getSetting(301)) == 1; } public void doSpec() { if(getSpec() == 1000 && !(specEnabled() && distanceTo(boat) > 5)) { openTab(Methods.TAB_ATTACK); clickMouse(645+random(0,4), 425+random(0,4), true); } return; } public void usePrayer(){ int prayerLevel = skills.getCurrentSkillLevel(STAT_PRAYER); if(random(0, 2) == 0) wait(random(700,1000)); openTab(Methods.TAB_PRAYER); wait(random(300, 500)); if(whichPray==1) {//Strength prayer (melee) if(prayerLevel >=4 && prayerLevel <=12) { clickMouse(599+random(0,5), 228+random(0,5), true); } else if(prayerLevel >=13 && prayerLevel <=30) { clickMouse(599+random(0,5), 268+random(0,5), true); } else if(prayerLevel >=31 && prayerLevel<= 59 ) { clickMouse(712+random(0,5), 306+random(0,5), true); } else if(prayerLevel >=60 && prayerLevel<= 69) { clickMouse(560+random(0,5), 407+random(0,5), true); } else if(prayerLevel >=70) { clickMouse(595+random(0,5), 413+random(0,5), true); } } else if(whichPray==2) {//Range prayer if(prayerLevel >=8 && prayerLevel <=25) { clickMouse(673+random(0,5), 226+random(0,5), true); } else if(prayerLevel >=26 && prayerLevel <=43) { clickMouse(599+random(0,5), 298+random(0,5), true); } else if(prayerLevel >=44) { clickMouse(559+random(0,5), 374+random(0,5), true); } } else if(whichPray==3) {//Magic prayer if(prayerLevel >=9 && prayerLevel <= 26) { clickMouse(709+random(0,5), 228+random(0,5), true); } else if(prayerLevel >=27 && prayerLevel <= 44) { clickMouse(634+random(0,5), 306+random(0,5), true); } else if(prayerLevel <=45) { clickMouse(599+random(0,5), 375+random(0,5), true); } } return; } public void antiBan(){ int t; int u; t = random(0,9); u = random(0,15); if( u == 9 ){ try{ switch(t){ case 8://Random mouse moveMouse(0 + random(0, 500), 0 + random(0, 500)); break; case 4://Does special attack if possible doSpec(); break; case 2://Random mouse moveMouse(0 + random(0, 500), 0 + random(0, 500)); break; case 3://Random player clickCharacter(getNearestPlayerByLevel(1,130) , "Cancel"); break; case 1://Leave empty case 5://Max altitude setMaxAltitude(); break; case 0://Leave empty case 7://Random mouse moveMouse(0 + random(0, 500), 0 + random(0, 500)); break; case 6://Checks stat you selected in argument if ( getCurrentTab( ) != TAB_STATS ) { openTab( TAB_STATS ); if(num==1){ moveMouse(580+random(1, 5),245+random(1, 5));; } if(num==2){ moveMouse(580+random(1, 5),270+random(1, 5));; } if(num==3){ moveMouse(580+random(1, 5),305+random(1, 5));; } if(num==4){ moveMouse(580+random(1, 5),340+random(1, 5));; } if(num==5){ moveMouse(580+random(1, 5),370+random(1, 5));; } if(num==6){ moveMouse(580+random(1, 5),400+random(1, 5));; } if(num==7){ moveMouse(630+random(1, 5),245+random(1, 5));; } if(num==0){ moveMouse(580+random(1, 5),270+random(1, 5));; } } break; } }catch(Exception e){ e.printStackTrace(); } } } public boolean findVoid(){ RSNPC squire = getNearestNPCByID(3781); if(squire != null){ temp = squire.getLocation(); return true; }else{ return false; } } public void makeTile()throws InterruptedException{ findVoid(); startX=temp.getX(); startY=temp.getY(); desX= temp.getX() + 2; desY= temp.getY() - 14; centerX=desX; centerY=desY; center=new RSTile(centerX,centerY); center1=new RSTile(centerX,centerY+7); toCenterTile=new RSTile[]{new RSTile(startX,startY),new RSTile(desX,desY)}; /* To West Tiles */ startX=desX; startY=centerY; desX= startX - 12; desY=centerY; centToWestA=new RSTile[]{new RSTile(startX,startY),new RSTile(desX,desY)}; startX=desX - 4; desX=desX - 13; desY=centerY-1; centToWestB=new RSTile[]{new RSTile(startX,startY),new RSTile(desX,desY)}; westToSWest=new RSTile(desX+10, desY-9); /* To East Tiles */ startX=centerX; startY=centerY; desX=startX + 12; desY=startY; centToEastA=new RSTile[]{new RSTile(startX,startY),new RSTile(desX,desY)}; startX=desX + 3; desX=startX + 7; desY=centerY-4; centToEastB=new RSTile[]{new RSTile(startX,startY),new RSTile(desX,desY)}; eastToSEast=new RSTile(desX-7, desY-8); /* To South Tile */ startX=centerX; startY=centerY; desX=startX; desY=startY - 7; centToSouth=new RSTile[]{new RSTile(startX,startY),new RSTile(desX,desY)}; /* To South West Tile */ startX=centerX; startY=desY- 3; desX=startX - 8; desY=startY - 10; southToWest=new RSTile[]{new RSTile(startX,startY),new RSTile(desX,desY)}; sWestToSEast=new RSTile(centerX,desY); /* To South East Tile */ desX=startX + 10; desY=startY - 10; southToEast=new RSTile[]{new RSTile(startX,startY),new RSTile(desX,desY)}; } public int goPortal(int j)throws InterruptedException{ int p; if(j==0){ log("Choosing Random Portal"); p = random(1,5); }else{ p=j; } if(p==1){ log("Going to West Portal"); RSTilePath towestA = new RSTilePath(randomizePath(centToWestA, 2, 2), this); towestA.walkToEnd(); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } openDoor("West"); RSTilePath towestB = new RSTilePath(randomizePath(centToWestB, 2, 2), this); towestB.walkToEnd(); currentp="west"; } if(p==2){ log("Going to East Portal"); RSTilePath toEastA = new RSTilePath(randomizePath(centToEastA, 2, 2), this); toEastA.walkToEnd(); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } openDoor("East"); RSTilePath toeastB = new RSTilePath(randomizePath(centToEastB, 2, 2), this); toeastB.walkToEnd(); currentp="east"; } if(p==3){ log("Going to South-West Portal"); RSTilePath ToSouth = new RSTilePath(randomizePath(centToSouth, 2, 2), this); ToSouth.walkToEnd(); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } openDoor("South"); RSTilePath toSouthWest = new RSTilePath(randomizePath(southToWest, 2, 2), this); toSouthWest.walkToEnd(); currentp="sWest"; } if(p==4){ log("Going to South-East Portal"); RSTilePath toSouth = new RSTilePath(randomizePath(centToSouth, 2, 2), this); toSouth.walkToEnd(); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } openDoor("South"); RSTilePath toSouthEast = new RSTilePath(randomizePath(southToEast, 2, 2), this); toSouthEast.walkToEnd(); currentp="sEast"; } return random(200,400); } public int openDoor(String j) { RSObject temp = findObject(door); if(door == null){ return (random(50, 100)); }else{ wait(random(100, 200)); if(findObject(door) != null) { if(j == "West") { setCompass('w'); } else if(j == "East") { setCompass('e'); } else if(j == "South") { setCompass('s'); } } if(atDoor(findObject(door), j, "Open")){ wait(2000); } } return (random(100, 200)); } public int goFromPortal(int p)throws InterruptedException{ if(currentp=="west"){ if(p==2){ log("Going to East Portal"); walkToCenter(); goPortal(p); currentp="east"; } if(p==3){ log("Going to South-West Portal"); stayNearPortal(); myWalkTile(westToSWest,1); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } myWalkTile(southToWest[1],1); currentp="sWest"; } if(p==4){ log("Going to South-East Portal"); stayNearPortal(); myWalkTile(westToSWest,1); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } myWalkTile(southToWest[1],1); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } myWalkTile(sWestToSEast,1); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } myWalkTile(southToEast[1],1); wait(random(2800,3000)); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } currentp="sEast"; } return random(100,300); } if(currentp=="east"){ if(p==1){ log("Going to West Portal"); walkToCenter(); goPortal(p); } if(p==4){ log("Going to South-East Portal"); stayNearPortal(); wait(random(300,500)); myWalkTile(eastToSEast,1); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } myWalkTile(southToEast[1],1); currentp="sEast"; } if(p==3){ log("Going to South-West Portal"); stayNearPortal(); myWalkTile(eastToSEast,1); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } myWalkTile(southToEast[1],1); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } myWalkTile(sWestToSEast,1); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } myWalkTile(southToWest[1],1); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } currentp="sWest"; } return random(200,400); } if(currentp=="sWest"){ if(p==1){ log("Going to West Portal"); stayNearPortal(); wait(random(100,300)); myWalkTile(westToSWest,1); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } myWalkTile(centToWestB[1],1); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } currentp="west"; } if(p==2){ stayNearPortal(); log("Going to East Portal"); myWalkTile(sWestToSEast,1); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } myWalkTile(southToEast[1],1); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } myWalkTile(eastToSEast,1); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } myWalkTile(centToEastB[1],1); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } currentp="east"; wait(random(200, 500)); } if(p==4){ log("Going to South-East Portal"); stayNearPortal(); myWalkTile(sWestToSEast,1); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } myWalkTile(southToEast[1],1); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } currentp="sEast"; } return random(200,400); } if(currentp=="sEast"){ if(p==1){ stayNearPortal(); log("Going to West Portal"); myWalkTile(sWestToSEast,1); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } myWalkTile(southToWest[1],1); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } myWalkTile(westToSWest,1); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } myWalkTile(centToWestB[1],1); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } currentp="west"; wait(random(200, 500)); } if(p==2){ stayNearPortal(); log("Going to East Portal"); myWalkTile(eastToSEast,1); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } myWalkTile(centToEastB[1],1); currentp="east"; wait(random(200, 500)); } if(p==3){ log("Going to South-West Portal"); stayNearPortal(); myWalkTile(sWestToSEast,1); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } myWalkTile(southToWest[1],1); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } currentp="sWest"; } return random(100,300); } return random(200,400); } public int walkToCenter()throws InterruptedException{ if(distanceTo(center) < 7){ return -1; } if(currentp=="none"){ log("Walking to center"); myWalkTile(center1,3); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } wait(random(2000,2500)); myWalkTile(center,1); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } wait(random(400,600)); } if(currentp=="west"){ log("Walking to center"); RSTilePath towestB = new RSTilePath(randomizePath(centToWestB, 2, 2), this); towestB.walkToStart(); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } openDoor("East"); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } RSTilePath towestA = new RSTilePath(randomizePath(centToWestA, 2, 2), this); towestA.walkToStart(); } if(currentp=="east"){ log("Walking to center"); RSTilePath toeastB = new RSTilePath(randomizePath(centToEastB, 2, 2), this); toeastB.walkToStart(); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } openDoor("West"); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } RSTilePath toeastA = new RSTilePath(randomizePath(centToEastA, 2, 2), this); toeastA.walkToStart(); } if(currentp=="sWest"){ log("Walking to center"); RSTilePath toSouthWest = new RSTilePath(randomizePath(southToWest, 2, 2), this); toSouthWest.walkToStart(); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } wait(random(600, 800)); openDoor("North"); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } RSTilePath ToSouth = new RSTilePath(randomizePath(centToSouth, 2, 2), this); ToSouth.walkToStart(); } if(currentp=="sEast"){ log("Walking to center"); RSTilePath toSouthEast = new RSTilePath(randomizePath(southToEast, 2, 2), this); toSouthEast.walkToStart(); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } wait(random(600, 800)); openDoor("North"); while(getMyPlayer().isMoving()){ wait(random(100, 300)); } RSTilePath ToSouth = new RSTilePath(randomizePath(centToSouth, 2, 2), this); ToSouth.walkToStart(); } return random(200,400); } public void stayNearPortal()throws InterruptedException{ if(getMyPlayer().getAnimation() == -1 || !(getMyPlayer().isInCombat())) { if(currentp=="west"){ if(distanceTo(centToWestB[1]) > 5){ myWalkTile(centToWestB[1],1); while(getMyPlayer().isMoving()){ wait(random(400, 500)); } } } if(currentp=="east"){ if(distanceTo(centToEastB[1]) > 5){ myWalkTile(centToEastB[1],1); while(getMyPlayer().isMoving()){ wait(random(400, 500)); } } } if(currentp=="sWest"){ if(distanceTo(southToWest[1]) > 5){ myWalkTile(southToWest[1],1); while(getMyPlayer().isMoving()){ wait(random(400, 500)); } } } if(currentp=="sEast"){ if(distanceTo(southToEast[1]) > 5){ myWalkTile(southToEast[1],1); while(getMyPlayer().isMoving()){ wait(random(400, 500)); } } } } } public boolean newPortal()throws InterruptedException{ int g; int a; int b; int c; int d; int e; RSInterfaceChild west = RSInterface.getChildInterface(408, 13); String wh = west.getText(); log("West-portal health is at:"+wh); RSInterfaceChild east = RSInterface.getChildInterface(408, 14); String eh = east.getText(); log("East-portal health is at:"+eh); RSInterfaceChild sWest = RSInterface.getChildInterface(408, 16); String sWh = sWest.getText(); log("South-West portal health is at:"+sWh); RSInterfaceChild sEast = RSInterface.getChildInterface(408, 15); String sEh = sEast.getText(); log("South-East portal health is at:"+sEh); a=Integer.parseInt(wh); b=Integer.parseInt(eh); c=Integer.parseInt(sWh); d=Integer.parseInt(sEh); if(a > b){ g=a; e=1; }else{ g=b; e=2; } if(g < c){ g=c; e=3; } if(g < d){ g=d; e=4; } if(a == b && c == d && a==c && b==d){ g=random(1,4); e=g; } health = g; if(health == 0){ return false; }else{ if(distanceTo(center) < 7 || currentp=="none"){ walkToCenter(); goPortal(e); }else{ goFromPortal(e); } wait(random(600, 900)); return true; } } public boolean interfaceExists(int inte) { return (RSInterface.getInterface(inte).isValid()); } public void setBoat(){ if(setboat == false){ if(distanceTo(first) < 2 || distanceTo(firstB) < 2){ log("Novice"); bridge = first; boat= firstB; setboat = true; } if(distanceTo(second) < 2 || distanceTo(secondB) < 2){ log("Intermediate"); bridge = second; boat = secondB; setboat = true; } if(distanceTo(third) < 2 || distanceTo(thirdB) < 2){ log("Veteran"); bridge = third; boat = thirdB; setboat = true; } } } public void confirm(){ clickMouse(random(247, 253), random(290,294),true); } public boolean findV(){ while(!interfaceExists(267)){ atNPC2(getNearestNPCByID(Evoid), "Exchange"); return false; } return true; } public boolean spendPoints(){ if(num==0){ return true; } if(distanceTo(voidE) > 5){ if(bridge==third){ setCameraRotation(1); clickMouse(random(678,685),random(112,117),true); wait(random(4000, 5000)); } myWalkTile(voidE,1); wait(random(4000, 5000)); while(getMyPlayer().isMoving()){ wait(random(500, 900)); } } while(getMyPlayer().isMoving()){ wait(random(1000, 1200)); } while(!findV()){wait(400);}; wait(random(800,1100)); if(num==1){//Attack log("Buying attack exp"); clickMouse(random(202,205),random(70,74),true); confirm(); while(!findV()){wait(200);}; clickMouse(random(202,205),random(70,74),true); confirm(); return true; }else if(num==2){//Strength log("Buying strength exp"); clickMouse(random(420,424),random(68,72),true); confirm(); while(!findV()){wait(200);}; clickMouse(random(420,424),random(68,72),true); confirm(); return true; }else if(num==3){//Defence log("Buying defence exp"); clickMouse(random(202,206),random(106,110),true); confirm(); while(!findV()){wait(200);}; clickMouse(random(202,206),random(106,110),true); confirm(); return true; }else if(num==7){//Hitpoints log("Buying hitpoints exp"); clickMouse(random(425,429),random(143,157),true); confirm(); while(!findV()){wait(200);}; clickMouse(random(425,429),random(143,157),true); confirm(); return true; }else if(num==4){//Range log("Buying range exp"); clickMouse(424+random(1,4),104+random(1,4),true); confirm(); while(!findV()){wait(200);}; clickMouse(424+random(1,4),104+random(1,4),true); confirm(); return true; }else if(num==6){//Magic log("Buying magic exp"); clickMouse(random(204,208),random(145,149),true); confirm(); while(!findV()){wait(200);}; clickMouse(random(204,208),random(145,149),true); confirm(); return true; }else if(num==5){//Prayer log("Buying prayer exp"); clickMouse(random(204,208),random(183,187),true); confirm(); while(!findV()){wait(200);}; clickMouse(random(204,208),random(183,187),true); confirm(); return true; } return false; } public int avoidBrawler(RSNPC temp){ if(temp == null){ return random(100,300); } if(getMyPlayer().getAnimation() != -1 || getMyPlayer().isInCombat()) { return random(100, 200); } RSNPC brawler = getNearestNPCByName("Brawler"); if(brawler==null){ return -1; } RSTile brawl = brawler.getLocation(); int bX= brawl.getX(); int bY= brawl.getY(); RSTile player = getMyPlayer().getLocation(); int pX= player.getX(); int pY= player.getY(); RSTile attack = temp.getLocation(); int aX=attack.getX(); int aY=attack.getY(); if(distanceTo(brawler) < 2){ if(pX==bX+1 || pX==bX-1 || pX==bX){ if(pX==aX || pX==aX+1 || pX==aX-1){ RSTile to = new RSTile(pX+random(3,4), pY); myWalkTile(to,1); while(getMyPlayer().isMoving()){ wait(random(500, 900)); } RSTile monst= temp.getLocation(); int tY=monst.getY(); player = getMyPlayer().getLocation(); pX= player.getX(); RSTile too = new RSTile(pX, tY); myWalkTile(too,1); wait(random(1000, 1100)); while(getMyPlayer().isMoving()){ wait(random(500, 900)); } myWalkTile(monst,1); while(getMyPlayer().isMoving()){ wait(random(500, 900)); } return random(100,300); } } if(pY==bY+1 || pY==bY-1 || pY==bY){ if(pY==aY || pY==aY+1 || pY==aY-1){ RSTile to = new RSTile(pX, pY+random(3,4)); myWalkTile(to,1); wait(random(1000, 1100)); while(getMyPlayer().isMoving()){ wait(random(500, 900)); } RSTile monst= temp.getLocation(); int tX=monst.getX(); player = getMyPlayer().getLocation(); pY= player.getY(); RSTile too = new RSTile(tX, pY); myWalkTile(too,1); while(getMyPlayer().isMoving()){ wait(random(500, 900)); } myWalkTile(monst,1); while(getMyPlayer().isMoving()){ wait(random(500, 900)); } return random(20,100); } return random(100,300); } return random(100,300); } return random (10,20); } public int extract(String s) { int j = s.length()-1; while (j >= 0 && Character.isDigit(s.charAt(j))) { j--; } return Integer.parseInt(s.substring(j+1,s.length())); } public boolean myWalkTile(RSTile theTile, int randomness) { //BY TENAC if(theTile == null) return false; if((distanceTo(theTile)) <= 17) { RSTile newTile; if(randomness == 0) newTile = new RSTile(theTile.getX(), theTile.getY()); else newTile = new RSTile(theTile.getX() + random(-randomness, randomness), theTile.getY() + random(-randomness, randomness)); if(random(0, 30) == 0) turnToTile(newTile, 15); if(tileOnScreen(newTile) && random(0, 10) == 0) { if(!atTile(newTile, "Walk")) { if(!walkTileMM(newTile)) { //log("Failed walking to tile: (" + theTile.getX() + ", " + theTile.getY() + ")"); return false; } else { return true; } } else { return true; } } else { if(!walkTileMM(newTile)) { //log("Failed walking to tile: (" + theTile.getX() + ", " + theTile.getY() + ")"); return false; } else { return true; } } } else { //log("Tile out of reach: (" + theTile.getX() + ", " + theTile.getY() + ")"); return false; } } public boolean atNPC2(RSNPC npc, String action) { if (npc == null) return false; RSTile tile = npc.getLocation(); if (!tile.isValid()) return false; if (distanceTo(tile) > 4) { myWalkTile(tile,1); wait(750 + random(0, 250)); while(getMyPlayer().isMoving()) wait(40); } return clickCharacter2(npc, action); } public boolean clickCharacter2(RSCharacter c, String action) { Point screenLoc = null; for (int i = 0; i < 20; i++) { screenLoc = c.getScreenLocation(); if (!c.isValid() || !pointOnScreen(screenLoc)) return false; if (getMouseLocation().equals(screenLoc)) break; moveMouse(screenLoc); } screenLoc = c.getScreenLocation(); if (!getMouseLocation().equals(screenLoc)|| getMyPlayer().getInteracting() != null) return false; if (getMenuItems().get(0).toLowerCase().contains(action.toLowerCase())) { clickMouse(screenLoc, true); return true; } else { clickMouse(screenLoc, false); return atMenu(action); } } public void onRepaint(Graphics g) { long l = System.currentTimeMillis() - startTime; long l1 = l / 1000L; long l2 = l1 / 60L; long l3 = l2 / 60L; int i = (int)l1 % 60; int j = (int)l2 % 60; int k = (int)l3 % 60; StringBuilder stringbuilder = new StringBuilder(); if(k < 10) stringbuilder.append('0'); stringbuilder.append(k); stringbuilder.append(':'); if(j < 10) stringbuilder.append('0'); stringbuilder.append(j); stringbuilder.append(':'); if(i < 10) stringbuilder.append('0'); stringbuilder.append(i); if(isLoggedIn()){ if(bridge==first){ points = won*2; } if(bridge==second){ points = won*3; } if(bridge==third){ points = won*4; } byte byte0 = 18; int i1 = 240; g.setColor(Color.GREEN); g.drawString("SmartPC", byte0, i1); g.setColor(Color.WHITE); g.drawString((new StringBuilder()).append("Elapsed time: ").append(stringbuilder.toString()).toString(), byte0, i1 += 20); g.drawString((new StringBuilder()).append("Games won: ").append(won).append(" games").toString(), byte0, i1 += 15); g.drawString((new StringBuilder()).append("Games lost: ").append(lost).append(" games").toString(), byte0, i1 += 15); g.drawString((new StringBuilder()).append("Total points: ").append(jpoints).append(" points").toString(), byte0, i1 += 15); } } }