SRL Archive - OSR Help

DTM pathing


derangedyeti

2013-03-24 23:43:20

In the script I am making, I am trying to use the icons that are on the minimap to navigate to and from the General Store, but the problem is that when I find the first icon , Tele, the script ends on the way to the destination. I have added in wait timers. For instance Wait(RandomRange(10000, 11000)); but this just waits and then terminates the script there. Should I make a seperate procedure for each DTM? I feel like this is too much work. If anyone could give me advice that would be much appreciated.


program VialBuyer;
{$I SRL/SRL.Simba}
{$I P07Include.Simba}

var
Tele,Store, x, y: Integer;


Procedure P07_DeclarePlayer;
begin
P07_PlayerName :='';
P07_PlayerPass :='';
end;

Procedure GoToStore;
begin

P07_MakeCompassNorth;
Store := DTMFromString('mlwAAAHicY2dgYHjOxMDwEIifAfErIH4KxI+gbAFGBgZ+IOaC0sJALATEIkDc5SXIsH3teobpvf0M8WosDJviFMFiuSmpDLiACBAz4sFQAAAywQ9y');
Tele := DTMFromString('mlwAAAHicY2dgYOAEYmYgZgdiViDmAWI2BggA8bmRxJDFDdytGbavXQ/GIPblEB4wG0TLAeVFkDAyYMSDoQAAT18Kww==');
if FindDTM(Tele, x, y, MMX1, MMY1, MMX2, MMY2) Then
Begin
Writeln('Found Tele Icon');
Mouse(x, y, 7, 7, True);
end
else
begin
WriteLn('I need to fix the minimap');
end;
FreeDTM(Tele);
//Script abruptly ends here
P07_FFlag;

if FindDTM(Store, x, y, MMX1, MMY1, MMX2, MMY2) Then
Begin
WriteLn('Found General Store Icon');
Mouse(x, y, 5, 5, True);
end;

FreeDTM(Store);

end;

begin
P07_DeclarePlayer;
SetupP07Include;
SetupSRL;
ActivateClient;
GoToStore;

end.

Total

2013-03-24 23:58:17

I suggest you don't put DTMs in the procedures you use them in, instead you can call them at the start of the script. For example:

procedure LoadDTMs;
begin
Store := DTMFromString('mlwAAAHicY2dgYHjOxMDwEIifAfErIH4KxI+gbAFGBgZ+IOaC0sJALATEIkDc5SXIsH3teobpvf0M8WosDJviFMFiuSmpDLiACBAz4sFQAAAywQ9y');
Tele := DTMFromString('mlwAAAHicY2dgYOAEYmYgZgdiViDmAWI2BggA8bmRxJDFDdytGbavXQ/GIPblEB4wG0TLAeVFkDAyYMSDoQAAT18Kww==');;
end;

procedure Freee;
begin
FreeDTM(Store);
FreeDTM(Tele);
end;

You can set Store and Tele as global variables so you can call them wherever. So in the main part of your script you could put:

begin
P07_DeclarePlayer;
SetupP07Include;
SetupSRL;
ActivateClient;
LoadDTMs;
AddOnTerminate('Freee');
GoToStore;
end.

AddOnTerminate will just run that procedure whenever you end the script.

Also, the official SRL-OSR include has a built in procedure to find symbols(FindSymbol) so you might want to consider using SRL-OSR instead.

derangedyeti

2013-03-25 00:05:48

That is great information, but it still doesn't tell me why the script just abruptly ends..

Total

2013-03-25 00:09:47

I'm guessing that P07_FFlag is not working or its not able to find the store DTM. You could try doing this to check if its finding the DTM or not:


if FindDTM(Store, x, y, MMX1, MMY1, MMX2, MMY2) Then
Begin
WriteLn('Found General Store Icon');
Mouse(x, y, 5, 5, True);
end else
Writeln('Didnt find general store icon');

derangedyeti

2013-03-25 11:52:47

From: Total
I'm guessing that P07_FFlag is not working or its not able to find the store DTM. You could try doing this to check if its finding the DTM or not:


if FindDTM(Store, x, y, MMX1, MMY1, MMX2, MMY2) Then
Begin
WriteLn('Found General Store Icon');
Mouse(x, y, 5, 5, True);
end else
Writeln('Didnt find general store icon');


I tested and I could find the store DTM so I don't think that this is the problem. Is the 07Include working or not, because I added a Wait procedure to take the place of the FFlag and that fixed it. Should I be using SLR-OSR then? Thanks

Total

2013-03-25 15:49:57

Most of SRL-OSR is working and I would suggest using it over the 07 include mainly for the use of antirandoms. I also know that Flag is working in SRL-OSR because I use it.

The Bot

2013-03-25 16:00:30

If you must use the P07_Include, then download the OSR-SRL but delete the P07_GetUpChar function in P07_Include since they share the same name in both libraries/includes but function identically. Then you can use SRL alongside with P07_Include.