Code:
import impsoft.ibot.Areas;
import impsoft.ibot.methods.NPCChat;
import impsoft.ibot.methods.RGB;
import impsoft.ibot.methods.Random;
import impsoft.ibot.methods.XY;
import java.awt.Rectangle;
public class yellowtext extends Random {
public static double version = 1;
public String author = "GenoDemoN, ruler";
public String description = "finds yellow text with you name and talks to NPC centered underneath";
private String formatedUserName;
private XY userNameOnScreen;
@Override
public boolean startUp() {
if (!theBot.loggedIn) {
formatedUserName = null;
setNextCheck(3000);
return false;
} else {
if (formatedUserName == null) {
if (theBot.theHandler.theUser.length() < 5) {
log("STOP player username not found, please enter it in user/pass tab");
deActivateRandom();
}
formatedUserName = formatword(theBot.theHandler.theUser);
}
userNameOnScreen = findGameScreenText(formatedUserName, Areas.GAME,
new RGB(255, 255, 1), 1, 1, 1);
if (userNameOnScreen != null) {
log("found name onscreen!");
return true;
}
setNextCheck(600);
return false;
}
}
private String formatword(String username) {
username = username.toLowerCase();
int index = 0;
index = username.indexOf(" ", index);
while (index != -1) {
String front = username.substring(0, index);
String middle = username.substring(index, index + 2);
String back = username.substring(index + 2, username.length());
username = (front + middle.toUpperCase() + back);
index = username.indexOf(" ", index + 2);
}
if (username.length() > 1) {
String front = username.substring(0, 1);
String back = username.substring(1, username.length());
username = front.toUpperCase() + back;
}
return username;
}
@Override
public void random() throws InterruptedException {
Rectangle textLine = new Rectangle(Areas.GAME.x,
userNameOnScreen.y - 1, Areas.GAME.x + Areas.GAME.width, 15);
XY startOfTextOnScreen = findXYspiral(textLine, 0,
userNameOnScreen.y - 1, new RGB(255, 255, 1), 1, 1, 1);
XY endOfTextOnScreen = findXYspiral(textLine, Areas.GAME.x
+ Areas.GAME.width, userNameOnScreen.y - 1,
new RGB(255, 255, 1), 1, 1, 1);
if (startOfTextOnScreen != null && endOfTextOnScreen != null) {
String textTheNPCSaid = getGameScreenText(0, userNameOnScreen.y, 1,
new RGB(255, 255, 1));
if (textTheNPCSaid != null) {
log("NPC said: " + textTheNPCSaid);
if (textTheNPCSaid.toLowerCase().indexOf(
"think I forgot about you") != -1) {
log("Molly found shutDown()");
// molly random
return;
}
}
XY CenterOfText = new XY(startOfTextOnScreen.x
+ (endOfTextOnScreen.x - startOfTextOnScreen.x) / 2,
userNameOnScreen.y);
for (int i = 0; (i + CenterOfText.y) < (Areas.GAME.y + Areas.GAME.height); i += random(
7, 16)) {
mouseMove(CenterOfText.x + random(-3, 3), CenterOfText.y + i,
100);
sleep(defaultmaxAgeInMillisecs);
getColorArray2d();
if (getTopText().indexOf("Talk") > 0) {
mouseClickLeft(currentMouseX(), currentMouseY());
sleep(950);
log("Found NPC and iniciated talking");
NPCChat chat = getNPCChat(2000);
while (chat != null) {
mouseClickLeft(chat.locations[chat.locations.length - 1]);
sleep(1000);
chat = getNPCChat(2000);
}
break;
}
}
}
}
}
Benland wrote a box solver in java in mopar's cm.