Sumilion
2006-10-14 06:42:34
My exams are over, so i went scripting again ^^ , i thought about making a Frog colver that solves the frog cave instead of the frog random itself. I know, it's probably better to solve the frog random before you get to the cave, but if it fails then this would be a nice alternative.
I talked to Dankness about it and he told me he also made one and that it was in SRL. I never heard of it and also i thought it didn't exist because i find my players in the cave lots of times. So i checked it out, compared some stuff, well, here are the results :
- Dankness uses a Deformed BMP, only the search for it, so nothing else, took 1200msec on my pc, my DTMRotated took 300msec.
- Dankness his version ends up in the (almost) perfect middle of the center, mine however doesnt. It does walk to the center, but not always to the center of the center, has no further effect however.
- Because i use FindDtmRotated my dtm works in any angle of the MM, i believe that Dankness his version must be (near) north or it won't find the center.
Here is my code (I used a fairly simple AreWeInCave to find out if we are in the cave, was just purely for testing + i didn't finish it completely, I only have to end the conversation between you and the frogs, but this would mean my acc will leave the random)
I talked to Dankness about it and he told me he also made one and that it was in SRL. I never heard of it and also i thought it didn't exist because i find my players in the cave lots of times. So i checked it out, compared some stuff, well, here are the results :
- Dankness uses a Deformed BMP, only the search for it, so nothing else, took 1200msec on my pc, my DTMRotated took 300msec.
- Dankness his version ends up in the (almost) perfect middle of the center, mine however doesnt. It does walk to the center, but not always to the center of the center, has no further effect however.
- Because i use FindDtmRotated my dtm works in any angle of the MM, i believe that Dankness his version must be (near) north or it won't find the center.
Here is my code (I used a fairly simple AreWeInCave to find out if we are in the cave, was just purely for testing + i didn't finish it completely, I only have to end the conversation between you and the frogs, but this would mean my acc will leave the random)
program LeaveCave;
{.include SRL/SRL.scar}
Var
Center, Crown : Integer;
AngleVar : extended;
Procedure LoadDTMs;
Begin
Center := DTMFromString('78DA63EC6462603061400191C14E0C46409A1' +
'188FF0301E302A01A17881C13548D7971025C0D08302E07CA5812' +
'50B30828A34E40CD2CA08C3C0135BD401929026A9A80323204D45' +
'401651408A82904CAA81050930B94D125A0261B11CE38D5E40065' +
'AC08A8A904CA781050534F841A505C381050B30428634B40CD3CA' +
'08C1201351D84E3020008042788');
Crown := DTMFromString('78DA63CC616460D8C480027E9C9265B001D24' +
'01986FF40C0988F50C30C5573798D345C0D08306603591B50D5FC' +
'3E6F86AA0664D71654359F8FC9A2AAC9C4B4EBE57E54350015B91' +
'3ED');
End;
Function AreWeInCave : Boolean;
Var
Fx, Fy : integer;
Begin
Result := FindDTMRotated(Center, Fx, Fy, MMX1, MMY1, MMX2, MMY2, 0, pi*2, 0.1, AngleVar)
End;
Procedure LeaveCave;
Var
Fx, Fy, OptionMark : integer;
Begin
If Not(LoggedIn) Then Exit;
Repeat;
If (FindDTMRotated(Center, Fx, Fy, MMX1, MMY1, MMX2, MMY2, 0, pi*2, 0.1, AngleVar)) Then
Begin
Mouse(Fx, Fy, 0, 0, true);
FFlag(0);
Wait(300+Random(400));
MarkTime(OptionMark);
Repeat;
If (FindDTM(Crown, Fx, Fy, 90, 102, 473, 334)) Then
Begin
Mouse(Fx, Fy, 0, 0, false);
Wait(200+Random(500));
If (ChooseOption(Fx, Fy, 'Talk')) Then Break;
End Else Break;
Wait(200+Random(500));
Until(TimeFromMark(OptionMark) > 20000);
FFlag(0);
End;
Wait(300+Random(500));
Until(FindText(Fx, Fy, 'mph', NPCChars, MCX1, MCY1, MCX2, MCY2));
End;
begin
SetupSRL;
LoadDTMs;
ActivateClient;
Wait(500);
If (AreWeInCave) Then LeaveCave;
end.
