SRL Archive - OSR Help

Beginner needs help


CephaXz

2012-04-15 11:36:09

I have totally no knowledge of scripting. I wanted to have my own script for everything I wanted to bot, so I started to learn scripting 3 days ago by reading many of the tutorials and followed some videos and made a woodcutting script with Yohojo's video tut and I thought scripting isn't that hard, I was wrong.

I am trying to make a construction bot that builds and remove wooden crude chair. I used DTM instead of colors because the colors of the chair is very similar to the walls of the house. TPA mind fucked me, kinda too advance for me now. But I just cant get the script to find the built chair and remove it. Need some advises and guidance from experts here.


program crudechair;
//{$DEFINE SMART}
{$i SRL/SRL.simba}

Const

SRLStats_Username = ''; // Your SRL Stats Username
SRLStats_Password = ''; // Your SRL Stats Password
NumbOfPlayers= 1; //How many players are you using
StartPlayer= 0; //Player to start auoting with! (0 means first char)
BreakEvery = '' ;
BreakFor = '' ;


procedure DeclarePlayers;
var i:integer;
begin
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer;
for i := 0 to NumbOfPlayers-1 do
Players[i].BoxRewards := ['mote', 'ostume', 'XP', 'Gem'];

with Players[0] do
begin
Name := ''; //Player username.
Pass := ''; //Player password.
Active := True;
end;

end;


Function FindChair: Boolean;
var
ChairDTM, x, y:Integer;

Begin
ChairDTM := DTMFromString('mlwAAAHicY2dgYGBjZGBgBWJhIBYBYg4g/g0U/w/EZ4D4CBAfB+JrQPwIiC8D8Wkg9nOUYDDXE2TIDTdg6C92YFjQ6MEwu9aVwcdegoELKI8LM+LBUAAAkTEO9w==');

If FindDTM(ChairDTM, x, y, MSX1, MSY1, MSX2, MSY2) Then
begin
GetMousePos(x, y);
IsUpText('Sit');
Result:= True
end;

FreeDTM(ChairDTM);
End;


Procedure RemoveChair;
var
x, y:Integer;

Begin
If FindChair Then
Begin
writeln('Found Chair!');
Mouse(x, y, 2, 2, False);
WaitOption('Remove', 500);
End;
End;





begin
SetupSRL;
ActivateClient;
//Repeat
RemoveChair;
//Until
end.

Total

2012-04-15 11:41:36

Try using FindRotatedDTM or FindColorsSpiralTolerance with TPAs.


var
x, y : Integer;
aFound : Extended;
Begin
if FindDTMRotated(ChairDTM, x, y, MSX1, MSY1, MSX2, MSY2, -Pi/4, Pi/4, Pi/60, aFound) then
end;

I'm not sure where the FindColorsSpiralTolerance tut is but I'm sure there are multiple out there.

Don't know if you've seen this thread but it really helped me starting out. http://villavu.com/forum/showthread.php?t=76632

CephaXz

2012-04-15 12:00:49

Isn't TPA using colors too? Is it not good since the colors of chair and the surroundings are very similar?

Gucci

2012-04-15 12:03:14

From: CephaXz
Isn't TPA using colors too? Is it not good since the colors of chair and the surroundings are very similar?


Yes and TPA's are a bit harder to grasp. Use a DTM instead as it will be more accurate in this case. TotalKillz has set it up for you all you have to do is incorporate that and make a DTM for the chair

Total

2012-04-15 12:04:31

Well if you use FindColorsSpiralTolerance correctly it will start from the middle of the screen and go in a spiral outwards, so it will likely find whatever is closer to your character. Are you using ACA to get your color? If not you should use it and it should be set to CTS 2 for the most accurate color.

Or that ^ haha.

CephaXz

2012-04-15 13:03:14

From: Gucci
Yes and TPA's are a bit harder to grasp. Use a DTM instead as it will be more accurate in this case. TotalKillz has set it up for you all you have to do is incorporate that and make a DTM for the chair


I see DTM are more used in inventory and bank, where items has black outline. Chair has no black outlines and I can't find of any tut that finds objects on mainscreen with DTM, kind of a new thing to me.

From: TotalKillz
Well if you use FindColorsSpiralTolerance correctly it will start from the middle of the screen and go in a spiral outwards, so it will likely find whatever is closer to your character. Are you using ACA to get your color? If not you should use it and it should be set to CTS 2 for the most accurate color.

Or that ^ haha.



I had thought about using spiral finding before, but TPA has more codes that I couldn't understand yet, so I used DTM instead. Is there any way I can understand more of the sangle,eangle,astep,afound? No point copy and paste the code you gave me and not understanding them. Thanks!

Total

2012-04-15 13:09:28

Chapter 5 in this thread is where I learned it from. I don't even know exactly what the parameters are, all I know is that it rotates the DTM for a greater chance to find it. I use those end parameters for every FindRotatedDTM I use :p.
If i were to guess, sangle is start angle, eangle is end angle, and astep is the interval in which it rotates between the angles.

Gucci

2012-04-15 13:18:18

You don't need a black outline for making a DTM just chose a point on the chair if the chair is mostly highlighted and nothing but the chair is then it's good

CephaXz

2012-04-15 13:33:14

From: TotalKillz
Chapter 5 in this thread is where I learned it from. I don't even know exactly what the parameters are, all I know is that it rotates the DTM for a greater chance to find it. I use those end parameters for every FindRotatedDTM I use :p.
If i were to guess, sangle is start angle, eangle is end angle, and astep is the interval in which it rotates between the angles.


I did read that thread, I believe there should be pictures in that thread but its not there for some reason so I can't fully understand it. I guess my DTM finding is a failure, maybe I should try out TPA. Thanks again :)