SRL Archive - OSR Help

Need help with my first basic script


Dan the man

2012-02-10 21:39:22

Hey all I am very new to scripting SRL (started last night Lol) and I am attempting to make a script that simply clicks ruby bolt tips, clicks addy bolts, waits and clicks the tip all option waits 5 seconds then repeats until all gone.

At the moment it cannot seem to find anything Lol.

Any help is appreciated!

program DansRubyBolter;
{$i srl/srl/misc/smart.scar} // This is how we include SMART; it HAS to be included BEFORE SRL!
{.include SRL/SRL.scar}
//{$i SRL\SRL.scar} // Be sure to add this to ALL your scripts!


Procedure DeclarePlayers;
begin
HowManyPlayers:= 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer:= 0;

Players[0].Name := ''; // Username
Players[0].Pass := ''; // Password
Players[0].Nick := ''; // 3-4 lowercase letters from username; used for random event detection
Players[0].Active := True; // Set to true if you want to use Player 0
end;

Procedure MakeABolt;
Var
BoltTips, UnTippedBolts, x, y:Integer;
begin
BoltTips:=DTMFromString('78DA636C6161602866644006D9C6FA0CFC401' +
'A26CAD80354D384AA06260B57530A54534D404D2D504D0A013513' +
'806A32F1AB010097DC05D3');
if FindDTM(BoltTips, x, y, MSX1, MSY1, MSX2, MSY2) then
begin
WriteLn('Found Bolt Tips!');
MMouse(x, y, 4, 4);
ClickMouse(x, y, 1);
end else
begin
WriteLn('Cannot Find Bolt Tips!');
End;
UntippedBolts:= DTMFromString('78DA635CC7C2C050C8C8800C6CDC6CC0344C9' +
'4713E504D25AA1A982C5CCD16A09A26026A7601D5E41050B30AA8' +
'2615BF1A00DA200688');
If FindDTM(UnTippedBolts, x, y, MSX1, MSY1, MSX2, MSY2) then
begin
WriteLn('Found Bolt Tips!');
MMouse(x, y, 4, 4);
ClickMouse(x, y, 1);
end else
begin
WriteLn('Cannot Find Addy Bolts!');
End;
begin;
WriteLn('Moving Mouse to make bolts');
MMouse(x, y, 5, 5);
ClickMouse(x, y, 1);
Wait(5000);
end;
end;






// Our main loop
begin
Smart_Server:= 49;
Smart_Members:= True;
Smart_Signed:= True;
Smart_SuperDetail:= False;

ClearDebug;
SetupSRL;
DeclarePlayers;
Repeat
MakeABolt;
until(false);
LoginPlayer;
end.

Er1k

2012-02-10 23:02:22

FindDTM(UnTippedBolts, x, y, MSX1, MSY1, MSX2, MSY2)

You're trying to find your stuff in the mainscreen.

Try

FindDTM(UnTippedBolts, x, y, MIX1, MIY1, MIX2, MIY2)

E: You're also using SRL4. Update to SRL5 because it's more updated.

TsterT

2012-02-10 23:13:56

Little bit of a clarification on what nosaj said.

The "MS" in MSX1, MSY1, ect, stands for Mainscreen. Each of those stand for a point on the screen. These are the points the script will be looking for, in this case, the DTMs

The "MI" in MIX1, MIY1, ect, stands for Main Inventory. Same deal as MS, these stand for points on the screen, and create a boundary to search in.

Dan the man

2012-02-10 23:22:50

Thankyou for the replies guys, how would I go about updating SRL4 to SRL5?

Er1k

2012-02-10 23:36:56

This should do. Declare at the beginning

{$DEFINE SRL5}
{$DEFINE SMART}
{$I SRL/SRL.simba}

E: You should also search the thread about SRL5 in the forum so that you know how to switch the code from SRL4 to SRL5.

Dan the man

2012-02-10 23:38:34

Excellent, so the mouse is detecting my Ruby bolt tips, but doesnt seem to find my adamant bolts :(

TsterT

2012-02-11 00:47:38

Make sure the tolerance on your main point in your DTM is set to 255.

Dan the man

2012-02-11 03:54:16

255 really? It said on the DTm tutorial that i need to set it to round 15-20 or so

TsterT

2012-02-11 04:09:56

Well if you're using the same DTM for multiple items with a different color on that main point, a tolerance of 15-20 won't find the other item. 255 is max tolerance, meaning it will accept any color.

Er1k

2012-02-12 20:35:58

I think in his application, 15-20 would work, but wouldnt matter to use 255. But when you use 255, beware of false positives.