SRL Archive - Help

Better movement?


girboy

2013-01-14 14:56:18

A bit of background, I'm playing on a RSPS(projectRS06) and I've made myself a fairly decent auto-fletcher and I've got the idea of using DTM/bitmaps to preform actions such as opening the bank and storing cut bows and getting new logs and inv checking.
However now that I want to make scripts with movement (Auto-spinning flax for example) I'm having problems with consistent movement and it's causing the script to have slight errors that completely destroy any possibility of my script working with the current way movement is being handled.
My question now is, what is the best (Meaning most accurate and least difficult to set up) movement handling procedure I can use? I know about DDTM/DTM for mapwalk and findcolor. However I'm unsure of how these would all handle in a very crowded area where most spaces have white dots covering them.
If this doesn't make enough sense or some other information is needed please ask and I'll try to explain better or provide the missing information.

TL;DR - What is a good way to do movement in crowded areas?

Shatterhand

2013-01-14 15:03:25

You should try to find points where people/npcs CANT stand, like some bushes, water or the black area when not on ground floor.

girboy

2013-01-14 15:07:43

From: Shatterhand
You should try to find points where people/npcs CANT stand, like some bushes, water or the black area when not on ground floor.


A bit more explanation as to what this would do please. I'm sure how that would change the way X, Y cords would work.

EDIT: I guess I'll post the spinning script, it works pretty poorly and uses some incredibly terrible movement that need a lot of work.

program FlaxSpinner_version_1_b;
{.include srl/srl.simba}

var
bankbooth, close, mainbag, x, y, x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, x6, y6, Flax, bowstring, depositbs, withdrawflax: Integer;


procedure fixthings;

begin

close := BitmapFromString(37, 10, 'meJyNklEOgCAMQ3cm8Vfjl9FbcX' +
'RJGps6xmQhZta5R2Flv8p3LdvZr9KVjdZ63OGqtbbnL4i4Vu8690q' +
'OM7NJFpprfagkRC3+ZeU4ZzPB1TfYX19zL6qQi3AgRKtpPe0NsKAg' +
'yb2MFPyuEwKF7pw1Qke4yYRnyES9AEez/QDABfepZzjJVS/OYHj1+' +
'pVbSnB6oSah00gxnLHQvpsZTZAjHh/kFcU=');

mainbag := BitmapFromString(17, 17, 'meJxtUsENgzAMDKr6aSvePPlHar' +
'9sUIkxkLpGR+gIbMEYXanUziVnE5As5Nh39tkm9GPox9P9Vdn58ZZ' +
'vSFnvq9MN9JHypqkEgG/BFAeFBfEkBanw/BilYDxFABkzr2FaxPdF' +
'qJkwUMbvT/DqT4vVb6MfWatNC9opHjXbqHFxUF+eZTpqBl0pghFVo' +
'HBj8nTacs1UUCgQZprnVZ1CqbbqW3MVeRuuxWYo7sct08S40+RqIm' +
'Z3AlMC5E6A2lH3PL7vRcHlBFyj/9NsV+6ZxywU24zb8ME/LFkYj9g' +
'Nl+ttE6muQzzjbWyacHDEfZFCF7zYH5CRngY=');



If (FindBitmaptoleranceIn(close, x3, y3, 0, 0, 500, 457, 15)) then
Mouse( x3, y3, 3, 3, true);

If (FindBitmapToleranceIn(mainbag, x4, y4, 615, 143, 680, 187, 20)) then
Mouse( x4, y4, 3, 3, true);

end;

procedure getflax;

begin

bankbooth := BitmapFromString(46, 13, 'meJzVk0kOwCAIRbmdF+i29z9Gm5' +
'RIfkUGh0VLWJCPylOwHGf5hl+PZUT3EEJfISGiUAxJ2KZh9pI08d9' +
'JcDaQROsWiTibTlnr8XApjdX9ODMnvs4p0TXGConujn6uLqE0pXn2' +
'XSTditaacE6aDs6RZOLucOqK9V4eSTixIRVulBjFzO+mt4UpKx798' +
'kO7kn4D0lbs7w==');

withdrawflax := BitmapFromString(112, 14, 'meJztlkEOwyAMBHlab/1Ar/1Tf' +
'0yrRkLurndDSURyCPKBOAvYg0HcH8/7ZZed2Oq3eU//2DHNLimYLF' +
'QMt1cFa86NwZRSjMeTZ+W/mu0wP/NDeHFdFcOCrvy25pzDs0c5jWe' +
'bPHIb4Lnq3IunivBsPD3DQ3g2dLA67D4TBifMzHmB2DjVZzo2XauH' +
'J1yYwNNouM88Y0fVJxM211fKE2ZYPtO1fJFDSGM8Y0bAMwpSpFHQz' +
'1NFxTQUJfarGgNlzY7MzPMOD4AoZph78Rzo9+xIinomT65Pfw+kFV' +
'JDCU3jmfZr2N9jefq6VYEBTBVw7XiT8AapvFLl4o/bCsfq2PNu7tV' +
'mJTT2s4z/KqXRGOXiT/ur4a3GpoaPJaImv2yjvQGDMdDd');

Flax := DTMFromString('mrAAAAHic42BgYPBhYmBwBmJrIPYA4iAgDmGCiNsA8SOgmndA/BiIbwPxKyj9HohfALHH+i1AkhEnFmHAD3DrhGAYAACIJgtR');



If (FindDTM(Flax, x, y, MIX1, MIY1, MIX2, MIY2)) then
writeln('Found flax! Moving to spin.')
else
begin
writeln('No flax found. Getting flax.');
Mouse( 258, 115, 0, 0, false);
Wait(250+random(500));
FindBitmapToleranceIn(bankbooth, x1, y1, 0, 0, 500, 457, 15);
Mouse( x1, y1, 3, 3, true);
Wait(1000);
FindDTM(Flax, x, y, 12, 35, 500, 285)
Mouse( x, y, 5, 5, false);
Wait(400);
FindBitmapToleranceIn(withdrawflax, x2, y2, 12, 32, 483, 289, 100);
Mouse( x2, y2, 3, 3, true);
Wait(400);
FindBitmaptoleranceIn(close, x3, y3, 0, 0, 500, 457, 15);
Mouse( x3, y3, 5, 3, true);
writeln('Got flax! Moving to spin.');
end;
If NOT (FindDTM( Flax, x, y, 540, 116, 734, 462)) then
begin
WriteLn('Could not find flax, terminating script');
Terminatescript;
end;
end;

procedure movetospin;

begin
begin
writeln('Walking...')
Mouse( 216, 263, 0, 0, true);
Wait(3000+random(300));
Mouse( 252, 307, 0, 0, true);
Wait(3000+random(300));
Mouse( 54, 235, 0, 0, true);
Wait(3000+random(300));
Mouse( 90, 308, 0, 0, true);
Wait(3000+random(300));
Mouse( 252, 312, 0, 0, true);
Wait(3300);
Mouse( 640, 82, 0, 0, true);
Wait(3700);
Mouse( 256, 176, 0, 0, true);
Wait(3000);
Mouse( 73, 149, 0, 0, true);
Wait(3000);
Mouse( 253, 397, 0, 0, false);
Wait(400+random(250));
Mouse( 254, 402, 0, 0, true);
Wait(500+random(250));
TypeSend('28');
end;

repeat
wait(500);
writeln('Waiting for all flax to be spun.');
until not FindDTM(flax, x, y, 540, 116, 734, 462)
writeln('All flax spun, banking flax now!');

end;

procedure movetobank;
begin

bowstring := DTMFromString('m1gAAAHic42JgYPBgYmDwBGIrIA4HYhcg9gFiJyD2B2IHKP0EqPYGED8C4pdA/BGIPwDxMwaI3B0gfg3EJRleQJKRIBZhIA4QNgmCEQAAKTgNNw==');

depositbs := BitmapFromString(130, 15, 'meJztVUsOhDAI7dFm1wu4nTvNj' +
'Z1EIyE8oLSGOpO0YYGoUN7jU7d33d77derxOE3UuNxi3er12blMvn' +
'YeFKWUSPrZcbld6MhCOc4EIrJDUJpnpqRY6SfFxQIIsiD0VBZSQ6h' +
'lP40FH/k/YuF+v1jDWZ0Vw0bLP51eFkiop8QrCyIHMXXjRCyVTRJn' +
'bfnrTIWxXEdYcIDsMF7wSwxH/od7QeyFpt2vbf47z13YOZjCIqAOX' +
's8iAtNvAtUcLyoLQecWXL36mbgzYZxW4t9bPYisRa5nITPAgvgSe+' +
'RxFnCOIQv1GixOKzUtvTrVvzVVhlkQTf0jLBC8Dgt+iAwWeOkKxMi' +
'uFrnDF7ZDEgs4nMUrYeczXC2PiNs7LKghRA/irdCuVrj/r9UOjhNL' +
'D/p37Kre69a6WDCF8zHSj0uyZbHwLPKLhcfF2jtLJgvunS+2S8Ff');

Mouse( 410, 157, 0, 0, true);
Wait(3000);
Mouse( 265, 184, 0, 0, true);
Wait(3000);
Mouse( 330, 10, 0, 0, true);
Wait(3000);
Mouse( 264, 28, 0, 0, true);
Wait(3000);
Mouse( 685, 8, 0, 0, true);
Wait(6000);
Mouse( 256, 114, 0, 0, true);
Wait(2000);
Mouse( 263, 112, 0, 0, false);
Wait(250+random(500));
if FindBitmapToleranceIn(bankbooth, x1, y1, 0, 0, 500, 457, 15) then
begin
Mouse( x1, y1, 3, 3, true);
Wait(1000);
FindDTM(bowstring, x5, y5, 529, 109, 760, 493);
Mouse( x5, y5, 0, 0, false);
Wait(500);
FindBitmapToleranceIn(depositbs, x6, y6, 534, 156, 743, 470, 20);
Mouse( x6, y6, 0, 0, true);
FindBitmaptoleranceIn(close, x3, y3, 0, 0, 500, 457, 15);
Mouse( x3, y3, 5, 3, true);
end
else begin
writeln('Could not find bank, terminating.');
terminatescript;
end;







end;



begin
setupsrl;
cleardebug;

fixthings;
repeat
getflax;
movetospin;
movetobank;
until(false);
end.

Like I said, I'm using very terrible movement and the movements are failing quite often, enough to where it won't get to the spinner 100% of the time or won't get to the bank.
I'm very willing to learn new things if they will help me out in the long run.

Shatterhand

2013-01-14 15:26:00

Here is an example for the black background.
You choose the point where you want to walk to, set it as the first point of the DTM, give it high tolerance, 500. If someone stands on the point that wont be a problem, thats why we have such a high tolerance.
The rest of the points should be from the black background where people cant stand so its safe.

girboy

2013-01-14 15:32:17

Okay, that makes a bit more sense. Ill give that a shot and see how it works for this.

Also would things like a fence or a wall work or would they be too thin to work for this?

rj

2013-01-14 15:40:30

You could use DTM's on the minimap similar to above with this code:

program WalkToSpot;
{$I srl/srl.simba}
var
DTM_1:integer;
begin
MouseSPeed := 15;
DTM_1 := DTMFromString('mbQAAAHicY2VgYKhnYmBoBuJiIO4D4oVAbAUUNwRiIyA2B2IzIK4tKWE4fXYzGOsniDCkO6kw8ADF0TEjFgwGAAnNC2o=');





ClickDTMRotatedIn(DTM_1, MMX1,MMY1, MMX2,MMY2, -Pi, Pi, Pi/30, [], mouse_Left);
Wait(1000);
while (IsMoving) do
wait(100);


FreeDTM(DTM_1);
end.


Only use my code if the spot you are walking to is only 1-2 clicks away as it is not the best walking method for long-distance

Shatterhand

2013-01-14 15:53:37

From: girboy
Okay, that makes a bit more sense. Ill give that a shot and see how it works for this.

Also would things like a fence or a wall work or would they be too thin to work for this?

Walls and fences change a lot, try trees/bushes.