SRL Archive - SRL Archives

Freaky Forester Solver


dontpanic

2007-02-17 20:49:30

This kindof works, however it sometimes clicks the wrong pheasent. It usually works though.

{.include srl/srl.scar}
var
ff1,ff2,ff3,ff4:integer;

procedure SetupFf;
begin
ff1:= DTMFromString('78DA633465606038C18002164F6E64E002D28' +
'C503EA32490380561B341C5A4BD9D51D518018993A86A0AFDA551' +
'D400008F090647');
ff2:=DTMFromString('78DA63BCC7C0C020CA8002125C2418B880342' +
'394CF7817484841D86C50B1FA2805543527818408AA1A511B3314' +
'35004A9A0534');
ff3:= DTMFromString('78DA635CC8C8C0E0C58002164F6E64E002D28' +
'C503EE34A20CB07C266C3A5663590E589AA26D34B1A55CD1220CB' +
'0C558D90A1368A1A00F1DB089F');
ff4:=DTMFromString('78DA63EC626460D0076224B07872230317908' +
'68932B6005986101E1B2E358D40963901354D40960901350D4096' +
'1D116AAC08A8990164B9A0AA91F67646510300C50D10AA');
end;

function FindForester2:boolean;
begin
Result:=FindObj(x,y,'eaky',608105,5);
end;

function FindNumbText(Text:string):boolean;
begin
Result:=FindText(x,y,Text,npcChars,379, 364,504, 423);
end;

function Forester:boolean;
var
dtmtouse,ffMark:longint;
begin
if(not(FindForester2)) then Exit;
WriteLn('Found Freaky Forester, trying to solve');
Result:=True;
MarkTime(ffMark);
repeat
FindForester2;
Mouse(x,y,0,0,true);
Flag;
wait(700+random(1000));
dtmtouse:=-1;
if(TimeFromMark(ffMark)>120000 ) then begin
writeln('Error solving!!!');
Logout;
Exit;
end;
WriteLn('Checking for number');
if(FindNumbText('one')) then dtmtouse:=ff1;
if(FindNumbText('two')) then dtmtouse:=ff2;
if(FindNumbText('three')) then dtmtouse:=ff3;
if(FindNumbText('four')) then dtmtouse:=ff4;
until not (dtmtouse=-1);
writeln('Found a number');
MarkTime(ffMark);
repeat
repeat
wait(100);
if(TimeFromMark(ffMark)>120000 ) then begin
writeln('Error solving!!!');
Logout;
Exit;
end;
until(FindMSDtm(x,y,dtmtouse));
Mouse(x,y,0,0,false);
wait(10+random(50));
until ClickOption('Attack',1);
Flag;
wait(6000+random(1000));
FindObj(x,y,'Take',2971261,10);
ClickMouse(x,y,true);
wait(100);
Flag;
wait(500+random(500));
Mouse(593, 80,1,1,true);
Flag;
wait(1000+random(100));
Mouse(660, 84,1,1,true);
Flag;
wait(1000+random(100));
repeat
FindForester2;
Mouse(x,y,0,0,false);
wait(100+random(100));
if(TimeFromMark(ffMark)>120000 ) then begin
writeln('Error solving!!!');
Logout;
Exit;
end;
until ClickOption('Talk',1);
Flag;
wait(1000+random(1000));
{MMouse(272, 448,1,30);
wait(300+random(100));
repeat
Mouse(272, 448,1,30,true);
wait(1000+random(500));
until(not(FindColor(x,y,275, 444,499, 459,16777215)));
} Mouse(710, 76,2,2,true);
Flag;
wait(1000+random(1000));
repeat
wait(100);
until FindObj(x,y,'Portal',11264995,10);
Mouse(x,y,0,0,true);
wait(3000+random(1000));
WriteLn('Solved Forester!');
end;









begin
SetupSRL;
SetupFf;
ActivateClient;
wait(100);
BenMouse:=False;
Forester;
end.

Ron

2007-02-17 21:30:58

I suppose a function to solve a random working most of the time is not as bad as not having a way at all. :)

Nice work man. Except you forgot to free the DTMs from memory.

t3hl33tn00b

2007-02-18 01:51:43

From: Ron
I suppose a function to solve a random working most of the time is not as bad as not having a way at all. :)

Nice work man. Except you forgot to free the DTMs from memory.


i know this is stupid but
what does freebitmap and freedtm do?

Meanage

2007-02-18 03:37:17

From: t3hl33tn00b
i know this is stupid but
what does freebitmap and freedtm do?


it frees them from the memory, when you load a dtm or bitmap it stores them in the memory if you dont free them they stay there lagging the script while your not using them. Nice script, Ive only ever had the forester once though

Wizzup?

2007-02-18 03:59:49

From: Ron
I suppose a function to solve a random working most of the time is not as bad as not having a way at all. :)

Nice work man. Except you forgot to free the DTMs from memory.


If it fails you get tele'd to some weird spot (close to wildy), plus you don't get them clothes. ;)
By the way, aren't there 5 kinds of pheasants?

dontpanic

2007-02-18 18:14:50

Oh srry i didnt check this topic enough.
I dont free the dtms cause the setup would be called at setupsrl.
Also, the main problem it has is just not finding any pheasant. It doesnt ever find the wrong one.
I have an idea that might improve it however I dont know how to do it. My idea is to find rotated versions of the dtms also, because at this point it waits until the pheasants are pointed a certain driection. I would be glad if someone whould tell me how to do this.

Hey321

2007-02-18 20:19:35

FindBitmapRotated…? I believe that's it.

Ron

2007-02-19 22:44:54

Hey321, you're close.

It's FindDTMRotated(). :)

dontpanic

2007-02-20 19:21:49

I have never been able to get the find dtm (or bitmap) rotated things to work. I'm not sure I understand all the angle stuffs. Also, I dont have a freaky forester account anymore, but when i get one i'l try to remake it using deformed bitmaps. It should work a lot faster then.

Cheesehunk

2007-02-20 19:54:00

It actually worked pretty well, but there was a problem.. Every time it found the 3 - tailed pheasant it would lag so bad with the DTM that by the time the mouse got there, the pheasant had moved..

dontpanic

2007-02-20 21:28:44

Could I borrow the account with one to try making deformed bitmaps to use? (i cant do it right now, but I probably can tomarrow)

Cheesehunk

2007-02-20 21:58:25

From: dontpanic
Could I borrow the account with one to try making deformed bitmaps to use? (i cant do it right now, but I probably can tomarrow)

Sorry, being an idiot, I was in a rush and solved the random by myself.. :p Whoops, if I get another one, I will look into it.

Wizzup?

2007-02-21 02:06:31

I will say it once more, it is fun to solve those randoms, but most scripts will stop anyway, colors lost etc. :)

dontpanic

2007-02-21 09:05:58

Erm, it is quite easy to make a script in which solving these will work perfectly well. Just allow a random find in between tries of finding an object, so even if finding a rock/tree/flax/etc fails, it will allow a random event find.

And to cheesehunk: thats fine, I'll probably get one soon enough.