Santa_Clause
2008-07-24 05:26:46
Program SantySuperHeater;
{.include SRL/SRL/Misc/SMART.scar}
{.include SRL/SRL.scar}
{.include SRL/SRL/Misc/Users.scar}
{.include SRL/SRL/Skill/Magic.scar}
Function DeleteFromArray(ArrayInteger : TIntegerArray; Index : Integer) : TIntegerArray;
Var
I, J : Integer;
SubArray : TIntegerArray;
Begin
J := 0;
If Index > High(ArrayInteger) Then
Exit;
If Index < 0 Then
Exit;
If Length(ArrayInteger) <= 0 Then
Exit;
SetArrayLength(Result, High(ArrayInteger));
SetArrayLength(SubArray, High(ArrayInteger));
For I := 0 To High(ArrayInteger) Do
If I <> Index Then
Begin
SubArray[J] := ArrayInteger[I];
J := J + 1;
End;
Result := SubArray;
End;
Function GetInventorySpots : TIntegerArray;
Var
Ore : Integer;
X, Y : Integer;
I, J : Integer;
Begin
Ore := DTMFromString('78DA634C66606010676440063EBE850CFC401' +
'A24FA1F081863800C65543510591809A4F380843001352140428E' +
'809A2022CC4903121204D480FC254D404D3011EE4904124AF8D50' +
'000DF50097A');
SetArrayLength(Result, 28);
For I := 1 To 28 Do
If FindDTM(Ore, X, Y, MIX1, MIY1, MIX2, MIY2) Then
Begin
Result[J] := I;
Inc(J);
End;
SetArrayLength(Result, J - 1);
FreeDTM(Ore);
End;
Function FindOre(OreType : String; Var X, Y : Integer; X1, Y1, X2, Y2 : Integer) : Boolean;
Var
Ore : Integer;
Begin
Case Lowercase(OreType) Of
'mithril' : Ore := DTMFromString('78DA634C66606010676440063EBE850CFC401' +
'A24FA1F081863800C65543510591809A4F380843001352140428E' +
'809A2022CC4903121204D480FC254D404D3011EE4904124AF8D50' +
'000DF50097A');
'coal' : Ore := DTMFromString('78DA63EC6660601061644006AAAA920C5C401' +
'A24FA1F0818416A9451D54064612490EE0512B204D4CC06124204' +
'D4CC0412A204D434000939026A5A818434116E26A00600C29209C' +
'1');
End;
FindNormalRandoms;
Result := FindDTM(Ore, X, Y, X1, Y1, X2, Y2);
FreeDTM(Ore);
End;
Function FixLag : Boolean;
Begin
If Not(LoggedIn) Then
Exit;
If IsUpText('->') Then
If Not(IsUpText('uperh')) Then
Begin
MouseBox(MIX1, MIY1, MIX2, MIY2, 1);
WriteLn('Recovered From Lag');
Result := True;
End;
End;
Function WithDrawOres : Boolean;
Var
X, Y : Integer;
Bars : TStringArray;
Number, I : Integer;
Begin
Bars := ['Mithril', 'Coal'];
If Not(LoggedIn) Then
Exit;
FindNormalRandoms;
If Not(OpenBankFast('FEB')) Then
Begin
WriteLn('Failed - Couldn''t Open Bank');
Exit;
End;
MarkTime(I);
While TimeFromMark(I) < 5000 Do
Begin
FindNormalRandoms;
If BankScreen Then
Break;
Wait(250 + Random(50));
End;
If Not(BankScreen) Then
Begin
WriteLn('Failed - Not In BankScreen');
Exit;
End;
For I := 0 To 1 Do
If FindOre(Bars[I], X, Y, MSX1, MSY1, MSX2, MSY2) Then
Begin
Wait(250 + Random(50));
Mouse(X, Y, 5, 5, False);
Wait(200 + Random(100));
Case Lowercase(Bars[I]) Of
'mithril' : Number := 5;
'coal' : Number := 20;
End;
If Not(ChooseOption(IntToStr(Number))) Then
Begin
Logout;
Exit;
End;
Wait(1000 + Random(500));
End Else
Begin
WriteLn('No ' + Bars[I] + ' In Bank');
Logout;
Players[CurrentPlayer].Active := False;
Exit;
End;
If CloseBank Then
Result := True;
End;
Function SuperHeatOres : Boolean;
Var
I, J, K : Integer;
MithrilSpots : TIntegerArray;
MithrilLength : Integer;
X, Y : Integer;
Begin
If Not(LoggedIn) Then
Begin
If AllPlayersInActive Then
Begin
WriteLn('Terminating - All Players Are Now InActive');
Logout;
TerminateScript;
End;
Repeat
If CurrentPlayer = HowManyPlayers - 1 Then
CurrentPlayer := 0
Else
Inc(CurrentPlayer);
Inc(I);
Until(Players[CurrentPlayer].Active);
LoginPlayer;
End;
For J := 1 To 5 Do
Begin
GameTab(7);
MarkTime(I);
While TimeFromMark(I)< 5000 Do
Begin
If GetCurrentTab = 7 Then
Break;
Wait(250);
End;
For I := 1 To 5 Do
Begin
FixLag;
MouseBox(684, 305, 698, 316, 1);
End;
FixLag;
MarkTime(I);
While TimeFromMark(I) < 5000 Do
Begin
Wait(75 + Random(100));
If GetCurrentTab = 4 Then
Break;
End;
FindNormalRandoms;
FixLag;
If Not(GetCurrentTab = 4) Then
Begin
WriteLn('Failed - Not On Tab 4');
Exit;
End;
Wait(300 + Random(250));
If FindOre('Mithril', X, Y, MIX1, MIY1, MIX2, MIY2) Then
Begin
Mouse(X, Y, 7, 7, True);
MarkTime(I);
While TimeFromMark(I) < 5000 Do
Begin
Wait(100);
If GetCurrentTab = 7 Then
Break;
End;
FixLag;
If Not(GetCurrentTab = 7) Then
Begin
WriteLn('Failed - Not On Tab 7');
Exit;
End;
End Else
Begin
WriteLn('Failed - No Mithril Ores');
Logout;
Players[CurrentPlayer].Active := False;
Exit;
End;
FixLag;
Wait(300 + Random(300));
End;
If J = 5 Then
Result := True;
End;
Function DepositBars : Boolean;
Var
Bar : Integer;
I : Integer;
Option : String;
X, Y : Integer;
Begin
If Not(LoggedIn) Then
Exit;
Bar := DTMFromString('78DA63CC67626078CA8002FCFC8B19FE03694' +
'620FE0F048CE94035F719D000231209A48951530554F388809A32' +
'A09A1704D41400D5BC23A0A618A8E62E7E35005FC70F76');
FindNormalRandoms;
If Not(OpenBankFast('FEB')) Then
Begin
WriteLn('Failed - Couldn''t Open Bank');
Exit;
End;
MarkTime(I);
While TimeFromMark(I) < 5000 Do
Begin
FindNormalRandoms;
If BankScreen Then
Break;
Wait(250 + Random(50));
End;
If Not(BankScreen) Then
Begin
WriteLn('Failed - Not In BankScreen');
Exit;
End;
If FindDTM(Bar, X, Y, MIX1, MIY1, MIX2, MIY2) Then
Begin
FindNormalRandoms;
Mouse(X, Y, 5, 5, False);
Wait(250 + Random(100));
Case Random(4) Of
0 : Option := '5';
1 : Option := '10';
2 : Option := '20';
3 : Option := 'All';
End;
If Not(ChooseOption(Option)) Then
Begin
WriteLn('Failed - Couldn''t Choose Option');
Exit;
End;
End Else
Begin
WriteLn('Failed - No Bars In Inventory');
Exit;
End;
If BankScreen Then
Result := True;
End;
Begin
SetupSRL;
MouseSpeed := 20;
SRLPlayerForm(True, [], [], [], []);
ActivateClient;
LoginPlayer;
Repeat
DepositBars;
WithdrawOres;
SuperHeatOres;
Until(False);
End.I thought it'd be an easy script, but I was wrong. I think it might just be me lagging, but can someone else test this with mithril bars?
Have nature runes in your inventory and mithril and coal ores in the bank, then run the script. Would appreciate if someone tested it.
P.S - Ignore any inefficient coding. I wrote this in around an hour.