SRL Archive - Archive

abbe95 - SRL Member Application


abbe95

2012-01-31 08:35:21

How Long have You Played Runescape?
7 Year(s)


Are you affilated in anyway with Jagex LTD?
No

Were you Referred to SRL?



What is your general programming knowledge?
Java, Css


Are you a member of any other communities?
Powerbot.org (corrupted website)


Tell us about yourself…
From: abbe95
Im a boy from Sweden and I will soon be 17, im going school and in my free time I often write scripts, havent tho made any scripts in the last 3-4 months due bot nuke. I hope I can become a successfull scripter here on Simba, I tried at Powerbot but failed, so why not try at simba? My biggest interest is making scripts, playing soccer and hangin out with friends. I really enjoy making scripts espically money making scripts.



Please show us one (or multiple) of your scripts.
1.
import java.awt.BasicStroke;

2.
import java.awt.Color;

3.
import java.awt.Font;

4.
import java.awt.Graphics;

5.
import java.awt.Graphics2D;

6.
import java.awt.Image;

7.
import java.awt.Point;

8.
import java.io.IOException;

9.
import java.net.URL;

10.
import java.util.ArrayList;

11.
import java.util.HashSet;

12.
import java.util.LinkedList;

13.
import java.util.Set;

14.


15.
import javax.imageio.ImageIO;

16.


17.
import org.rsbot.event.listeners.PaintListener;

18.
import org.rsbot.script.Script;

19.
import org.rsbot.script.ScriptManifest;

20.
import org.rsbot.script.wrappers.RSArea;

21.
import org.rsbot.script.wrappers.RSGroundItem;

22.
import org.rsbot.script.wrappers.RSObject;

23.
import org.rsbot.script.wrappers.RSTile;

24.
import org.rsbot.script.wrappers.RSTilePath;

25.


26.
@ScriptManifest(authors = { "Daniel Larkin" }, name = "Dan's Grape Grabber", version = 1.03, description= "Grabs Grapes From Chefs Guild And Banks Them")

27.
public class DansGrapeGrabber extends Script implements PaintListener {

28.


29.
private int grapeID = 1987;

30.
private int stairs1ID = 24073;

31.
private int stairs2ID = 24074;

32.
private int stairs3ID = 24075;

33.


34.
public long startTime = System.currentTimeMillis();

35.
private int grapesTake = 0;

36.
private int grapesInv = 0;

37.
public int grapesHour = 0;

38.
private int grapePrice = 0;

39.
private int cashMade = 0;

40.
private int cashPerHour = 0;

41.
private String Status;

42.
long Runtime;

43.


44.
RSTile doorTileID = new RSTile(3143, 3443);

45.
RSTile stairs3TileID = new RSTile(3144, 3446);

46.
RSTile grapeTileID = new RSTile(3143, 3450);

47.
RSTile insideGuildTile = new RSTile(3143, 3446);

48.
RSTile onGrapeTile = new RSTile(3144, 3450);

49.


50.
// Objects

51.
RSObject stairs1;

52.
RSObject stairs2;

53.
RSObject stairs3;

54.
RSObject door;

55.


56.
// GroundItems

57.
RSGroundItem grapes;

58.


59.
// Areas

60.
RSArea bankArea = new RSArea(new RSTile(3189, 3435),

61.
new RSTile(3181, 3447), 0);

62.
RSArea grapeArea = new RSArea(new RSTile(3146, 3448),

63.
new RSTile(3141, 3452), 2);

64.
RSArea outGuildArea = new RSArea(new RSTile(3147, 3439), new RSTile(3139,

65.
3443), 0);

66.


67.
RSArea inGuildArea2 = new RSArea(new RSTile(3142, 3446), new RSTile(3147,

68.
3451), 1);

69.


70.
RSArea inGuildArea = new RSArea(new RSTile[] { new RSTile(3144, 3444),

71.
new RSTile(3146, 3446), new RSTile(3146, 3449),

72.
new RSTile(3143, 3452), new RSTile(3141, 3453),

73.
new RSTile(3140, 3453), new RSTile(3139, 3452),

74.
new RSTile(3138, 3449), new RSTile(3138, 3448),

75.
new RSTile(3142, 3444), new RSTile(3144, 3444) });

76.


77.
// Walker

78.
Walker walker = new Walker();

79.
shortPathfinder pathfinder = new shortPathfinder();

80.


81.
public boolean onStart() {

82.
mouse.setSpeed(random(7, 12));

83.
Runtime = System.currentTimeMillis();

84.
grapePrice = grandExchange.lookup(grapeID).getGuidePrice();

85.
return true;

86.
}

87.


88.
public void onFinish() {

89.
long millis = System.currentTimeMillis() - Runtime;

90.
long hours = millis / (1000 * 60 * 60);

91.
millis -= hours * (1000 * 60 * 60);

92.
long minutes = millis / (1000 * 60);

93.
millis -= minutes * (1000 * 60);

94.
long seconds = millis / 1000;

95.
mouse.setSpeed(random(6, 12));

96.
log(Color.BLACK, "You have been botting for " + hours + " hours" + ", "

97.
+ minutes + " minutes " + "and " + seconds + " seconds :D");

98.
log(Color.BLACK, "You have grabbed " + grapesTake + " Grapes!");

99.
log(Color.black, "You have made a total of " + cashMade + "gp!");

100.
env.saveScreenshot(true);

101.
}

102.


103.
public void PathToBank() {

104.
Status = "Walking to bank";

105.
RSTile destination = new RSTile(3182, 3444);

106.
walker.walkTo(destination);

107.
}

108.


109.
public void PathToGuild() {

110.
Status = "Walking to guild";

111.
RSTile destination = doorTileID;

112.
walker.walkTo(destination);

113.
}

114.


115.
private boolean stairs1IsVisible() {

116.
RSObject stairs1 = objects.getNearest(stairs1ID);

117.
return stairs1 != null && stairs1.isOnScreen();

118.
}

119.


120.
private boolean stairs2IsVisible() {

121.
RSObject stairs2 = objects.getNearest(stairs2ID);

122.
return stairs2 != null && stairs2.isOnScreen();

123.
}

124.


125.
private boolean stairs3IsVisible() {

126.
RSObject stairs3 = objects.getNearest(stairs3ID);

127.
return stairs3 != null && stairs3.isOnScreen();

128.
}

129.


130.
private boolean doorIsVisible() {

131.
RSObject door = objects.getTopAt(doorTileID);

132.
return door != null && door.isOnScreen();

133.
}

134.


135.
private void bank() {

136.
if (bank.isOpen()) {

137.
Status = "Banking";

138.
if (inventory.isFull()) {

139.
bank.depositAll();

140.
} else {

141.
PathToGuild();

142.
}

143.
} else {

144.
Status = "Opening bank";

145.
bank.open();

146.
}

147.
}

148.


149.
private void fart() {

150.
while (getMyPlayer().isMoving()) {

151.
sleep(500, 600);

152.
}

153.
}

154.


155.
public boolean atBank() {

156.
return bankArea.contains(getMyPlayer().getLocation());

157.
}

158.


159.
public boolean outGuild() {

160.
return outGuildArea.contains(getMyPlayer().getLocation());

161.
}

162.


163.
public boolean inGuild() {

164.
return inGuildArea.contains(getMyPlayer().getLocation());

165.
}

166.


167.
public boolean inGuild2() {

168.
return inGuildArea2.contains(getMyPlayer().getLocation());

169.
}

170.


171.
public boolean atGrapes() {

172.
return grapeArea.contains(getMyPlayer().getLocation());

173.
}

174.


175.
private void take() {

176.
RSGroundItem grapes = groundItems.getNearest(grapeID);

177.
antiban();

178.
if (game.getPlane() == 2) {

179.
Status = "Waiting for grapes to respawn";

180.
if (grapes != null) {

181.
if (grapes.getLocation().equals(onGrapeTile)) {

182.
if (grapes.isOnScreen()) {

183.
Status = "Taking grapes";

184.
mouse.click(

185.
calc.tileToScreen(grapes.getLocation(), -500),

186.
true);

187.
sleep(1000, 1500);

188.


189.
} else {

190.
Status = "Walking to grapes";

191.
walker.walkTo(grapeTileID);

192.
}

193.
}

194.
}

195.
}

196.


197.
}

198.


199.
private void openDoor() {

200.
Status = "Opening door";

201.
mouse.setSpeed(random(4, 6));

202.
RSObject door = objects.getTopAt(doorTileID);

203.
door.doAction("Open");

204.
sleep(800, 1200);

205.
}

206.


207.
private void goUp1() {

208.
RSObject stairs1 = objects.getNearest(stairs1ID);

209.
if (stairs1.isOnScreen()) {

210.
Status = "Going upstairs";

211.
stairs1.doClick();

212.
sleep(700, 900);

213.
}

214.
}

215.


216.
private void goUp2() {

217.
RSObject stairs2 = objects.getNearest(stairs2ID);

218.
if (stairs2.isOnScreen()) {

219.
Status = "Going upstairs";

220.
stairs2.doAction("Climb-up");

221.
sleep(700, 900);

222.
}

223.
}

224.


225.
private void goDown3() {

226.
RSObject stairs3 = objects.getNearest(stairs3ID);

227.
if (stairs3.isOnScreen()) {

228.
if (!getMyPlayer().isMoving()) {

229.
Status = "Going downstairs";

230.
stairs3.doClick(true);

231.
sleep(1200, 1500);

232.
}

233.
}

234.
if (stairs3.doClick() == true) {

235.
if (game.getPlane() == 2) {

236.
if (game.getPlane() != 1) {

237.
while (getMyPlayer().isMoving()) {

238.
Status = "Waiting for floor";

239.
sleep(2000, 2500);

240.
}

241.
}

242.
}

243.
}

244.
}

245.


246.
private void goDown2() {

247.
RSObject stairs2 = objects.getNearest(stairs2ID);

248.
if (game.getPlane() == 1)

249.
if (stairs2.isOnScreen()) {

250.
Status = "Going downstairs";

251.
stairs2.doAction("Climb-down");

252.
sleep(700, 900);

253.
}

254.
}

255.


256.
private void antiban() {

257.
int r = random(0, 28);

258.
switch (r) {

259.
case 5:

260.
mouse.move(random(50, 75), random(100, 250));

261.
break;

262.
case 9:

263.
if (random(0, 2) == 1)

264.
mouse.moveOffScreen();

265.
sleep(random(800, 4000));

266.
break;

267.
case 17:

268.
mouse.moveSlightly();

269.
break;

270.
case 12:

271.
mouse.moveRandomly(5, 70);

272.
break;

273.
case 20:

274.
camera.setAngle(random(97, 600));

275.
camera.setPitch(random(57, 379));

276.
break;

277.
}

278.
}

279.


280.
// START: Code generated using Enfilade's Easel

281.
private Image getImage(String url) {

282.
try {

283.
return ImageIO.read(new URL(url));

284.
} catch (IOException e) {

285.
return null;

286.
}

287.
}

288.


289.
private final Color color1 = new Color(0, 0, 0, 228);

290.
private final Color color2 = new Color(0, 0, 0);

291.
private final Color color3 = new Color(51, 255, 0);

292.
private final Color color4 = new Color(255, 255, 255);

293.
private final Color color5 = new Color(255, 0, 0);

294.
private final Color color6 = new Color(255, 255, 51);

295.
private final Color color7 = new Color(153, 0, 153);

296.
private final Color color8 = new Color(128, 255, 0);

297.


298.
private final BasicStroke stroke1 = new BasicStroke(1);

299.


300.
private final Font font1 = new Font("Arial", 0, 14);

301.
private final Font font2 = new Font("Arial", 1, 26);

302.


303.
private final Image img1 = getImage("http://i1109.photobucket.com/albums/h431/snotboy808/Grapes_detailed.png");

304.


305.
private final Image img2 = getImage("http://www.mediafire.com/imgbnc.php/f61e5c467a949deee65c48d36b5cef2ee0ac7cd0acc16657dde939adf5aee10b6g.jpg");

306.


307.
public void onRepaint(Graphics g1) {

308.
long millis = System.currentTimeMillis() - Runtime;

309.
long hours = millis / (1000 * 60 * 60);

310.
millis -= hours * (1000 * 60 * 60);

311.
long minutes = millis / (1000 * 60);

312.
millis -= minutes * (1000 * 60);

313.
long seconds = millis / 1000;

314.
Graphics2D g = (Graphics2D) g1;

315.
grapesHour = (int) ((grapesTake) * 3600000D / (System

316.
.currentTimeMillis() - startTime));

317.
cashMade = (int) ((grapesTake) * grapePrice);

318.
cashPerHour = (int) ((grapePrice) * grapesHour);

319.
g.setColor(new Color(0, 0, 0, 239));

320.
g.fillRoundRect(0, 338, 518, 120, 0, 300);

321.
g.setColor(new Color(0, 0, 0, 239));

322.
g.draw3DRect(0, 338, 518, 120, true);

323.
g.setColor(new Color(0, 0, 0, 239));

324.
g.fillRoundRect(0, 458, 6, 15, 0, 300);

325.
g.setColor(new Color(0, 0, 0, 239));

326.
g.draw3DRect(0, 458, 6, 15, true);

327.
g.setColor(new Color(0, 0, 0, 239));

328.
g.fillRoundRect(497, 458, 21, 21, 0, 300);

329.
g.setColor(new Color(0, 0, 0, 239));

330.
g.draw3DRect(497, 458, 21, 21, true);

331.
g.setColor(new Color(0, 0, 0, 239));

332.
g.fillRoundRect(0, 473, 518, 29, 0, 300);

333.
g.setColor(new Color(0, 0, 0, 239));

334.
g.draw3DRect(512, 473, 518, 29, true);

335.
g.setColor(new Color(0, 181, 0, 239));

336.
g.draw3DRect(0, 338, 518, 164, true);

337.
g.setColor(new Color(0, 181, 0, 239));

338.
g.draw3DRect(6, 458, 491, 15, true);

339.
g.setFont(font1);

340.
g.setColor(color4);

341.
g.drawString("Time Running: " + hours + ":" + minutes + ":" + seconds, 8,

342.
392);

343.
g.drawString("Profit: " + cashMade + "gp", 211, 392);

344.
g.drawString("Profit/Hour: " + cashPerHour + "gp", 211, 422);

345.
g.drawString("Current Status: " + Status, 211, 454);

346.
g.drawImage(img2, 88, 338, null);

347.
g.setFont(font1);

348.
g.setColor(color4);

349.
g.drawString("Grapes Grabbed: " + grapesTake, 7, 422);

350.
g.drawString("Grapes/Hour: " + grapesHour, 8, 454);

351.
g.drawImage(img1, 393, 339, null);

352.
g.setColor(color8);

353.
}

354.


355.
// END: Code generated using Enfilade's Easel

356.


357.
@Override

358.
public int loop() {

359.
mouse.setSpeed(random(8, 13));

360.
fart();

361.
if (inventory.isFull()) {

362.
if (atBank()) {

363.
bank();

364.
}

365.
if (!inGuild() && !atBank()) {

366.
if (game.getPlane() == 0) {

367.
PathToBank();

368.
}

369.
}

370.
if (game.getPlane() == 2) {

371.
if (stairs3IsVisible()) {

372.
goDown3();

373.
sleep(600, 700);

374.
} else {

375.
walker.walkTo(stairs3.getLocation());

376.
}

377.
}

378.


379.
if (game.getPlane() == 1) {

380.
if (stairs2IsVisible()) {

381.
goDown2();

382.
sleep(1200, 1500);

383.
} else {

384.
walker.walkTo(stairs2.getLocation());

385.
}

386.
}

387.
if (inGuild() && game.getPlane() == 0) {

388.
if (doorIsVisible()) {

389.
openDoor();

390.
} else {

391.
if (calc.tileToScreen(insideGuildTile) != null) {

392.
walking.walkTileOnScreen(insideGuildTile);

393.
} else {

394.
Status = "Turning to door";

395.
camera.turnTo(insideGuildTile);

396.
}

397.
}

398.
}

399.
} else {

400.
if (outGuild()) {

401.
if (doorIsVisible()) {

402.
openDoor();

403.
sleep(600, 900);

404.
} else {

405.
walker.walkTo(doorTileID);

406.
}

407.
}

408.


409.
if (inGuild() && game.getPlane() == 0) {

410.
if (stairs1IsVisible()) {

411.
goUp1();

412.
sleep(3000, 3200);

413.
} else {

414.
walking.walkTileOnScreen(stairs1.getLocation());

415.
}

416.
}

417.
if (inGuild2() && game.getPlane() == 1) {

418.
if (stairs2IsVisible()) {

419.
goUp2();

420.
sleep(800, 1200);

421.
}

422.
}

423.
if (game.getPlane() == 2) {

424.
if (!atGrapes()) {

425.
walking.walkTo(grapeTileID);

426.
sleep(800, 1200);

427.
}

428.
}

429.


430.
if (!outGuild()) {

431.
if (!inGuild()) {

432.
if (game.getPlane() == 0) {

433.
PathToGuild();

434.
}

435.
}

436.
}

437.


438.
if (atGrapes()) {

439.
if (grapesInv < inventory.getCount(grapeID)

440.
&& inventory.getCount(grapeID) >= 1) {

441.
grapesTake++;

442.
grapesInv = inventory.getCount(grapeID);

443.
} else if (inventory.getCount(grapeID) == 0) {

444.
grapesInv = 0;

445.
}

446.
take();

447.
sleep(600, 800);

448.
}

449.


450.
}

451.
return random(300, 500);

452.
}

453.


454.
protected class shortPathfinder {

455.


456.
private int WALL_NORTH_WEST = 0x1;

457.
private int WALL_NORTH = 0x2;

458.
private int WALL_NORTH_EAST = 0x4;

459.
private int WALL_EAST = 0x8;

460.
private int WALL_SOUTH_EAST = 0x10;

461.
private int WALL_SOUTH = 0x20;

462.
private int WALL_SOUTH_WEST = 0x40;

463.
private int WALL_WEST = 0x80;

464.
private int BLOCKED = 0x100;

465.
private RSTile base;

466.
private int[][] flags;

467.
private int offX, offY;

468.


469.
protected class Node {

470.


471.
public int x, y;

472.
public Node prev;

473.
public double g, f;

474.
public boolean border;

475.


476.
public Node(int x, int y, boolean border) {

477.
this.border = border;

478.
this.x = x;

479.
this.y = y;

480.
g = f = 0;

481.
}

482.


483.
public Node(int x, int y) {

484.
this.x = x;

485.
this.y = y;

486.
g = f = 0;

487.
}

488.


489.
@Override

490.
public int hashCode() {

491.
return (x << 4) | y;

492.
}

493.


494.
@Override

495.
public boolean equals(Object o) {

496.
if (o instanceof Node) {

497.
Node n = (Node) o;

498.
return x == n.x && y == n.y;

499.
}

500.
return false;

501.
}

502.


503.
@Override

504.
public String toString() {

505.
return "(" + x + "," + y + ")";

506.
}

507.


508.
public RSTile toRSTile(int baseX, int baseY) {

509.
return new RSTile(x + baseX, y + baseY);

510.
}

511.
}

512.


513.
public RSTile[] findPath(RSTile end) {

514.
return findPath(getMyPlayer().getLocation(), end, false);

515.
}

516.


517.
public RSTile[] findPath(RSTile start, RSTile end, boolean remote) {

518.
flags = walking.getCollisionFlags(game.getPlane());

519.
if (flags != null) {

520.
base = game.getMapBase();

521.
}

522.
int base_x = base.getX(), base_y = base.getY();

523.
int curr_x = start.getX() - base_x, curr_y = start.getY() - base_y;

524.
int dest_x = end.getX() - base_x, dest_y = end.getY() - base_y;

525.


526.
int plane = game.getPlane();

527.
flags = walking.getCollisionFlags(plane);

528.
RSTile offset = walking.getCollisionOffset(plane);

529.
offX = offset.getX();

530.
offY = offset.getY();

531.


532.
if (flags == null || curr_x < 0 || curr_y < 0

533.
|| curr_x >= flags.length || curr_y >= flags.length) {

534.
return null;

535.
} else if (dest_x < 0 || dest_y < 0 || dest_x >= flags.length

536.
|| dest_y >= flags.length) {

537.
remote = true;

538.
if (dest_x < 0) {

539.
dest_x = 0;

540.
} else if (dest_x >= flags.length) {

541.
dest_x = flags.length - 1;

542.
}

543.
if (dest_y < 0) {

544.
dest_y = 0;

545.
} else if (dest_y >= flags.length) {

546.
dest_y = flags.length - 1;

547.
}

548.
}

549.


550.
HashSet<Node> open = new HashSet<Node>();

551.
HashSet<Node> closed = new HashSet<Node>();

552.
Node curr = new Node(curr_x, curr_y);

553.
Node dest = new Node(dest_x, dest_y);

554.


555.
curr.f = heuristic(curr, dest);

556.
open.add(curr);

557.


558.
while (!open.isEmpty()) {

559.
curr = lowest_f(open);

560.
if (curr.equals(dest)) {

561.
return path(curr, base_x, base_y);

562.
}

563.
open.remove(curr);

564.
closed.add(curr);

565.
for (Node next : successors(curr)) {

566.
if (!closed.contains(next)) {

567.
double t = curr.g + dist(curr, next);

568.
boolean use_t = false;

569.
if (!open.contains(next)) {

570.
open.add(next);

571.
use_t = true;

572.
} else if (t < next.g) {

573.
use_t = true;

574.
}

575.
if (use_t) {

576.
next.prev = curr;

577.
next.g = t;

578.
next.f = t + heuristic(next, dest);

579.
}

580.
}

581.
}

582.
}

583.


584.
// no path

585.
if (!remote || calc.distanceBetween(start, end) < 8) {

586.
return null;

587.
}

588.
return findPath(pull(end));

589.
}

590.


591.
private RSTile pull(RSTile tile) {

592.
RSTile p = players.getMyPlayer().getLocation();

593.
int x = tile.getX(), y = tile.getY();

594.
if (p.getX() < x) {

595.
x -= 2;

596.
} else if (p.getX() > x) {

597.
x += 2;

598.
}

599.
if (p.getY() < y) {

600.
y -= 2;

601.
} else if (p.getY() > y) {

602.
y += 2;

603.
}

604.
return new RSTile(x, y);

605.
}

606.


607.
private double heuristic(Node start, Node end) {

608.
double dx = start.x - end.x;

609.
double dy = start.y - end.y;

610.
if (dx < 0) {

611.
dx = -dx;

612.
}

613.
if (dy < 0) {

614.
dy = -dy;

615.
}

616.
return dx < dy ? dy : dx;

617.
}

618.


619.
private double dist(Node start, Node end) {

620.
if (start.x != end.x && start.y != end.y) {

621.
return 1.41421356;

622.
} else {

623.
return 1.0;

624.
}

625.
}

626.


627.
private Node lowest_f(Set<Node> open) {

628.
Node best = null;

629.
for (Node t : open) {

630.
if (best == null || t.f < best.f) {

631.
best = t;

632.
}

633.
}

634.
return best;

635.
}

636.


637.
private RSTile[] path(Node end, int base_x, int base_y) {

638.
LinkedList<RSTile> path = new LinkedList<RSTile>();

639.
Node p = end;

640.
while (p != null) {

641.
path.addFirst(p.toRSTile(base_x, base_y));

642.
p = p.prev;

643.
}

644.
return path.toArray(new RSTile[path.size()]);

645.
}

646.


647.
private java.util.List<Node> successors(Node t) {

648.
LinkedList<Node> tiles = new LinkedList<Node>();

649.
int x = t.x, y = t.y;

650.
int f_x = x - offX, f_y = y - offY;

651.
int here = flags[f_x][f_y];

652.
int upper = flags.length - 1;

653.
if (f_y > 0 && (here & WALL_SOUTH) == 0

654.
&& (flags[f_x][f_y - 1] & BLOCKED) == 0) {

655.
tiles.add(new Node(x, y - 1));

656.
}

657.
if (f_x > 0 && (here & WALL_WEST) == 0

658.
&& (flags[f_x - 1][f_y] & BLOCKED) == 0) {

659.
tiles.add(new Node(x - 1, y));

660.
}

661.
if (f_y < upper && (here & WALL_NORTH) == 0

662.
&& (flags[f_x][f_y + 1] & BLOCKED) == 0) {

663.
tiles.add(new Node(x, y + 1));

664.
}

665.
if (f_x < upper && (here & WALL_EAST) == 0

666.
&& (flags[f_x + 1][f_y] & BLOCKED) == 0) {

667.
tiles.add(new Node(x + 1, y));

668.
}

669.
if (f_x > 0 && f_y > 0

670.
&& (here & (WALL_SOUTH_WEST | WALL_SOUTH | WALL_WEST)) == 0

671.
&& (flags[f_x - 1][f_y - 1] & BLOCKED) == 0

672.
&& (flags[f_x][f_y - 1] & (BLOCKED | WALL_WEST)) == 0

673.
&& (flags[f_x - 1][f_y] & (BLOCKED | WALL_SOUTH)) == 0) {

674.
tiles.add(new Node(x - 1, y - 1));

675.
}

676.
if (f_x > 0 && f_y < upper

677.
&& (here & (WALL_NORTH_WEST | WALL_NORTH | WALL_WEST)) == 0

678.
&& (flags[f_x - 1][f_y + 1] & BLOCKED) == 0

679.
&& (flags[f_x][f_y + 1] & (BLOCKED | WALL_WEST)) == 0

680.
&& (flags[f_x - 1][f_y] & (BLOCKED | WALL_NORTH)) == 0) {

681.
tiles.add(new Node(x - 1, y + 1));

682.
}

683.
if (f_x < upper && f_y > 0

684.
&& (here & (WALL_SOUTH_EAST | WALL_SOUTH | WALL_EAST)) == 0

685.
&& (flags[f_x + 1][f_y - 1] & BLOCKED) == 0

686.
&& (flags[f_x][f_y - 1] & (BLOCKED | WALL_EAST)) == 0

687.
&& (flags[f_x + 1][f_y] & (BLOCKED | WALL_SOUTH)) == 0) {

688.
tiles.add(new Node(x + 1, y - 1));

689.
}

690.
if (f_x > 0 && f_y < upper

691.
&& (here & (WALL_NORTH_EAST | WALL_NORTH | WALL_EAST)) == 0

692.
&& (flags[f_x + 1][f_y + 1] & BLOCKED) == 0

693.
&& (flags[f_x][f_y + 1] & (BLOCKED | WALL_EAST)) == 0

694.
&& (flags[f_x + 1][f_y] & (BLOCKED | WALL_NORTH)) == 0) {

695.
tiles.add(new Node(x + 1, y + 1));

696.
}

697.
return tiles;

698.
}

699.
}

700.


701.
private class Walker {

702.


703.
public boolean nextisend = false;

704.


705.
public boolean walkTo(RSTile destination) {

706.
RSTile[] path = pathfinder.findPath(destination);

707.
path = cleanPath(path);

708.
long timeout = 9000;

709.
long walktimeout = 10000;

710.
long runtimeout = 9000;

711.
int loops = 0;

712.
nextisend = false;

713.
long starttime = System.currentTimeMillis();

714.
while (walkNextTile(path) && isRunning() && isActive()

715.
&& !isPaused() && calc.distanceTo(destination) > 3) {

716.
loops++;

717.
sleep(random(60, 80));

718.
if (random(1, 2) == random(1, 2)) {

719.
mouse.moveRandomly(random(10, 60));

720.
}

721.
if (walking.isRunEnabled()) {

722.
timeout = runtimeout;

723.
} else {

724.
timeout = walktimeout;

725.
}

726.
sleep(random(120, 180));

727.
if (!getMyPlayer().isMoving()) {

728.
path = pathfinder.findPath(destination);

729.
path = cleanPath(path);

730.
sleep(200);

731.
if (!getMyPlayer().isMoving()) {

732.
walkNextTile(path);

733.
sleep(300);

734.
if (!getMyPlayer().isMoving()) {

735.
return calc.distanceTo(destination) <= 3;

736.
}

737.
}

738.
}

739.
if (walking.isRunEnabled()) {

740.
timeout = runtimeout;

741.
} else {

742.
timeout = walktimeout;

743.
}

744.
if ((System.currentTimeMillis() - starttime) > (timeout * path.length)) {

745.
return calc.distanceTo(destination) <= 3;

746.
}

747.
if (loops >= 5) {

748.
path = pathfinder.findPath(destination);

749.
path = cleanPath(path);

750.
loops = 0;

751.
}

752.
sleep(random(100, 200));

753.
RSTile clicked = walking.getDestination();

754.
RSTile end = path[path.length - 1];

755.
RSTile next = nextTile(path);

756.
if (clicked != null) {

757.
if (clicked.equals(end)) {

758.
while (getMyPlayer().isMoving()

759.
&& calc.distanceTo(end) > 3

760.
&& calc.distanceTo(clicked) > 3 && !isPaused()

761.
&& isActive() && isRunning()) {

762.
sleep(random(200, 300));

763.
if (walking.getDestination() == null) {

764.
break;

765.
}

766.
if (walking.isRunEnabled()) {

767.
timeout = runtimeout;

768.
} else {

769.
timeout = walktimeout;

770.
}

771.
if ((System.currentTimeMillis() - starttime) > (timeout * path.length)) {

772.
return calc.distanceTo(destination) <= 3;

773.
}

774.
}

775.
}

776.
}

777.
if (end.equals(next) || calc.distanceBetween(end, next) <= 1) {

778.
nextisend = true;

779.
}

780.
}

781.
return calc.distanceTo(destination) <= 3;

782.
}

783.


784.
private boolean walkNextTile(RSTile[] path) {

785.
if (isPaused() || !isActive() || !isRunning() || !isRunning()) {

786.
return false;

787.
}

788.
try {

789.
RSTile nextTile = nextTile(path);

790.
if (nextTile == null) {

791.
return false;

792.
}

793.
if (nextTile.equals(path[path.length - 1])) {

794.
if (calc.distanceTo(nextTile) <= 1

795.
|| (nextisend && calc.distanceBetween(

796.
walking.getDestination(),

797.
path[path.length - 1]) <= 2)

798.
|| nextTile.equals(walking.getDestination())) {

799.
return false;

800.
}

801.
nextisend = true;

802.
} else {

803.
nextisend = false;

804.
}

805.
if (!walking.isRunEnabled()

806.
&& walking.getEnergy() >= random(47, 63)) {

807.
walking.setRun(true);

808.
sleep(random(200, 350));

809.
}

810.
RSTile MMclicked = walking.getDestination();

811.
if (MMclicked != null && getMyPlayer().isMoving()

812.
&& calc.distanceTo(MMclicked) > random(5, 7)

813.
&& calc.distanceBetween(nextTile, MMclicked) < 7

814.
&& calc.distanceTo(nextTile) > 4

815.
&& !nextTile.equals(path[path.length - 1])) {

816.
sleep(random(120, 280));

817.
return true;

818.
} else if (MMclicked == null && getMyPlayer().isMoving()

819.
&& calc.distanceTo(nextTile) >= 7

820.
&& !nextTile.equals(path[path.length - 1])) {

821.
sleep(random(120, 280));

822.
return true;

823.
} else if (MMclicked != null && MMclicked.equals(nextTile)) {

824.
sleep(random(120, 280));

825.
return true;

826.
}

827.
if (isPaused() || !isActive() || !isRunning() || !isRunning()) {

828.
return false;

829.
}

830.
return clickMinimap(nextTile);

831.
} catch (NullPointerException npe) {

832.
return false;

833.
}

834.
}

835.


836.
private boolean clickMinimap(RSTile t) {

837.
if (random(1, 8) == random(1, 8)) {

838.
Point temp = calc.tileToMinimap(getMyPlayer().getLocation());

839.
int random = random(1, 2);

840.
if (random == 1) {

841.
temp.x = Math.abs(temp.x - random(0, 7));

842.
if (random(1, 2) == random(1, 2)) {

843.
temp.y = Math.abs(temp.y - random(0, 7));

844.
} else {

845.
temp.y = Math.abs(temp.y + random(0, 7));

846.
}

847.
} else {

848.
temp.x = Math.abs(temp.x + random(0, 7));

849.
if (random(1, 2) == random(1, 2)) {

850.
temp.y = Math.abs(temp.y + random(0, 7));

851.
} else {

852.
temp.y = Math.abs(temp.y - random(0, 7));

853.
}

854.
}

855.
mouse.move(temp);

856.
}

857.
int rand = random(1, random(5, 40));

858.
if (t == null) {

859.
return false;

860.
}

861.
switch (rand) {

862.
case 1: {

863.
mouse.moveRandomly(random(5, 25));

864.
break;

865.
}

866.
case 2: {

867.
camera.moveRandomly(random(60, 150));

868.
break;

869.
}

870.
}

871.
Point initialPoint = calc.tileToMinimap(t);

872.
if (initialPoint == null) {

873.
Point temp = calc.tileToMinimap(getMyPlayer().getLocation());

874.
if (temp != null) {

875.
mouse.move(temp);

876.
} else {

877.
return false;

878.
}

879.
} else {

880.
mouse.move(initialPoint.x + random(0, 5), initialPoint.y

881.
+ random(0, 5));

882.
if (!mouse.getLocation().equals(initialPoint)) {

883.
mouse.move(initialPoint);

884.
}

885.
}

886.
switch (rand) {

887.
case 3: {

888.
camera.moveRandomly(random(60, 150));

889.
break;

890.
}

891.
case 4: {

892.
mouse.moveRandomly(random(5, 25));

893.
break;

894.
}

895.
}

896.
Point otherPoint = calc.tileToMinimap(t);

897.
if (otherPoint != null) {

898.
mouse.move(otherPoint);

899.
}

900.
Point finalPoint = calc.tileToMinimap(t);

901.
if (finalPoint == null) {

902.
return false;

903.
}

904.
if (random(1, 5) == random(1, 6)) {

905.
mouse.move(finalPoint);

906.
}

907.
finalPoint = calc.tileToMinimap(t);

908.
if (finalPoint == null) {

909.
return false;

910.
}

911.
mouse.click(finalPoint, true);

912.
switch (rand) {

913.
case 5: {

914.
mouse.moveSlightly();

915.
break;

916.
}

917.
case 6: {

918.
mouse.moveRandomly(random(10, 50));

919.
break;

920.
}

921.
case 7: {

922.
mouse.moveRandomly(random(10, 60));

923.
break;

924.
}

925.
}

926.
return true;

927.
}

928.


929.
private RSTile nextTile(RSTile[] path) {

930.
int dist = Integer.MAX_VALUE;

931.
int closest = Integer.MIN_VALUE;

932.
for (int i = path.length - 1; i >= 0; i--) {

933.
RSTile tile = path[i];

934.
int distance = calc.distanceTo(tile);

935.
if (distance < dist) {

936.
dist = distance;

937.
closest = i;

938.
}

939.
}

940.
int maxDist = random(14, 16);

941.
int tileidx = -1;

942.
for (int i = closest; i < path.length; i++) {

943.
if (calc.distanceTo(path[i]) <= maxDist) {

944.
tileidx = i;

945.
}

946.
}

947.
if (tileidx == -1 || !calc.tileOnMap(path[tileidx])) {

948.
for (int i = path.length - 1; i >= 0; i--) {

949.
try {

950.
if (calc.tileOnMap(path[i - 1])) {

951.
if (calc.distanceBetween(path[i - 1],

952.
path[path.length - 1]) <= 3) {

953.
if (calc.tileOnMap(path[path.length - 1])) {

954.
return path[path.length - 1];

955.
}

956.
}

957.
return path[i - 1];

958.
} else if (calc.tileOnMap(path[i])) {

959.
if (calc.distanceBetween(path[i],

960.
path[path.length - 1]) <= 3) {

961.
if (calc.tileOnMap(path[path.length - 1])) {

962.
return path[path.length - 1];

963.
}

964.
}

965.
return path[i];

966.
}

967.
} catch (ArrayIndexOutOfBoundsException aio) {

968.
} catch (NullPointerException e) {

969.
}

970.
}

971.
for (int i = 0; i < path.length; i++) {

972.
if (calc.distanceTo(path[i]) <= maxDist) {

973.
tileidx = i;

974.
}

975.
}

976.
if (tileidx == -1) {

977.
RSTilePath tilepath = walking.newTilePath(path);

978.
RSTile next = tilepath.getNext();

979.
if (calc.distanceBetween(next, tilepath.getEnd()) <= 3) {

980.
if (calc.tileOnMap(tilepath.getEnd())) {

981.
return tilepath.getEnd();

982.
}

983.
}

984.
return next;

985.
}

986.
if (!calc.tileOnMap(path[tileidx])) {

987.
return walking.getClosestTileOnMap(path[tileidx]);

988.
} else {

989.
if (calc.distanceBetween(path[tileidx],

990.
path[path.length - 1]) <= 3) {

991.
if (calc.tileOnMap(path[path.length - 1])) {

992.
return path[path.length - 1];

993.
}

994.
}

995.
return path[tileidx];

996.
}

997.
} else {

998.
if (calc.distanceBetween(path[tileidx], path[path.length - 1]) <= 3) {

999.
if (calc.tileOnMap(path[path.length - 1])) {

1000.
return path[path.length - 1];

1001.
}

1002.
}

1003.
return path[tileidx];

1004.
}

1005.
}

1006.


1007.
private RSTile[] cleanPath(RSTile[] path) {

1008.
ArrayList<RSTile> cleanPath = new ArrayList<RSTile>();

1009.
ArrayList<Integer> badidx = new ArrayList<Integer>();

1010.
for (int i = 0; i < path.length; i++) {

1011.
try {

1012.
if (!badidx.contains(i)) {

1013.
cleanPath.add(path[i]);

1014.
}

1015.
if (cleanPath.contains(path[i + 1])) {

1016.
badidx.add(i + 1);

1017.
}

1018.
if (cleanPath.contains(path[i + 2])) {

1019.
badidx.add(i + 2);

1020.
}

1021.
if (cleanPath.contains(path[i + 3])) {

1022.
badidx.add(i + 3);

1023.
}

1024.
} catch (ArrayIndexOutOfBoundsException aio) {

1025.
} catch (NullPointerException npe) {

1026.
}

1027.
}

1028.
return cleanPath.toArray(new RSTile[cleanPath.size()]);

1029.
}

1030.
}

1031.
}

Sin

2012-01-31 08:36:29

Pascal script.

masterBB

2012-01-31 09:03:49

We(maybe just me) are looking for members that show some SRL usage in their script. Though this script shows you can create a java reflection(injection) bot, I would like a small script to show your knowledge in Pascal and the srl include.

Emaziz

2012-01-31 09:41:03

MUST be a script compatible with Simba that uses the SRL include.

Also you only have three posts.

Harry

2012-01-31 09:52:30

That's not your script anyways, ignoring the fact it has to be for Simba..

DemiseScythe

2012-01-31 10:24:16

Write in Pascal

footballjds

2012-01-31 10:38:23

Use the SRL Resource Library.
Use Simba/Scar as your compiler.

[XoL]

2012-01-31 17:02:53

Try to follow this guide:
http://villavu.com/forum/showthread.php?t=27435
http://villavu.com/forum/showthread.php?t=3562

For learning purposes I recommend starting with YoHoJo's video tutorials, informative and they will teach you what you need to know to create a basic/decent script.
http://villavu.com/forum/showthread.php?t=69179

For more advanced scripting I would suggest reading these guides:
http://villavu.com/forum/forumdisplay.php?f=96

Also one thing I really think is important is being community focused, you have 3 posts. Posting actively not only shows you genuinely care for the community it also helps your chances of getting accepted.

These guides can help you with that:
http://villavu.com/forum/showthread.php?t=72050
http://villavu.com/forum/showthread.php?t=66084

Anyway, sorry for the roughness. Good luck.

PatDuffy

2012-01-31 17:16:31

From: Harry
That's not your script anyways, ignoring the fact it has to be for Simba..


I don't think we should ignore the fact he applied with someone else's script to begin with….

E: what I'm implying is a temp ban for plagiary

Mat

2012-01-31 17:25:13

From: PatDuffy
I don't think we should ignore the fact he applied with someone else's script to begin with….

E: what I'm implying is a temp ban for plagiary

Agree.

Chris

2012-01-31 17:29:02

From: PatDuffy
I don't think we should ignore the fact he applied with someone else's script to begin with….

E: what I'm implying is a temp ban for plagiary


+1
Imo, plagiary should always be punished with an (at least) 1-month ban.

Nava2

2012-01-31 19:19:09

Its a two week ban.

Closed.