SRL Archive - OSR Help

Mouse won't move to DTM


rsbots2013

2013-05-22 17:22:09

Can someone please help make this work or look and tell me why my mouse won't move to the spot my DTM is at. Many thanks.

procedure new;
var
x , y : integer;
i : Boolean;
begin
if FindDTMRotatedAlternating(spot1, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotatedAlternating(spot2, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotatedAlternating(spot3, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotatedAlternating(spot4, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) then
else
begin
repeat
i := True;
until(i);
writeln('Found spot!');
wait(1000);
MoveMouse( x, y);
end
end;

t4q

2013-05-22 17:52:42

This is big mess you got there…
procedure new;
var
x , y : integer;
i : Boolean;
begin
repeat
if FindDTMRotatedAlternating(spot1, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotatedAlternating(spot2, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotatedAlternating(spot3, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotatedAlternating(spot4, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) then
MoveMouse( x, y);
else
wait(1000);
until WaitUpText('UpText');
writeln('Found spot!');
end;

It should look something like this… But it's a infinite loop and wait with no random. You should read some tutorials or browse simple scripts :)

rsbots2013

2013-05-22 18:04:25

I keep getting this error "Identifier expected "

The Mayor

2013-05-22 18:13:43

Its because you messed up your if..then..else statement.

If [this happens] then [do this] else [if it didn't happen do this instead].

In your script you are saying:

If [Find these DTMs] then else [wait]. I.e. you don't tell it to do anything after then :)



procedure new;
var
x , y: integer;
i: Boolean;

begin
if FindDTMRotatedAlternating(spot1, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotatedAlternating(spot2, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotatedAlternating(spot3, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotatedAlternating(spot4, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) then
begin
writeln('Found spot!');
Wait(Randomrange(500, 750));
MMouse(x, y, 1, 1);
ClickMouse2(mouse_Left);
end else
writeln('we didnt find the spot');
end;

rsbots2013

2013-05-22 18:37:40

Now the script is not doing anything. It won't find the spot and it does not repeat looking for the DTM.

I've changed the script to this:

procedure New;
var
x , y : integer;
i : Boolean;
begin
if FindDTMRotatedAlternating(Spot1, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotatedAlternating(Spot2, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotatedAlternating(Spot3, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotatedAlternating(Spot4, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) then
begin
writeln('Found Spot!');
wait(1000);
Mouse( x, y, 0, 0, True);
end else
begin
repeat
i := True;
until(i);
end
end;

The Mayor

2013-05-22 18:44:03

From: rsbots2013
Now the script is not doing anything. It won't find the spot and it does not repeat looking for the DTM.

I've changed the script to this:


What exactly are your DTMs of, a symbol on the MM? and what are you trying to achieve with the i boolean?

rsbots2013

2013-05-22 19:20:46

I'll just put my script on here.

MoveToCookingHouse = a stationary image on the screen that slightly rotates (osrs)

I = is meant to just keep the loop going until it finds the 'MoveToCookingHouse(1-4)'

procedure RunToCookingHouse;
var
x , y : integer;
i : Boolean;
begin
if FindDTMRotatedAlternating(MoveToCookingHouse1, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotatedAlternating(MoveToCookingHouse2, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotatedAlternating(MoveToCookingHouse3, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotatedAlternating(MoveToCookingHouse4, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) then
begin
writeln('Found Cooking House!');
wait(1000);
Mouse( x, y, 0, 0, True);
end else
begin
repeat
i := True;
until(i);
end
end;

The Mayor

2013-05-22 19:50:38

From: rsbots2013
I'll just put my script on here.

MoveToCookingHouse = a stationary image on the screen that slightly rotates (osrs)

I = is meant to just keep the loop going until it finds the 'MoveToCookingHouse(1-4)'



Function RunToCookingHouse: Boolean;
var // Changed to a boolean function
x , y, timer: integer;

begin
markTime(timer); // start the failsafe timer
repeat
if FindDTMRotatedAlternating(MoveToCookingHouse1, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotatedAlternating(MoveToCookingHouse2, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotatedAlternating(MoveToCookingHouse3, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotatedAlternating(MoveToCookingHouse4, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) then
begin
result := true; // if it finds the DTM(s) then function results true
writeLn('Found Cooking House!');
wait(1000);
Mouse( x, y, 0, 0, True);
end
until (result = true) or (timeFromMark > 30000) // it will keep repeating for 30 sec

if timeFromMark > 30000 then
writeLn('we failed to find the Cooking House')
end;

rsbots2013

2013-05-22 19:58:47

thank you