When using the script in pc bank I don't know why , but it keeps clicking outside the bank and exposed to the public , I want to remain hidden inside the bank not my guy randomly clicking on the mini map -.- This is the bot tell me what to fix in the script please , so it stops this.
import java.awt.*;
import java.util.Map;
import com.speljohan.rsbot.bot.Bot;
import com.speljohan.rsbot.script.Script;
import com.speljohan.rsbot.script.wrappers.*;
import com.speljohan.rsbot.event.listeners.*;
public class AutoAlcher extends Script implements PaintListener {
//public int spellid;
public int item;
public static int natureid = 561;
public int x1, x2, y1, y2;
public int a1, a2, b1, b2;
public int done;
public long startTime;
public int startLevel;
public int startXP;
public double getVersion() {
return 0.3;
}
public String getScriptCategory() {
return "Magic";
}
public String getName() {
return "AutoAlcher";
}
public String getAuthor() {
return "Zachafer";
}
public boolean onStart(Map<String, String> args) {
if (args.get("alch").equals("low")) { //they chose low alching
//spellid = 14;
x1 = 704;
x2 = 727;
y1 = 241;
y2 = 264;
a1 = 689;
a2 = 720;
b1 = 249;
b2 = 280;
} else { //they chose high alching
//spellid = 36;
x1 = 560;
x2 = 583;
y1 = 337;
y2 = 360;
a1 = 563;
a2 = 594;
b1 = 321;
b2 = 352;
}
try {
item = Integer.parseInt(args.get("id"));
} catch (Exception e) {
log("Enter numbers only for the item ID!");
return false;
}
done = 0;
startTime = System.currentTimeMillis();
startLevel = skills.getCurrentSkillLevel(6);
startXP = skills.getCurrentSkillExp(6);
/*
log("Alch type = " + args.get("alch"));
log("Item ID = " + item);
*/
return true;
}
public void onRepaint(Graphics g) {
if (isLoggedIn()) {
long millis = System.currentTimeMillis() - startTime;
long hours = millis / (1000 * 60 * 60);
millis -= hours * 1000 * 60 * 60;
long minutes = millis / (1000 * 60);
millis -= minutes * 1000 * 60;
long seconds = millis / 1000;
int XPChange = skills.getCurrentSkillExp(6) - startXP;
int LevelChange = skills.getCurrentSkillLevel(6) - startLevel;
g.setColor(Color.red);
g.drawString("Level " + skills.getCurrentSkillLevel(6)
+ " Magic, " + skills.getXPToNextLevel(6)
+ " exp until next level. (" + skills.getPercentToNextLevel(6) + "%)", 18, 235);
g.drawString("Gained " + LevelChange + " levels and " + XPChange
+ " exp.", 18, 250);
g.drawString("Runtime: " + hours + " hours " + minutes
+ " minutes " + seconds + " seconds.", 18, 265);
}
}
public int loop() {
if (!inventoryContains(natureid)) {
log("Out of nature runes!");
return -1;
}
if (!inventoryContains(item)) {
log("Out of items to alch!");
return -1;
}
openTab(TAB_MAGIC);
clickMouse(random(x1, x2), random(y1, y2), true);
wait(random(300, 800));
int oldXP = skills.getCurrentSkillExp(6);
clickMouse(random(a1, a2), random(b1, b2), true);
int rndWait = random(300, 600);
wait(rndWait);
if (skills.getCurrentSkillExp(6) > oldXP) done++;
return random(1250, 2250) - rndWait;
}
public void onFinish() {
Bot.getEventManager().removeListener(PaintListener.class, this);
}
public String getScriptDescription() {
String html = "";
html += "<html>";
html += "<center>";
html += "<h2>" + getName() + "</h2>";
html += "<br />";
html += "<b>Author:</b> " + getAuthor();
html += "<br />";
html += "<b>Version:</b> " + getVersion();
html += "<br /><br />";
html += "<b>Arguments:</b>";
html += "<br />";
html += "<br />";
html += "<form>";
html += "<input type=\"radio\" name=\"alch\" value=\"low\"> Low alch";
html += " <input type=\"radio\" name=\"alch\" value=\"high\" checked=\"true\"> High alch";
html += "<br />Item ID: <input type=\"text\" name=\"id\">";
html += "</form>";
html += "</center>";
html += "</html>";
return html;
}
}
import java.awt.*;
import java.util.Map;
import com.speljohan.rsbot.bot.Bot;
import com.speljohan.rsbot.script.Script;
import com.speljohan.rsbot.script.wrappers.*;
import com.speljohan.rsbot.event.listeners.*;
public class AutoAlcher extends Script implements PaintListener {
//public int spellid;
public int item;
public static int natureid = 561;
public int x1, x2, y1, y2;
public int a1, a2, b1, b2;
public int done;
public long startTime;
public int startLevel;
public int startXP;
public double getVersion() {
return 0.3;
}
public String getScriptCategory() {
return "Magic";
}
public String getName() {
return "AutoAlcher";
}
public String getAuthor() {
return "Zachafer";
}
public boolean onStart(Map<String, String> args) {
if (args.get("alch").equals("low")) { //they chose low alching
//spellid = 14;
x1 = 704;
x2 = 727;
y1 = 241;
y2 = 264;
a1 = 689;
a2 = 720;
b1 = 249;
b2 = 280;
} else { //they chose high alching
//spellid = 36;
x1 = 560;
x2 = 583;
y1 = 337;
y2 = 360;
a1 = 563;
a2 = 594;
b1 = 321;
b2 = 352;
}
try {
item = Integer.parseInt(args.get("id"));
} catch (Exception e) {
log("Enter numbers only for the item ID!");
return false;
}
done = 0;
startTime = System.currentTimeMillis();
startLevel = skills.getCurrentSkillLevel(6);
startXP = skills.getCurrentSkillExp(6);
/*
log("Alch type = " + args.get("alch"));
log("Item ID = " + item);
*/
return true;
}
public void onRepaint(Graphics g) {
if (isLoggedIn()) {
long millis = System.currentTimeMillis() - startTime;
long hours = millis / (1000 * 60 * 60);
millis -= hours * 1000 * 60 * 60;
long minutes = millis / (1000 * 60);
millis -= minutes * 1000 * 60;
long seconds = millis / 1000;
int XPChange = skills.getCurrentSkillExp(6) - startXP;
int LevelChange = skills.getCurrentSkillLevel(6) - startLevel;
g.setColor(Color.red);
g.drawString("Level " + skills.getCurrentSkillLevel(6)
+ " Magic, " + skills.getXPToNextLevel(6)
+ " exp until next level. (" + skills.getPercentToNextLevel(6) + "%)", 18, 235);
g.drawString("Gained " + LevelChange + " levels and " + XPChange
+ " exp.", 18, 250);
g.drawString("Runtime: " + hours + " hours " + minutes
+ " minutes " + seconds + " seconds.", 18, 265);
}
}
public int loop() {
if (!inventoryContains(natureid)) {
log("Out of nature runes!");
return -1;
}
if (!inventoryContains(item)) {
log("Out of items to alch!");
return -1;
}
openTab(TAB_MAGIC);
clickMouse(random(x1, x2), random(y1, y2), true);
wait(random(300, 800));
int oldXP = skills.getCurrentSkillExp(6);
clickMouse(random(a1, a2), random(b1, b2), true);
int rndWait = random(300, 600);
wait(rndWait);
if (skills.getCurrentSkillExp(6) > oldXP) done++;
return random(1250, 2250) - rndWait;
}
public void onFinish() {
Bot.getEventManager().removeListener(PaintListener.class, this);
}
public String getScriptDescription() {
String html = "";
html += "<html>";
html += "<center>";
html += "<h2>" + getName() + "</h2>";
html += "<br />";
html += "<b>Author:</b> " + getAuthor();
html += "<br />";
html += "<b>Version:</b> " + getVersion();
html += "<br /><br />";
html += "<b>Arguments:</b>";
html += "<br />";
html += "<br />";
html += "<form>";
html += "<input type=\"radio\" name=\"alch\" value=\"low\"> Low alch";
html += " <input type=\"radio\" name=\"alch\" value=\"high\" checked=\"true\"> High alch";
html += "<br />Item ID: <input type=\"text\" name=\"id\">";
html += "</form>";
html += "</center>";
html += "</html>";
return html;
}
}


