SRL Archive - Discussions and Debates

Evil Bob


ruler

2007-04-11 07:19:00

I dont think SRL has a public Evil Bob

Bascially the solution is to take a screenshot about 2 seconds or so after the camera is moving. Then make a array of booleans, set each element to true if it is gold colored. Remove gold points that are not near other points. Then crop this zone. Calculate the ratio of height/width. From the ratio you will have a pretty accurate idea which it is.

Happy convertings

import impsoft.nexus.bots.color.constants.Areas;
import impsoft.nexus.bots.color.methods.ColorRandom;
import impsoft.nexus.bots.color.methods.GameScreenMethods;
import impsoft.nexus.bots.color.scriptobjects.NPCChat;
import impsoft.nexus.bots.color.scriptobjects.RGB;
import impsoft.nexus.bots.color.scriptobjects.RGBCluster;
import impsoft.nexus.bots.color.scriptobjects.Timer;
import impsoft.nexus.bots.paint.SimplePaintJob;
import impsoft.nexus.bots.reflection.scriptobjects.walking.AryanTile;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;

public class EvilBob extends ColorRandom {
private AryanTile center = new AryanTile(2524, 4777, this);
private AryanTile catScard = new AryanTile(2528, 4790, this);
private AryanTile catPraying = new AryanTile(2542, 4777, this);
private AryanTile catAttacking = new AryanTile(2536, 4765, this);
private AryanTile catDead = new AryanTile(2512, 4775, this);

public boolean inIsland() {
return center.distanceTo() < 30;
}

@Override
public boolean startUp() throws InterruptedException {
setNextCheck(6000);
return isLoggedin() && inIsland();
}

public void paint(final int xOff, final int yOff, boolean[][] diffs, Color color, final int time) {
final BufferedImage bf = new BufferedImage(diffs.length, diffs[0].length,
BufferedImage.TYPE_INT_ARGB);
color = new Color(color.getRed(), color.getGreen(), color.getBlue(), 127);
Color blank = new Color(color.getRed(), color.getGreen(), color.getBlue(), 0);
for (int x = 0; x < diffs.length; x++) {
boolean xSlice[] = diffs[x];
for (int y = 0; y < diffs[0].length; y++) {
if (xSlice[y]) {
bf.setRGB(x, y, color.getRGB());
} else {
bf.setRGB(x, y, blank.getRGB());
}
}
}
addPaintJob(new SimplePaintJob(time) {
@Override
public void paint(Graphics g) {
g.drawImage(bf, xOff, yOff, null);
}
});
}

private RGB[] goldRGBS = new RGB[] { new RGB(234, 203, 114), new RGB(213, 180, 77),
new RGB(155, 131, 55), new RGB(222, 188, 80), new RGB(73, 61, 25), new RGB(105, 89, 37) };

@Override
public void random() throws InterruptedException {
log("We are at Evil Bob's Island");
while (true) {
final int goldRGBSLength = goldRGBS.length;
short[][] goldPixel = new short[goldRGBSLength][3];
int[][] goldPixeltolerances = new int[goldRGBSLength][3];
for (int i = 0; i < goldRGBSLength; i++) {
goldPixel[i] = goldRGBS[i].toPixle();
goldPixeltolerances[i][0] = GameScreenMethods.getGameScreenTolerance(goldPixel[i][0]);
goldPixeltolerances[i][1] = GameScreenMethods.getGameScreenTolerance(goldPixel[i][1]);
goldPixeltolerances[i][2] = GameScreenMethods.getGameScreenTolerance(goldPixel[i][2]);
}
boolean[][] golds = new boolean[Areas.GAME.width][Areas.GAME.height];
if (!TalkToServant()) {
return;
}
sleep(2000);
short[][][] colorMap = getColorArray2d();
for (int x = 15; x < Areas.GAME.width - 30; x++) {
short[][] xPiece = colorMap[x + Areas.GAME.x];
for (int y = 15; y < Areas.GAME.height - 30; y++) {
short[] yPiece = xPiece[y + Areas.GAME.y];
for (int i = 0; i < goldRGBSLength; i++) {
if (matching(yPiece, goldPixel[i], goldPixeltolerances[i][0],
goldPixeltolerances[i][1], goldPixeltolerances[i][2])) {
golds[x][y] = true;
}
}
}
}
for (int x = 15; x < golds.length - 30; x++) {
for (int y = 15; y < golds[0].length - 30; y++) {
if (golds[x][y]) {
int matches = 0;
for (int xSmall = -4; xSmall < 9; xSmall++) {
for (int ySmall = -4; ySmall < 9; ySmall++) {
if (golds[x + xSmall][y + ySmall]) {
matches++;
}
}
}
golds[x][y] = matches > 10;
}
}
}
int minX = -1;
int maxX = -1;
int minY = -1;
int maxY = -1;
for (int x = 0; x < golds.length; x++) {
for (int y = 0; y < golds[0].length; y++) {
if (golds[x][y]) {
if (minX == -1) {
minX = x;
}
maxX = x;
if (minY == -1 || y < minY) {
minY = y;
}
if (maxY == -1 || y > maxY) {
maxY = y;
}
}
}
}
if (minX != -1 && maxX != -1 && minY != -1 && maxY != -1) {
Rectangle rec = new Rectangle(0, 0, maxX - minX, maxY - minY);
boolean[][] reduced = new boolean[rec.width][rec.height];
for (int x = 0; x < reduced.length; x++) {
for (int y = 0; y < reduced[0].length; y++) {
reduced[x][y] = golds[x + minX][y + minY];
}
}
paintRectangle(rec, Color.WHITE, 10000);
paint(0, 0, reduced, Color.BLACK, 10000);
log(rec.height);
log(rec.width);
double ratio = (double) rec.height / rec.width;
log(ratio);
sleep(10000);
if (rec.height < 100) {
double options[] = new double[] { 2.46, 2.23, 1.45, 1.2 };
int winner = 0;
for (int i = 0; i < options.length; i++) {
if (Math.abs(ratio - options[winner]) > Math.abs(ratio - options[i])) {
winner = i;
}
}
switch (winner) {
case 0:
log("Praying?");
catPraying.walkTo();
break;
case 1:
log("Attacking?");
catAttacking.walkTo();
break;
case 2:
log("Dead?");
catDead.walkTo();
break;
case 3:
log("Scard?");
catScard.walkTo();
break;
}
fish();
unCook();
TalkToBob();
}
}
// paint(Areas.GAME.x, Areas.GAME.y, golds, Color.BLACK, 10000);
sleep(10000);
}
}

public static final boolean matching(short rgb[], short rgb2[], int redTolerance,
int greenTolerance, int blueTolerance) {
int redChange = rgb[0] - rgb2[0];
if ((redChange >= 0 ? redChange : -redChange) > redTolerance) {
return false;
}
int greenChange = rgb[1] - rgb2[1];
if ((greenChange >= 0 ? greenChange : -greenChange) > greenTolerance) {
return false;
}
int blueChange = rgb[2] - rgb2[2];
if ((blueChange >= 0 ? blueChange : -blueChange) > blueTolerance) {
return false;
}
return true;
}

public void TalkToBob() throws InterruptedException {
doActionAtInventory("fishlike", "Use", 1);
center.walkTo();
Timer t = new Timer(20000);
while (!t.isUp()) {
RGBCluster cluster = new RGBCluster(new RGB[] { new RGB(21, 17, 17) }, this);
cluster.gatherNewPoints(10);
if (cluster.doTopTextAndMenu("Evil", "Use")) {
break;
}
sleep(defaultmaxAgeInMillisecs);
}
NPCChat chat = getNPCChat(6000);
if (chat != null) {
}
}

public boolean TalkToServant() throws InterruptedException {
center.walkTo();
Timer t = new Timer(20000);
while (!t.isUp()) {
RGBCluster cluster = new RGBCluster(new RGB[] { new RGB(183, 141, 104) }, this);
cluster.gatherNewPoints(10);
cluster.doTopTextAndMenu("Ser", "alk");
NPCChat chat = getNPCChat(2000);
if (chat != null) {
if (chat.contains("asleep")) {
exit();
return false;
}
chat.selectContains("Click");
break;
}
}
return true;
}

public void exit() throws InterruptedException {
doActionAtRGBCluster(new RGB(191, 191, 122), "Portal", "Portal");
}

public void fish() throws InterruptedException {
log("Fishing");
Timer t = new Timer(20000);
while (!t.isUp()) {
if (doActionAtRGBCluster(new RGB[] { new RGB(196, 143, 113), new RGB(136, 176, 233),
new RGB(112, 152, 204), new RGB(144, 184, 236) }, "Net", "Net")) {
NPCChat chat = getNPCChat(15000);
if (chat != null) {
chat.selectContains("here");
break;
}
}
sleep(defaultmaxAgeInMillisecs);
}
}

public void unCook() throws InterruptedException {
log("Going to unCook");
center.walkTo();
Timer t = new Timer(20000);
while (!t.isUp()) {
if (doActionAtInventory("Fishlike", "Use", 1)) {
RGBCluster cluster = new RGBCluster(new RGB[] { new RGB(59, 96, 156) }, this);
cluster.gatherNewPoints(10);
if (cluster.doTopTextAndMenu("cook", "Use")) {
break;
}
}
}
sleep(4000);
}
}

Secet

2007-04-11 07:48:07

Thanks I guess :rolleyes:

Bobarkinator

2007-04-11 08:07:44

Oh boy converting a java script…I have no idea how to script java…

Starblaster100

2007-04-11 13:13:55

Whats the evil bob random?

SKy Scripter

2007-04-11 13:20:44

Whats the evil bob random?


lol you seriuos….
it's this like.. dumb cat that takes you to this island and makes you fish

WT-Fakawi

2007-04-11 13:34:18

Hey hey ruler, good work! Great to see you are making massive progress on the randoms! This will surely boost the usability of iBot. Too bad I will need to pay to get full antirandom protection though, but thanks for sharing this one! Have you managed to convert all the other SRL-antirandoms yet?

Wizzup?

2007-04-11 14:02:48

Good Job ruler, thanks for sharing!

ruler

2007-04-11 15:04:18

We have converted a few SRL Randoms but often they dont work.

Beekeeper, Sandwich Lady have been converted but yet to confirm they operate. We use to have a few more but they didn't seem to work. I converted them using SCAR docs but i think they may operate differently in SCAR.

Recently someone sent us a acct that had a Drill Demon they said SRL failed on it. The implementation of the SRL random in iBot also failed. So i re-wrote it since i could actaully see the random. Its hard converting the scar code when you have no idea what it is actually solving hehe.


My re-write included.
1. Read NPCChat to find text instead of using bitmaps on the chat.
2. Set the camera down before checking signs.
3. Use canReach to determine the box we are in then click on center of box we are in.
4. Uses menus instead of Left Mouse Clicks

According to the scar docs it was setting the camera up instead of down, also it was uing 70 tolerance so many false matches.

Hopefully i get a Beekeeper, Sandwich Lady so i can test those.

Many randoms branch out of 2 basic randoms.

One being the Click Here to Continue

public void solveClickToContinue() throws InterruptedException {
boolean sandWich = false;
boolean frog = false;
boolean axe = false;
boolean Damien = false;
while (true) {
if (matches != null && matches.length > 0) {
mouseClickLeft(bitmapToRectangle(matches[0], clickHereColorMap));
break;
}
chat = getNPCChat(2000);
if (chat == null) {
break;
}
sandWich = chat.contains("Sandwich");
frog = chat.contains("Frog");
Damien = chat.contains("Damien") && !chat.contains("actually");
if (Damien) {
solveDrillDemon();
break;
}
// You need a Pickaxe to mine this rock. You do not have a Pickaxe
// which you have the Mining level to use.
axe = chat.contains("You need a Pickaxe to mine this rock. You do not have a Pickaxe")
&& chat.contains("which you have the Mining level to use. ");
if (!chat.selectContains("Click here")) {
break;
}
sleep(defaultmaxAgeInMillisecs * 5);
chat = getNPCChat(2000);
}
if (sandWich) {
solveSandWhich();
}
if (frog) {
//frog is solved by the YellowTextRandom and/or Frog Cave random
}
if (axe) {
solveAxeHead();
}
}

Other being name on screen

public boolean startUp() {
if (!isLoggedin()) {
formatedUserName = null;
setNextCheck(3000);
return false;
} else {
if (formatedUserName == null) {
if (theBot.theHandler.getUsername().length() < 5) {
error("STOP player username not found, please enter it in user/pass tab");
deActivateRandom();
}
formatedUserName = formatword(theBot.theHandler.getUsername());
}
userNameOnScreen = findGameScreenText(formatedUserName, Areas.GAME,
new RGB(255, 255, 1), 1, 1, 1);
if (userNameOnScreen != null) {
warn("found name onscreen!");
return true;
}
setNextCheck(600);
return false;
}

}



@Override
public void random() throws InterruptedException {
Rectangle textLine = new Rectangle(Areas.GAME.x,
userNameOnScreen.y - 1, Areas.GAME.width, 20);
short[][][] currentGame = getColorArray2d(1000);
XY startOfTextOnScreen = findXYspiral(currentGame,
new RGB(255, 255, 1), textLine, textLine.x, textLine.y, 1, 1, 1);
XY endOfTextOnScreen = findXYspiral(currentGame, new RGB(255, 255, 1),
textLine, textLine.x + textLine.width, textLine.y, 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().contains("Sandwich")) {
log("looks like a sanwich lady");
//talk to here let the NPCChat random pickup
} else if (textTheNPCSaid.toLowerCase().contains("kiss her")) {
log("Frog found");
Timer t = new Timer(20000);
while (!t.isUp()) {
//talk to frog for 20secs
talkToQueen();
}
return;
}

}
XY CenterOfText = new XY(startOfTextOnScreen.x
+ (endOfTextOnScreen.x - startOfTextOnScreen.x) / 2,
userNameOnScreen.y);
for (int i = 0; i < 10; i++) {
for (int y = CenterOfText.y; y < (Areas.GAME.y + Areas.GAME.height); y += random(
7, 16)) {
mouseMove(CenterOfText.x + random(-10, 10), y, 500);
sleep(defaultmaxAgeInMillisecs);
if (getTopText().contains("alk")) {
mouseClickRight(currentMouseX(), currentMouseY());
Menu menu = getMenu(Areas.GAME, 2000);
if (menu != null) {
if (!menu.selectContains("alk")) {
menu.exit();
}
}
sleep(950);
log("Found NPC and iniciated talking");
NPCChat chat;
while ((chat = getNPCChat(2000)) != null) {
mouseClickLeft(chat.locations[chat.locations.length - 1]);
sleep(1000);
}
return;
}
}
}

}
}

ruler

2007-04-11 15:09:03

Modified Drill Demon

static short[][][] JOI, PUI, SUI, SJI;
static {
JOI = BitmapFromString(16, 16, "z78DA333534773631334"
+ "522CDCD2CDCCC0C9049530C359490B8CCA7B5BD1646964E668EC8"
+ "7651620E26896926756DA15DC860863FADCDC7155694DB8E3F2EC"
+ "84B63C4C405A92EC7958AA8152FC4984CAD3C3574CDA75DCAA74F" + "6EA2DC1C00723A4CAA");
PUI = BitmapFromString(34, 13, "z78DA33353477363133"
+ "0593E666166E6606C8A42992ECD02287B75F86BA8F30490B33470"
+ "33367647238F985127278F862F0F885BA3E1D3CBE185A31488999"
+ "B4F01779BEA675C8D0DF2F43B19C19EA75FA706D5F0100796C404" + "2");
SUI = BitmapFromString(30, 12, "z78DAD5D43D0AC0200C0"
+ "5E02B5968A26B117AFF2375C81290486C5EFAB3BC41A2F9202A6D"
+ "B5EF4C46363E0A77499A567E21B5F64973A4D768CE96C7BB58E60"
+ "C39AACBDC8C95C7CFF7685172D4F9D6AE0CB9A757FCC7589D4264"
+ "6A7EF9BBE6CAEDE42269AD8BC4AA44DDF955ED5C3E9A7525F6B5D" + "E336BE77FF302B4A3D7DD");
SJI = BitmapFromString(20, 16, "z78DA333534773631"
+ "3325913437B37033338090A66499604AB1BD94DB6E61E66860E68"
+ "C4C52D734FC66E2524F1E495D37D3C22EF2DC40BBB43472EC1D6C"
+ "714A7F7B6991DF89CFF594DB8B59EE1163262EB7915A7EE2B297F"
+ "890C1743FA9B6131F6EE4F971A048007EBDA1AD");
}

public void solveDrillDemon() throws InterruptedException {
log("DrillDemon");
setCompass(Compass.NORTH);
do {
short[][][] excercise = null;
//Move camera down
SendArrowSilentWait(2, 1000 + Random(500));
chat = getNPCChat(2000);
if (chat != null) {
if (chat.contains("jog")) {
info("jog");
excercise = JOI;
} else if (chat.contains("sit")) {
info("sit");
excercise = SUI;
} else if (chat.contains("star")) {
info("star");
excercise = SJI;
} else if (chat.contains("push")) {
info("push");
excercise = PUI;
}
}
if (excercise == null) {
log("Failed to find the excerise name from NPCChat");
break;
}
{
//Move to center
Timer t = new Timer(30000);
boolean done = false;
while (!done && !t.isUp()) {
boolean[][] canReach = getZoneCanReach();
int greens = countZone(canReach);
int minX = -1;
int maxX = -1;
int minY = -1;
int maxY = -1;
if (greens < 1600) {
for (int x = 0; x < canReach.length; x++) {
for (int y = 0; y < canReach[0].length; y++) {
if (canReach[x][y]) {
if (minX == -1) {
minX = x;
}
maxX = x;
if (minY == -1 || y < minY) {
minY = y;
}
if (maxY == -1 || y > maxY) {
maxY = y;
}
}
}
}
if (minX == -1 || maxX == -1 || minY == -1 || maxY == -1) {
sleep(defaultmaxAgeInMillisecs);
continue;
}
Rectangle rec = new Rectangle(MiniMap.minX + minX, MiniMap.minY + minY, maxX
- minX, maxY - minY);
paintRectangle(rec, Color.CYAN, 2000);
MMClick(new XY((int) rec.getCenterX(), (int) rec.getCenterY()));
done = true;
}
sleep(defaultmaxAgeInMillisecs);
}
if (t.isUp()) {
warn("ToCentre failed");
continue;
}
}
{
Timer t = new Timer(30000);
boolean done = false;
while (!done && t.isUp()) {
double acc = 0.9;
for (int i = 0; i < 50; i++) {
XY res = FindDeformedBitmapToleranceIn(excercise, 5, 5, 515, 338, 40, acc);
if (res != null) {
log("Clicking on mat?");
paintText(res.x, res.y, "This", 10000, Color.red);
sleep(3000);
res.x += 20;
res.y += 80;
mouseClickRight(res);
Menu menu = getMenu(Areas.GAME, 2000);
if (menu != null) {
if (menu.selectContains("Use")) {
waitTillStopMoving();
done = true;
} else {
menu.exit();
}
break;
}
}
if (i % 5 == 0) {
acc -= 0.1;
log("lowering tolerance");
}
}
sleep(defaultmaxAgeInMillisecs);
}
if (t.isUp()) {
warn("SolveBoard failed");
continue;
}
}
} while ((chat = getNPCChat(2000)) == null || !chat.contains("actually"));
solveClickToContinue();
//Move camera up
SendArrowSilentWait(0, 1000 + Random(500));
}

WT-Fakawi

2007-04-11 15:24:59

Haha, nice, I even recognize some of my own coding in there :)

ruler

2007-04-11 15:37:19

From: WT-Fakawi
Haha, nice, I even recognize some of my own coding in there :)

hehe i try to link the function names directly to the scar one that way when i have to debug i can quickly compare.

according to the scar docs this should be true;

public void SendArrowSilentWait(int key, int time)
throws InterruptedException {
switch (key) {
case 0:
SendKey(KeyEvent.VK_UP, time);
break;
case 1:
SendKey(KeyEvent.VK_RIGHT, time);
break;
case 2:
SendKey(KeyEvent.VK_DOWN, time);
break;
case 3:
SendKey(KeyEvent.VK_LEFT, time);
break;
}
}
But the usage in the Drill Demon disagrees.

Bam Bam

2007-04-11 16:30:59

Why cant we use DLL's to share procedures between the different applications?

bullzeye95

2007-04-11 17:23:50

You are a fricken genius ruler!

c0nv3r7 2 scar plx?

Yakman

2007-04-14 07:21:10

From: Bam Bam
Why cant we use DLL's to share procedures between the different applications?


DLLs are windows only, i think Ibot is trying to work for all platforms, also SRLs are in scar, not DLL

eddie

2007-04-14 08:44:36

From: Starblaster100
Whats the evil bob random?


Not sure if you were being picky, But it's real name is ScapeRune

EDIT: And its that really annoying one where everything is backwards

Boreas

2007-04-14 10:33:43

I think they are talking about the uncooking fish one.

Ejjman

2007-04-14 12:51:55

Ya, two ScapeRunes


1) Pop the baloons, get the keys
2) Uncook the fish.

Secet

2007-04-15 03:03:07

From: Ejjman1
Ya, two ScapeRunes


1) Pop the baloons, get the keys
2) Uncook the fish.


Second is pretty rare, I have got it only once. It would be cool if there were solution to the first one, because it's pretty common after all.

First part would be easy, pull the lever and "solve" the animal like in Strange Box. But finding that animal in that room would be really hard, maybe it should be done by gambling :rolleyes:

GenoDemoN

2007-04-15 04:26:28

ah didn't know that the one above is for the fish.

Lorax

2007-04-15 05:41:05

Nice, however, I have never had an Evil Bob random.
The sandwich solver works, at least in SCAR.. I get them all the time..

Secet

2007-04-15 07:17:02

From: Lorax
Nice, however, I have never had an Evil Bob random.
The sandwich solver works, at least in SCAR.. I get them all the time..


Yea sandwich lady is quite common, but sometimes SRL fails solving it.