SRL Archive - OSR Help

[RS07] DTM Walking and general script


Netzone

2013-03-03 06:36:54

So I'm trying my hand at DTM Walking and well, it's not working as I would expect it to. Pretty much what happens is the script gets a full inventory, starts my DTM walking process, finishes it without actually doing anything, then keeps trying to fish.

I would greatly appreciate any help you could provide! :) I suspect there's either something wrong with the DTMs or the way I'm trying to make the script walk.

program NetCatherbyFisher;
{$I SRL/SRL.Simba}
{$I P07Include.Simba}

var x, y, CatFish3, CatFish2, CatCook, CatFish1, CatBank, CatTwoTrees, CatFishShop: Integer; PBox: TBox;

Procedure P07_DeclarePlayer;
Begin
P07_PlayerName:='';
P07_PlayerPass:='';
end;

procedure DTMs;
begin
CatFish3 := DTMFromString('mWAAAAHicY2FgYChjYmDIBuImIO4A4nCgWAIDhM4H4iPzYhm48v+DMYjNDxRDxoxoGAQAHIAKIw==');
CatCook := DTMFromString('mbQAAAHicY2VgYPBjYmDwB+JwILYDYh8gDgOKezJA6GAgTgDi4qwchjx/IzA9e8Ikht4WJQZ+oDg6ZsSCwQAAiKgJ9w==');
CatBank := DTMFromString('mWAAAAHicY2FgYLBjYmCwB2IfIA4A4hCgWBwQ+wNxNBDPnjCJoTgrhyHP34jhyauPDPxAMWTMiIZBAADdTgl2');
CatTwoTrees := DTMFromString('mWAAAAHicY2FgYHBmYmCwBWJ/IHYCYmegmDsQ+wCxIRAfmRfLEBwRycAocYZB0VeAgR8ohowZ0TAIAABgrAaL');
CatFishShop := DTMFromString('mWAAAAHicY2FgYHBmYmCwB2JvIHYFYiegmA0QWwCxBxBHBwYzKPoKgPHbl88Z+IFiyJgRDYMAAGZDBxU=');
end;

procedure DTMFree;
begin
FreeDTM(CatBank);
FreeDTM(CatFish3);
FreeDTM(CatTwoTrees);
FreeDTM(CatFishShop);
FreeDTM(CatCook);
end;

procedure StartCheck; // This will move the camera to the best place.
begin
Wait(RandomRange(1000,2000));
P07_MakeCameraAngleHigh();
P07_MakeCompassNorth;
P07_HoverSkill('Fishing', random(5000));
Wait(RandomRange(200,1000));
end;

procedure StartFish; //Checks for Fishing Spot and starts fishing
begin
if not P07_LoggedIn then Exit;
PBox := IntToBox(238, 149, 286, 186);
if not P07_InvFull then
if AveragePixelShift (PBox, 250, 350) < 30 then
Wait(RandomRange(250,1200));
if AveragePixelShift (PBox, 250, 350) < 30 then
If (P07_FindObjCustom(x, y, ['Ca', 'ge'], [15518125, 15452076, 13545623, 14398100, 14659209], 10)) then //Finds the Fishing spot
begin
MMouse(RandomRange(X - 5, X + 6), RandomRange(y - 5, y + 6), 0, 0); //Moves the mouse there
Wait(RandomRange(450,850));
If P07_IsUpTextMultiCustom(['Ca', 'ge']) then
ClickMouse2(Mouse_Left);
end
else
begin
repeat
wait(RandomRange(150,300));
until AveragePixelShift (PBox, 250, 350) < 30;
end else
writeln('Could not find any Fishing Spot');
P07_MakeCompassDegree(RandomRange(0, 360)); //Rotate camera in case script doesn't find any Fishing Spots. Will add walking here later
P07_MakeCameraAngleLow();
end;

procedure GoToBank;
var wx, wy: Integer;
begin
if (findDTM(CatTwoTrees,wx, wy, P07_MMX1, P07_MMY1, P07_MMX2, P07_MMY2)) then
begin
P07_MakeCompassNorth;
Wait(RandomRange(1200,2200));
MMouse(RandomRange(wx - 3, wx + 4), RandomRange(wy - 3, wy + 4), 0, 0);
Wait(RandomRange(400,1200));
ClickMouse2(Mouse_Left);
end;
begin
P07_MakeCompassNorth;
Wait(RandomRange(1200,2200));
if (findDTM(CatFishShop,wx, wy, P07_MMX1, P07_MMY1, P07_MMX2, P07_MMY2)) then
MMouse(RandomRange(wx - 3, wx + 4), RandomRange(wy - 3, wy + 4), 0, 0);
Wait(RandomRange(400,1200));
ClickMouse2(Mouse_Left)
end;
begin
P07_MakeCompassNorth;
Wait(RandomRange(1200,2200));
if (findDTM(CatCook,wx, wy, P07_MMX1, P07_MMY1, P07_MMX2, P07_MMY2)) then
MMouse(RandomRange(wx - 3, wx + 4), RandomRange(wy - 3, wy + 4), 0, 0);
Wait(RandomRange(400,1200));
ClickMouse2(Mouse_Left)
end;
begin
P07_MakeCompassNorth;
Wait(RandomRange(1200,2200));
if (findDTM(CatBank,wx, wy, P07_MMX1, P07_MMY1, P07_MMX2, P07_MMY2)) then
MMouse(RandomRange(wx - 3, wx + 4), RandomRange(wy - 3, wy + 4), 0, 0);
Wait(RandomRange(400,1200));
ClickMouse2(Mouse_Left)
writeln('Arrived at Bank! Banking...');
end;

end;


Function EasyAntiBan: Boolean; //AntiBan
begin
case random(60) of
0: P07_HoverSkill('Fishing', random(4500));
1: P07_MakeCameraAngleHigh;
2: P07_MakeCompassDegree(RandomRange(0, 180));
3: MMouse(random(100), random(420), 0, 0);
4: P07_MakeCameraAngleLow;
5: MMouse(random(600), random(120), 0, 0);
end;
end;

//Start of Main
begin

P07_DeclarePlayer;
SetupP07Include;
MouseSpeed := 15;

If (Not P07_LoggedIn) Then
begin
P07_LogInPlayer;
end;
Wait(RandomRange(500,1000));
StartCheck;
DTMs; //Load DTM's
//Start of fishing
repeat wait(RandomRange(5000,10000));
EasyAntiBan;
StartFish;
if (P07_InvFull) then
begin
GoToBank;
end;
until (not P07_LoggedIn)
DTMFree; //Frees them
end.

Sjoe

2013-03-03 06:52:46

I'm not sure why people are using DTM's for minimap walking, since they're pretty unstable.
I heard the colors tend to change a lot on 07, so u'll need a bigger tolerance.
I advice u to make multiple DTM's for 1 walking point.

Or just simply switch over to DDTM's.
Check the tutorial section for that ;)

Netzone

2013-03-03 07:17:33

From: Sjoekeloe
I'm not sure why people are using DTM's for minimap walking, since they're pretty unstable.
I heard the colors tend to change a lot on 07, so u'll need a bigger tolerance.
I advice u to make multiple DTM's for 1 walking point.

Or just simply switch over to DDTM's.
Check the tutorial section for that ;)


I don't think the dynamic color finder srl stuff works with 07, and without it, it would basically be a DTM anyway I think, right?

I'll try increasing the tolerance, but how do you mean multiple DTM's for 1 walking point? Have a couple of different DTM's for each walking point and then do case random? I'm not sure I quite understand.

Sjoe

2013-03-03 07:25:02

From: Netzone
I don't think the dynamic color finder srl stuff works with 07, and without it, it would basically be a DTM anyway I think, right?

I'll try increasing the tolerance, but how do you mean multiple DTM's for 1 walking point? Have a couple of different DTM's for each walking point and then do case random? I'm not sure I quite understand.


Of course it works! Why wouldn't it?

Yes use Different DTM's on each walking point, but don't use case random of.
Use it as a failsafe that it can fall back on..

If (FindDTMRotated(1)) then Mouse
else
if (FindDTMRotated(2)) then etc...
U get the point.


Or make an array of the dtms and use a for to do loop. which is easier to write.

For i:= 1 to High(CatTwoTrees) do
begin
if FindDTMRotated(CatTwoTrees[i],...) then
begin
// all your clicking thingies here :)
Break; // or use Exit; if u want it to go out of the proc/func
end else Writeln('Did not find DTM')
end;
I think it's coded like that (I suck with Arrays)

FindDTMRotated is better for Minimap usage.

EDIT:

Oh and u could also add this after a failed attempt to line your compass back again.
Maybe it wasn't perfectly north.


P07_MakeCompassSouth // or west or east, or any other degree.
P07_MakeCompassNorth

Runehack123

2013-03-03 07:28:58

If you're not sure then debug more. Chances are it's not finding your DTM. More Writeln('….. to show you what's actually happening or where it's getting stuck.

if (findDTM(CatTwoTrees,wx, wy, P07_MMX1, P07_MMY1, P07_MMX2, P07_MMY2)) then
begin
Writeln('Found DTM CatTwoTrees') <<<
P07_MakeCompassNorth;

etc..

As for multiple DTMs for one walking point..don't do case random because that defeats the purpose. I think what Sjoe is trying to get at is failsafes. If it doesn't find that DTM look for that and if it doesn't find that look for… etc…

You also need a begin end for these parts:
MMouse(RandomRange(wx - 3, wx + 4), RandomRange(wy - 3, wy + 4), 0, 0);
Wait(RandomRange(400,1200));
ClickMouse2(Mouse_Left)

Unless it's 1 line then you need a begin end after an if then statement unless you only want to include your next line in the if then statement which isn't the case here.

Also, add some timers for your DTM finding. Don't just put if FindDTM..You need some wait functions for that e.g. look for it for a couple of seconds every RandomRange(30,50) ms ..Remember use random waiting. Chances are you need to give it some time until your DTM is found.

And finally use AddOnTerminate('<DTM freeing procedure here>') and use If DTMsEXist function inside of your DTM freeing function.

Netzone

2013-03-03 11:16:43

From: Runehack123
If you're not sure then debug more. Chances are it's not finding your DTM. More Writeln('….. to show you what's actually happening or where it's getting stuck.

if (findDTM(CatTwoTrees,wx, wy, P07_MMX1, P07_MMY1, P07_MMX2, P07_MMY2)) then
begin
Writeln('Found DTM CatTwoTrees') <<<
P07_MakeCompassNorth;

etc..

As for multiple DTMs for one walking point..don't do case random because that defeats the purpose. I think what Sjoe is trying to get at is failsafes. If it doesn't find that DTM look for that and if it doesn't find that look for… etc…

You also need a begin end for these parts:
MMouse(RandomRange(wx - 3, wx + 4), RandomRange(wy - 3, wy + 4), 0, 0);
Wait(RandomRange(400,1200));
ClickMouse2(Mouse_Left)

Unless it's 1 line then you need a begin end after an if then statement unless you only want to include your next line in the if then statement which isn't the case here.

Also, add some timers for your DTM finding. Don't just put if FindDTM..You need some wait functions for that e.g. look for it for a couple of seconds every RandomRange(30,50) ms ..Remember use random waiting. Chances are you need to give it some time until your DTM is found.

And finally use AddOnTerminate('<DTM freeing procedure here>') and use If DTMsEXist function inside of your DTM freeing function.


Thank you very much!

I changed it a bit and I now have the script walking to the bank properly (atleast with up to date dtm's lol)

Also, add some timers for your DTM finding. Don't just put if FindDTM..You need some wait functions for that e.g. look for it for a couple of seconds every RandomRange(30,50) ms ..Remember use random waiting. Chances are you need to give it some time until your DTM is found.


What do you mean with this? I mean I understand what you're saying but I don't know how to do it. This is actually what I'm wanting to do right now because right now if it doesn't find the dtm it goes on to the next one, and that's obviously not going to be found at that time. It would be great with something that does what you're saying but I just don't know how to do it.

I changed the gotobank procedure and put all my finddtms in their own procedure then I'm calling them like this;

procedure GoToBank;
begin
Wait(RandomRange(1200,2200));
WCatTwoTrees;
begin
Wait(RandomRange(3000,3200));
WCatFishShop;
end;
begin
Wait(RandomRange(3000,3200));
WCatCook;
end;
begin
Wait(RandomRange(3000,3200));
WCatBank;
end;
begin
Wait(RandomRange(3000,3200));
end;
end;

You know, probably really rough scripting but it makes it easier to edit, and I can call them easier in other procedures, like if it doesn't find a fish at one place, try another.

Lisafishes

2013-03-03 14:08:11

What is your opinion on object dtm's are the coords wrong?

Netzone

2013-03-03 15:04:23

From: Sjoekeloe
Of course it works! Why wouldn't it?

Yes use Different DTM's on each walking point, but don't use case random of.
Use it as a failsafe that it can fall back on..

If (FindDTMRotated(1)) then Mouse
else
if (FindDTMRotated(2)) then etc...
U get the point.


Or make an array of the dtms and use a for to do loop. which is easier to write.

For i:= 1 to High(CatTwoTrees) do
begin
if FindDTMRotated(CatTwoTrees[i],...) then
begin
// all your clicking thingies here :)
Break; // or use Exit; if u want it to go out of the proc/func
end else Writeln('Did not find DTM')
end;
I think it's coded like that (I suck with Arrays)

FindDTMRotated is better for Minimap usage.

EDIT:

Oh and u could also add this after a failed attempt to line your compass back again.
Maybe it wasn't perfectly north.


P07_MakeCompassSouth // or west or east, or any other degree.
P07_MakeCompassNorth

I'm still stuck on the repeat. Here's one of my DTM procedures:

procedure WCatTwoTrees;
var wx, wy, i, numberOfWaits: Integer;
begin
repeat
P07_MakeCompassNorth;
Wait(RandomRange(1200,2200));
Inc(numberOfWaits);
if (findDTMRotated(CatTwoTrees, wx, wy, P07_MMX1, P07_MMY1, P07_MMX2, P07_MMY2, -Pi/4, Pi/4, Pi/60, SsFound )) then begin
writeln('CatTwoTrees Found.');
MMouse(RandomRange(wx - 3, wx + 4), RandomRange(wy - 3, wy + 4), 0, 0);
Wait(RandomRange(400,1200));
ClickMouse2(Mouse_Left);
end;
until(numberOfWaits = 5);
begin
writeln('Failsafe needed.')
P07_MakeCompassNorth;
Wait(RandomRange(1200,2200));
if (findDTMRotated(CatFish3, wx, wy, P07_MMX1, P07_MMY1, P07_MMX2, P07_MMY2, -Pi/4, Pi/4, Pi/60, SsFound )) then begin
writeln('CatFish3 failsafe Found.');
MMouse(RandomRange(wx - 3, wx + 4), RandomRange(wy - 3, wy + 4), 0, 0);
Wait(RandomRange(400,1200));
ClickMouse2(Mouse_Left);
end;
end;
end;

As you can see, this script just repeats the finddtmrotated(cattwotrees, ..)) five times and then goes on to the next, which is supposed to be the failsafe.
What I could do is put "Inc(numberOfWaits);" below the FindDTMRotated and make it until(numberOfWaits = 1); but then there would be no way to break the repeat and go on to the failsafe.

How should I do it?

Runehack123

2013-03-03 15:33:05

Try looking at the function WaitFunc in the SRL include and you will know what to do when it comes to looking for DTM in a certain amount of time.

Netzone

2013-03-03 16:03:39

From: Runehack123
Try looking at the function WaitFunc in the SRL include and you will know what to do when it comes to looking for DTM in a certain amount of time.

I honestly can't figure it out.

I mean, I can see how it could technically work but firstly, would it work with a procedure?


procedure WCatTwoTrees;
var wx, wy, i, numberOfWaits: Integer;
begin
WaitFunc(@WCatTwoTrees, 100 + Random(150), 5000);
P07_MakeCompassNorth;
Wait(RandomRange(1200,2200));
if (findDTMRotated(CatTwoTrees, wx, wy, P07_MMX1, P07_MMY1, P07_MMX2, P07_MMY2, -Pi/4, Pi/4, Pi/60, SsFound )) then begin
writeln('CatTwoTrees Found.');
Result := True;
MMouse(RandomRange(wx - 3, wx + 4), RandomRange(wy - 3, wy + 4), 0, 0);
Wait(RandomRange(400,1200));
ClickMouse2(Mouse_Left);

end else

begin
writeln('Failsafe needed.')
P07_MakeCompassNorth;
Wait(RandomRange(1200,2200));
if (findDTMRotated(CatFish3, wx, wy, P07_MMX1, P07_MMY1, P07_MMX2, P07_MMY2, -Pi/4, Pi/4, Pi/60, SsFound )) then begin
writeln('CatFish3 failsafe Found.');
MMouse(RandomRange(wx - 3, wx + 4), RandomRange(wy - 3, wy + 4), 0, 0);
Wait(RandomRange(400,1200));
ClickMouse2(Mouse_Left);
end;
end;
end;

Would this work? I really don't understand the useage of it.

[Edit] That gives me a type mismatch error though.

Runehack123

2013-03-04 07:16:30

>>> If WaitFunc(@(WCatTwoTrees), RandomRange(150,250), 5000) Then
etc…
since WaitFunc returns a boolean so make use of that.
Also need those brackets after the @ sign.

You can also do marktime and then While TimeFromMark less than X do
If Find DTMA then begin etc..
Wait(RandomRange(150,250)

While TimeFromMark between equal or greater than X and less than Y do
If Find DTMB then begin etc..
Wait(RandomRange(150,250)

While TimeFromMark less than or equal to Y do
If Find DTMC Then begin etc…
Wait(RandomRange(150,250)

Something like that.
Like I said, look at the code of WaitFunc to see how it works. Make use of the search button of the Simba program and then look at the SRL include.

ibad18

2013-04-03 04:07:34

ERROR: Exception: Error while reading stream: File "C:\Simba\Includes\SPS\img\runescape_surface07\8_7.png" does not exist
SPS_MergeAreas ERROR: Exception: You are accessing an invalid point, (0,0) at bitmap[3]
Error: Exception: Access violation at line 398
The following DTMs were not freed: [SRL - Lamp bitmap, SRL - Book of Knowledge, 2, 3]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Minimap Mask bitmap, 4, 5]
[Error] C:\Simba\Includes\SPS\sps-osr.simba(55:35): Unknown identifier 'MMCX' at line 54
Compiling failed.

I have SRL-OSR installed idk what the issue is please help