SRL Archive - First Scripts

Not truly a first.. but my first real script.


Sawyer

2013-01-23 23:22:39

Note: Edited script and it runs MUCH more smoothly now. Also no longer attempts to withdraw the empty vials twice. Save the map in your Simba/includes/sps/img/runescape_other for the SPS walking and Testing would be very much appreciated :)


program EdgeVialFiller;
{$DEFINE SMART8}
{$I SRL/SRL.Simba}
{$i sps/sps.simba}

var
Status:String;
ToFountain:tpointarray;
ToBank:tpointarray;


procedure DeclarePlayers;
begin
Status := ('Logging in player.')
writeln('Logging in player.')
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

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

procedure SetupSmartClient;
begin
SRL_SixHourFix := True;
SMART_FixSpeed := True;

ClearDebug;
SetupSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
SymbolAccuracy := 0.4;
end;

Procedure SetupBot;
begin
ClickNorth(0);
SPS_WalkPath(ToBank);
end;

Procedure Antiban; // Credit to Solidone40
Begin
Status :=('Antiban')
writeln('Antiban.')

Case Random(100) Of
1: HoverSkill('magic', False); //replace 'magic' with 'skill'
2: HoverSkill('random', False);
3: Boredhuman;
4: Wait(2500 + random(4500));
5: HoverSkill('smithing', False); // replace 'smithing' with 'skill', or delete.
6: PickUpMouse;
7: RandomMovement;
8: RandomRClick;
end;
mouse(658, 188, 3, 3, true);
end;

Procedure FindVials;
var
X, Y:Integer;

begin
Status :=('Opening bank and retrieving empty vials.');
writeln('Opening bank and retrieving empty vials.');
if BankScreen then
begin
if InvFull then
begin
DepositAll;
end;
FindObjCustom(x, y, ['Vial', 'Via'], [6578271, 6775650, 6051928], 2);
Mouse(x, y, 2, 2, false);
ChooseOption('All')
wait(Randomrange(500, 1000));
end;
if not BankScreen then
begin
FindObjCustom(x, y, ['Ban', 'Bank', 'Banker'], [4796471, 2889756, 3809319, 4796471, 3285286], 15);
Mouse(x, y, 2, 2, false);
ChooseOption('Bank Banker');
wait(randomrange(1500, 2000));
if InvFull then
begin
DepositAll;
end;
if FindObjCustom(x, y, ['Vial', 'Vial'], [6578271, 6775650, 6051928], 5) then
Mouse(x, y, 2, 2, false);
ChooseOption('All')
end;
begin
wait(Randomrange(500, 1000));
CloseBank;
Sps_walkpath(ToFountain);
Antiban;
end;
end;

Procedure FillVials;
var
x, y, EmptyVial, FillScreen:Integer;
begin
Status :=('Filling Vials...')
Writeln('Filling Vials...')
EmptyVial := DTMFromString('mKgEAAHic42NgYHBkYmBwA2JPIPYBYlcgtgViCyC2BmI7KN8JiN2h6kB6pBkZGEQZIbQCEKsCsQqULQnEQkDMB8TsQMwLxMpQNQkJKUBbmUjGzECSHMxIJkYFACLaBrc=');
wait(randomrange(1000, 1500));
if FindDTM(EmptyVial, x, y, 551, 257, 724, 505) then
writeln('Found Vials in inventory.');
Mouse(x, y, 2, 2, false);
ChooseOption('Use');
if not FindDTM(EmptyVial, x, y, 551, 257, 724, 505) then
writeln('Did not find vials in inventory.');
if FindObjCustom(x, y, ['Vial', 'use', 'Use', 'Foun'], [16100232, 14786173, 13800052], 5) then
Mouse(x, y, 2, 2, false);
chooseoption('Use Vial');
wait(2000);
FillScreen := BitmapFromString(32, 13, 'meJylkT0KwlAQhJsk/jTewcZ7CD' +
'aCrU0qi1SpBAtFvYGdrYWNjV5F8BBexIV9DEN29ykIXzHs/PBI6ml' +
'Z/8ZoPBHy2rKaFUCTFrVez7egF1fzFGjmlYKkJbPJGlNMuyiVTotB' +
'QHW0jylmtywUTuLI6Fon+bV1rCuFkzi6bqRtSzg1PSXzfazrakwx5' +
'7av/P9/McVc1onM+63rakwx181A4SSOrhtp2xJu2wQncXTdSNuW8D' +
'gMFU7i6LqRti3hvk9wEkfXjbRtCR8mW9lU');
wait(1000);
FindBitmapToleranceIn(FillScreen, x, y, 2, 46, 510, 367, 5);
writeln('Found Fill Screen.');
wait(randomrange(500, 1000));
mouse(x, y, 5, 5, true);
wait(randomrange(16000, 20000));
FreeBitmap(FillScreen);
FreeDTM(EmptyVial);
SPS_WalkPath(ToBank);
Antiban;
end;

procedure Bank;
var
x, y, VialOfWater:Integer;

begin
VialOfWater := DTMFromString('mPwEAAHic42dgYHBkYmDwAGIfIHaCsr2A2A2I3Zkg8rZQbAXFdkBsAcTSjAwMEkCsAMSqQKwMxDJALAzEfEDMDqVFGSFqQfIqQCwHxJUNW4G2M5GFmYEkuZiRAowGAF32B6A=');
Status :=('Banking.')
writeln('Banking.')
wait(randomrange(2000, 3500));
if FindObjCustom(x, y, ['Ban', 'Bank', 'Banker'], [4796471, 2889756, 3809319, 4796471, 3285286], 15) then
begin
Mouse(x, y, 2, 2, false);
wait(500);
ChooseOption('Bank Banker');
wait(randomrange(1000, 1250));
if FindDTM(VialOfWater, x, y, 551, 257, 724, 505) then
begin
wait(randomrange(750, 1500));
mouse(x, y, 2, 2, false);
chooseOption('All');
end;
end;
if not FindDTM(VialOfWater, x, y, 551, 257, 724, 505) then
writeln('Could Not find vials to bank in your inventory.');
FreeDTM(VialOfWater);
end;

Procedure Paths;
begin
ToFountain := [Point(126, 134), Point(126, 121), Point(115, 113), Point(100, 112), Point(87, 113), Point(76, 110), Point(69, 97)]
ToBank := [Point(62, 98), Point(72, 110), Point(86, 114), Point(99, 113), Point(115, 112), Point(126, 116), Point(128, 126), Point(127, 139), Point(125, 151)]
end;

procedure testpath;
begin
if sps_walkpath(ToFountain) then
status := 'walking to the fountain'
else begin
status :='failed walking to the fountain';
writeln(status + ' + time running:' +timerunning);
end;
writeln(status + ' + time running:' +timerunning);
end;







begin
SetupSmartClient;
SPS_Setup(runescape_other,['Varrock_East_Bank']);
Paths;
SetupBot;
//testpath;
repeat
FindVials;
FillVials;
Bank;
Until(Allplayersinactive)
end.

I used this map btw :P
[ATTACH=CONFIG]18799[/ATTACH]

John

2013-01-23 23:46:21

You should attach the maps if you want people to test it for you :)

PhatSound

2013-01-23 23:52:03

This looks really good! For improvements my suggestions are to work a bit on your standards, particularly in the FillVials and Bank procedures (it may not be that big of a deal, but i suppose its just a good habit to get into). Also a good spot for you to call the antiban is after the lines Sps_walkpath(ToFountain) and SPS_WalkPath(ToBank). Unfortunately I know nothing of SPS so I can't look at any of that code, but that's my two cents for it. This is a good first full script to have :)

Sawyer

2013-01-23 23:55:31

thanks :) I will try to attach the map.

Sjoe

2013-01-24 05:22:59

Well done! Good first script.

Sawyer

2013-01-24 23:12:29

I've edited the script to be much better:)