SRL Archive - OSR Help

Finding\opening door


samerdl

2013-04-04 08:24:28

I need guidance where to go on from here, please.

What it does right now: Using SPS for OSR; Goes from point A to Gate entrance right clicks in mouse coordinates to find the option to open gate then go to point C (does around 7 clicks because SPS for OSR is not accurate).
What i want it to do (if possible): Go from Point A find the Gate by color/bitemap/dtm and click it without doing the stop to find the open door option and continue with the path.

The Gate - added more pictures on my post below

So i tried the following:
- ACA - can't really find a best color, the gate has no door handle and the background area (everything in the landscape) has the same colors as it.
- DTM'S - tried variation of tolerance and dtm's, in the editor it shows up perfectly matching the spots, but in game it just doesn't work.
- Bitemaps - tried all sort of edges unique shapes on it (closed door areas), didn't work in game either.

maybe its something wrong with the code?


program findgate;
{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}

procedure findthegate;
var
wall, x, y: integer;
begin
wall := BitmapFromString(19, 18, 'meJy10dsKgkAUheE3ColEDMG7CA' +
'p8hYggs2GQDqh1JR2euw2LFsOMTWUE/5X4sXXvKEmiZ+M0LZtG0lX' +
'FTpcr2+72K6UGwVCKuqA6HJkJN2UpAY7i2LQ/wslsTli3rTTNMkle' +
'+HwiIFprDQVo2n5wkeeATHZIJSuVOqF7i/PtzgCDMETuD746IlZKi' +
'IkY+g/IXX37qZZ6C7lSF/JTJQ+0VgqIccui8JzDA3l0V/FJb2j+l3' +
'ULE3Kl7kQhD9K8d3A=');
If FindBitMapToleranceIn(wall, X, Y, MSX1, MSY1, MSX2, MSY2, 15) then
begin
WriteLn('success');
end
Else
begin
Writeln('failure');
freebitmap(wall);
end;
end;

procedure findgate;
var
aFound: extended;
x,y, wall: integer;
begin
DTMFromString('mWAAAAHicY2FgYIhmZGAIAuIIIPYB4jKgWCkQ9wBxIxDb2JgzVFYWMDQ2VoBpdMCIhkEAAL02CEM=');
if FindDTM (Wall, x, y, MSX1, MSY1, MSX2, MSY2) then
begin
writeln ('success');
MouseBox(x, y, 0, 0, 0);
FreeDTM(wall);
end
else
begin
writeln (' failure');
end;
end;

begin
setupsrl;
findthegate;
findgate;
end.

I know am missing something, just need someone to guide me where to look, i am looking for something worth investing effort into it, i really don't wanna learn more advanced stuff that don't actually help.. Or maybe this is all just hopeless.

Second question - is there a way to make the mouse move slowly\steady from one point to another till it finds an uptext option instead of just right clicking all over the place? How do you WindMouse?

if anyone could help me, i would be more than thankful!.
But please forgive my spelling mistakes, i didn't sleep properly today and had my exam in the morning in one city then had to drive for class to another.

Ian

2013-04-04 11:26:21

Could you upload a screenshot of the door? It would be helpful :)

The Killer

2013-04-04 11:33:09

From: BMWxi
Could you upload a screenshot of the door? It would be helpful :)


^this, we can help you select colours but we will need a screenshot(try and keep a high quality format such as bitmaps).

samerdl

2013-04-04 12:04:29

uploaded in edit and also another picture






its the gate At jatziso

Wow, thats awesome if you can do that.. But i also (sorry for asking) can you tell me where i can find a dummies guide to TPA/ATPA'S (a guide for object use, i know how to use them, but don't know how to use them in a specific area of the screen).

edit will reupload pictures to correct format in a few minutes..

samerdl

2013-04-05 07:06:31

Ugh i found a partial solution thanks to hoodz..
Four commands:
-FindObjEx(X, Y, ['Open', 'Gate', 'pen, ate','open gate','pen', 'ate'], [2434855, 2895408, 2697770], 5, 70, MSX1, MSY1, MSX2, MSY2)
-WaitUpText('pen', Random(600+600))
-FindObjEx(X, Y, ['Close', 'Gate', 'lose, ate','close gate','lose', 'ate'], [2434855, 2895408, 2697770], 5, 70, MSX1, MSY1, MSX2, MSY2)
-WaitUpText('lose', Random(600+600))
^ the above helps me see if its closed it opens it, if its open (option to close) it continues with the path :-).

Thanks hoodz.

The Killer

2013-04-06 12:13:12

function OpenDoor: Boolean;
var
DoorTPA: TPointArray;
DoorATPA: T2DPointArray;
TmpCTS, i, h: Integer;
WhereToClick: TPoint;
begin
TmpCTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.17, 0.07);

if FindColorsTolerance(DoorTPA, 3225398, MSX1, MSY1, MSX2, 10) then
begin
DoorATPA := SplitTPAEx(DoorTPA, 10, 10);
SortATPASize(DoorATPA, True);
h := High(TheATPA);
for i := 0 to h do
begin
WhereToClick := MiddleTPA(DoorATPA[i]);
Mouse(WhereToClick.x, WhereToClick.y, 10, 10, Mouse_Right);
if WaitOption('pen', 150) then
begin
Writeln('We found and opened the door successfully')
Result := True;
Exit;
end;
end;
end else
Writeln('Couldn''t find the door');
end;
I should encourage you to do it yourself but I was in a mood for scripting :p
http://villavu.com/forum/showthread.php?t=90767 <– A good tutorial to learn how to use Tpa's :P