SRL Archive - OSR Help

07 Bird Catcher (need help)


andryaze

2013-02-25 16:12:41

I'm working on a my first script.

program BirdHunter;
{$I SRL\SRL.Simba}
{$I P07Include.Simba}
var x, y: integer;
procedure huntBird;
begin
FindColorTolerance(x, y, 2897763, 242, 137, 379, 196, 4);
MoveMouse (x, y);
wait(1000)
if (P07_GetUpText = 'Check Bird snare')then
ClickMouse2(mouse_left);
Wait(10000)
end;
begin
repeat
huntBird;
until(false);
end.

Thats a test part. I have to manually set up the trap, if i catch a bird the script checks the bird snare.
Setting up the trap etc will come once i understood this better.

It moves the mouse to the position but doesn't click and the script crashes.
Does anyone know why?

andryaze

2013-02-25 16:14:39

I guess its the reading method with "Check Bird snare". But i don't see any mistake.

Kevin

2013-02-25 16:21:10

First: Try to edit your posts so you don't reply to them and clutter the thread. Easier to read that way.

Second:For antiban purposes use:
MMouse(x, y, 3, 3);
instead. It's FAR less bot-like and still accurate.

Third:
if (P07_GetUpText = 'Check Bird snare')then
will have have some issues simply because capital letters are finicky with uptext. Try something much simpler, but still accurate like:
if(pos(P07_GetUpText, 'nare') <> 0)then
as that will check for the portion "nare" in the UpText, and that should be a fairly unique letter combination, thus remaining safe for the accuracy of the click. (I would suggest an UpTextMulti based method to search multiple possible substrings to be even safer, but i'm not very familiar with the 07 include).

Edit: Just found the multi-text far better solution:
if (P07_IsUpTextMulti(['heck', 'ird', 'nare'])) then

And for readability reasons, adding additional blank lines between methods can help a lot too.

andryaze

2013-02-25 16:31:13

Thanks for your reply.

How can you limit clicks? The script keeps mass clicking with

ClickMouse2(mouse_left);

Kevin

2013-02-25 16:37:50

From: andryaze
Thanks for your reply.

How can you limit clicks? The script keeps mass clicking with

ClickMouse2(mouse_left);


It is not ever using your wait(10000); directly after that?

andryaze

2013-02-25 17:12:10

From: nivek1989
It is not ever using your wait(10000); directly after that?
sadly not. I'll take a look at it later. Maybe its a stupid mistake

andryaze

2013-02-26 13:32:18

program BirdHunter;
{$I SRL\SRL.Simba}
var x, y: integer;

procedure huntBird;
begin
FindColorTolerance(x, y, 2897763, 281, 158, 294, 170, 4);
MMouse(x, y, 4, 4);
wait(1000)
if FindColorTolerance(x, y, 13161492, 50, 10, 66, 20, 4) then
ClickMouse2(mouse_left);
Wait(10000)
end;
begin
repeat
huntBird;
until(false);
end.



Ok now it compiles. I removed the 07 includes since they don't work anymore need to work with text bitmap.

I think i have a problem with :

MMouse(x, y, 4, 4);

The mouse has to move over the spot and waits for the specific text colour to appear at the topscreen of rs, then clicks if it is true.

Once i start the script the mouse moves like in micrometers to the specific location. Takes like 2 minutes until it arrived.

are these 2 MMouse(x, y, 4, 4); integers the speed of the movement?

Kevin

2013-02-26 13:42:52

Those 2 integers are the randomness of the offset of where you are actually clicking:
MMouse(XPositionToClick, YPositionToClick, RandomXAmountOffset, RandomYAmountOffset);
We use that as a deterrent from Jagex detecting us possibly as a bot because they do record mouse clicks. If your mouse is moving slowly, I assume it's because of the removal of the P07Include which (I believe) sets the mouse speed. You can change the mouse speed as simply as:
MouseSpeed := ANumber;//People typically use 15-20

andryaze

2013-02-26 14:24:52

I give up at a hunting script as a first script.

I'm going to make a rat killer bitmap based (Already working but want to change stuff)

I want the bot to rightclick the rats and move down like 10 tiles and left click (to attack) the rat.
Is there any method to make the mouse move down a specific amount not to a specific locatioN?

Kevin

2013-02-26 14:36:55

I don't know of any specific method that will make the mouse move a designated amount of pixels from it's current location, however, you can get the current mouse position with
GetMousePos(x, y);//even though you pass x and y in as variables, they will have the current x and y location stored in them when it's done.

Edit: And then you can just add your offset from that.

andryaze

2013-02-26 14:41:31

From: nivek1989
I don't know of any specific method that will make the mouse move a designated amount of pixels from it's current location, however, you can get the current mouse position with
GetMousePos(x, y);//even though you pass x and y in as variables, they will have the current x and y location stored in them when it's done.

Edit: And then you can just add your offset from that.


Sounds good but what if the offset makes it go north not south? So it will just click away from the window.

Kevin

2013-02-26 14:49:17

Well, the 07Include would make a lot of this far easier if you could get it working, but you could try doing something like:
procedure clickAttack;
var
x, y: integer;
begin
GetMousePos(x, y);
MMouse((x+random(10)), (y+random(5));
ClickMouse2(mouse_left);
end;

andryaze

2013-02-27 06:49:24

program chickenKiller;
{$I SRL\SRL.Simba}

var x, y: integer;

procedure clickAttack;
begin
if FindColorTolerance(x, y, 924798, 3, 6, 513, 319, 4) then
if FindColorTolerance(x, y, 3436942, 3, 6, 513, 319, 4) then
MouseSpeed := 10;
MoveMouse(x, y);
wait(100)
ClickMouse2(mouse_right);
wait(100)
MoveMouse(x + random(5), y + 20);
wait(100)
ClickMouse2(mouse_left);
wait(10000)
end;


begin
repeat
clickAttack;
until(false);
end.

This is currently attacking all chickens.
How can i create a loop that kinda waits until a chicken appears?
Once theres no chicken the script is just doing these steps:

ClickMouse2(mouse_right);
wait(100)
MoveMouse(x + random(5), y + 20);
wait(100)
ClickMouse2(mouse_left);
wait(10000)

At the same point like before.
Or maybe a random mousemovement meanwhile waiting.