SRL Archive - OSR Help

How to repeat until true?


peetu

2012-03-28 10:26:18

So I am making a port phasmatys cannonball smither.
I won't go into any more details, I just want to loop FindDTM until it returns true.

This is how I tried doing it:

program PhasmatysBaller;
{$i srl/srl.simba}
{$i sps/sps.simba}

//Global variables

var

Booth:Integer;
Booth2:Integer;
Booth3:Integer;
clicklog:Integer;


//End of global variables


procedure bank;

var

x, y:Integer;

begin

Booth := DTMFromString('mWAAAAHicY2FgYPgExJyMDAz/gDQjkJYGYhkg1gBiESAurk1gqGxJYwiNU2WISDBgYAeqQ8aMaBgEAIzgBws=');
Booth2 := DTMFromString('mWAAAAHicY2FgYPgBxLyMDAxfgLQAkPaBYlcoLq1PYqhqSWeISjJkCI/TZ2AHqkPGjGgYBADAVAfi');
Booth3 := DTMFromString('mWAAAAHicY2FgYDgExLeB+CIQ3wLi50D8Aoi/AvE7IM7IC2HIL0lgCAwzYPALMmfgBoohY0Y0DAIAp2YLSg==');

if FindDTM(Booth, x, y, MSX1, MSY1, MSX2, MSY2) or
FindDTM(Booth2, x, y, MSX1, MSY1, MSX2, MSY2) or
FindDTM(Booth3, x, y, MSX1, MSY1, MSX2, MSY2) then

begin
mouse(x, y, 3, 3, true);
end;
FreeDTM(Booth);
FreeDTM(Booth2);
FreeDTM(Booth3);
end;


//////////////////////////////////////////////////////////////////////

function open:boolean;

var
x, y:Integer;
clicklog:Integer;
clicklog2:Integer;

begin

clicklog := DTMFromString('mbQAAAHicY2VgYGBhZGB4AaSfAbE0kC0PxFeA+CIQXwXi81D+zp07GFwKxBlUvLkYohtMGLSCeBg4gHrQMSMWDAYANr4LaQ==');
clicklog2 := DTMFromString('mQwAAAHicY2ZgYGBhZGB4AaRlgPQlIL4MxBeB+N+/vwzWySIMTtliDIJAeRhmRMJAAABWvQgr');

if FindDTM(clicklog, x, y, 26, 380, 480, 480) then
begin
result :=true;
freeDTM(clicklog);
freeDTM(clicklog2);
end else
result :=false;
freeDTM(clicklog);
freeDTM(clicklog2);
end;

//////////////////////////////////////////////////////////////////////


procedure Clickgreen;

var
x, y:Integer;
green:Integer;

begin

green := DTMFromString('mbQAAAHicY2VgYGBhZGB4AaSfAbE0kC0PxFeA+CIQXwXi81D+zp07GFwKxBlUvLkYohtMGLSCeBg4gHrQMSMWDAYANr4LaQ==');

if FindDTM(Clicklog, x, y, 26, 380, 480, 480) then
begin
mouse(x, y, 4, 4, true);
end;
freeDTM(green);
end;

//////////////////////////////////////////////////////////////////


procedure FindBar;


var
x, y:Integer;
bar:Integer;

begin

bar := DTMFromString('mlwAAAHicY2dgYOiD4kYoPQ2KW4H4NBDfAOJLQHwCiE8C8VkgPgXEzbW1QJKJQVVZmSE5Ph7Mb29sBLO5gTK4MCMeDAUAnDMRBw==');

if FindDTM(bar, x, y, 0, 0, 500, 328) then
begin
mouse(x, y, 2, 2, false);
end;
freeDTM(bar);
end;

/////////////////////////////////////////////////////////////////////






begin
SetUpSRL;

bank

wait(2000);

repeat
open;
until(true);

wait(1000 + random(201));
Clickgreen
wait(1000 + random(512));
FindBar
end.


What am I doing wrong?

Sin

2012-03-28 10:29:55


repeat
wait(10);
until(findDTM(scnsdijnc));

shstiger2009

2012-03-28 10:31:32

wouldn't it be…

repeat
wait(20);
until(FindDTM);

I could be wrong…

Damnit Sin ninja'd me.

Jagex_Fagex

2012-03-28 10:33:24

Take clickGreen for example, how about:


procedure Clickgreen;

var
x, y, green: Integer;

begin
green := DTMFromString('mbQAAAHicY2VgYGBhZGB4AaSfAbE0kC0PxFeA+CIQXwXi81D+zp07GFwKxBlUvLkYohtMGLSCeBg4gHrQMSMWDAYANr4LaQ==');
repeat
if FindDTM(Clicklog, x, y, 26, 380, 480, 480) then
begin
mouse(x, y, 4, 4, true);
end;
until(FindDTM(Clicklog, x, y, 26, 380, 480, 480));
freeDTM(green);
end;

Might i also suggest giving http://villavu.com/forum/showthread.php?t=60288 a read through?

EDIT: Ninja'd, also, i didn't read your post correctly, but from either three of the responses, you get the basic idea how to do it, and can apply it however you like.

Imanoobbot

2012-03-28 10:36:18


repeat
wait(10);
until(findDTM(scnsdijnc)); // (scnsdijnc) there should be the name of your DTM i think

Sin

2012-03-28 10:38:02

Nah, scnsdijnc are your parameters.

JuKKa

2012-03-28 10:38:07

repeat
wait(10)
until Open

shstiger2009

2012-03-28 10:38:33

From: Imanoobbot

repeat
wait(10);
until(findDTM(scnsdijnc)); // (scnsdijnc) there should be the name of your DTM i think


LOL. Why did you copy Sin's post word for word and just comment in the DTM line….

-____- :redface:

Sin

2012-03-28 10:42:35

Currently Active Users Viewing This Thread: 10 (10 members and 0 guests)
Sin, Home, Janilabo, JuKKa, masterBB, mixster, peetu, Runescape Pro, weeps, WT-Fakawi+

Mother of god..

peetu

2012-03-28 10:59:36

Allright, thanks for the bunch of input. Now I should be able to complete my port phasmatys cannonballer.