Sir R. M8gic1an
2010-08-02 08:08:04
{ Gamer716 Presents - Junior Member Competition #2 Entry
_________________________________________________________________________
Start Date: July 22, 2010
Finished Date: July 25, 2010
Features of this Script:
- Full Color Walking Functions & Procedures
- TPA Color Walking and Object Finding
- Anti-Ban & Randoms
- Plenty of Failsafes
-Supports Talisman and Tiaras!
[Important]: Due to the late start date, I am unable to test and fix bugs
Known Bugs: The script has a hard time finding the portal inside the altar
I'm preparing a fix as we speak...but the walking, banking, entering
should be fine.
Credits:
SRL Forums (of course) for all the helpful Tutorials that allowed this to happen
Special Thanks to Cigue who helped me throughout the script!
Instructions: Start off in VWB with full inventory rune ess.
}
program AirRuneCrafter;
{$DEFINE SMART}
{$i SRL\SRL.scar}
const
SmartWorld = 152;
Members = False;
SignedClient = True;
HighDetail = False;
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers (HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Pin := '';
Players[0].Integers[0]:= 100; //How many loads?
Players[0].Active := true;
end;
var
x, y, loads, w: integer;
RCPoint: TPoint;
Procedure AntiBan;
begin
If not(LoggedIn) then Exit;
begin
Case Random(50) of
0 : RandomRClick;
1 : RandomAngle(True);
2 : BoredHuman;
3 : ExamineInv;
4 : begin
HoverSkill('runecrafting', False);
GameTab(Tab_Inv);
end;
5..7 : PickUpMouse;
8..10 : SleepAndMoveMouse(500 + Random(5000));
11..12 : GameTab(RandomRange(20, 36));
13..17: Wait(RandomRange(3000, 5500));
end;
If FindNormalRandoms then
begin
GameTab(Tab_Inv);
LampSkill := 'Runecrafting'
SetAngle(True);
end;
end;
end;
Procedure Report;
begin
SRLRandomsReport
Writeln('__________________________________________');
Writeln('|Gamer716 Air Runecrafter Progress Report|');
Writeln('|Total Time Running: ' + TimeRunning);
for w := 0 to (HowManyPlayers - 1) do
begin
Writeln('Total Amount of Loads Done...' + IntToStr(Players[w].Integers[1]));
Writeln('| Thanks for using!|');
Writeln('------------------------------------------');
end;
end;
function Load_DTM(WhichDTM: integer): Boolean;
var
DTM: Integer;
begin
case WhichDTM of
1 : DTM:= DTMFromString('78DA63CC656260F8C00007401EC3DD2B9719F' +
'881342310FF0702C672A0E84B0634C0042619A13CC65220FF3F01' +
'352940FE3F026AE281FC8FF8D50000BE4B0D91');
2 : DTM:= DTMFromString('78DA63F4646660F0676480012620BE7FED1A0' +
'33F900689FE0702460FA09A10841A844A881A306D8B6A0E563501' +
'40354104D480DCE3895F0D002C1F09B3');
3 : DTM:= DTMFromString('78DA63E4676660506264800126205EB968210' +
'317900689FE07024671A01A4D841A844A881A30CD01546342400D' +
'1B508D320135A2403552F8D50000FD860720');
4 : DTM:= DTMFromString('78DA635CC8C8C0B087010E9880D8CDD9194C0' +
'36518FE0301E32A206B13031A6002938C501EE35A206B3F0135F3' +
'81AC9304D44C02B276E1570300A2D50BBD');
end;
if WhichDTM = 2 then
begin
GameTab(Tab_Equip);
If (FindDTM(DTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
GameTab(Tab_Inv);
Result := True;
end;
If WhichDTM = 4 then
begin
If (FindDTM(DTM, x, y, MBX1, MBY1, MBX2, MBY2)) then
Result := True;
end;
if (FindDTM(DTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
Result := True;
FreeDTM(DTM);
end;
function AreWeInBank: Boolean;//checks rug color in bank
var
TPA: TPointArray;
CTS: Integer;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.11, 0.95);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 10382405, MSX1, MSY1, MSX2, MSY2, 2);
if (Length(TPA) > 0) then
begin
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Writeln('Found Bank Rug');
Result := True
Exit;
end;
end;
Function Find_Tali: Boolean;
begin
if not(LoggedIn) then
Exit;
if (GameTab(Tab_Inv)) then
begin
Result :=(Load_DTM(3));
end;
end;
Procedure Click_Tali;
var a: TPoint;
begin
If (Find_Tali) then
begin
a := ItemCoords(1);
Mouse(a.x, a.y, 5, 5, True);
Wait(250 + Random(250));
end;
end;
function WalkToAltar: Boolean;
var
TPA: TPointArray;
ColorBoxes: T2DPointArray;
P: TPoint;
i : Integer;
begin
If not (LoggedIn) then Exit;
for i := 0 to 3 do
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(24.11, 2.54);
FindColorsSpiralTolerance(MMCX, MMCY, TPA, 8752264, MMX1, MMY1, MMCX, MMY2, 3)
//DebugTPA(TPA, '');
if (GetArrayLength(TPA) <10 ) then
begin
Writeln('Error, not enough color found, add tolerance');
TerminateScript;
end;
ColorToleranceSpeed(1);
SetColorSpeed2Modifiers(0.2, 0.2);
ColorBoxes := TPAToATPAEx(TPA, 10, 10);
//debugATPA(ColorBoxes, '')
SortATPAFromFirstPoint(ColorBoxes, Point(570, 115));
P := MiddleTPA(ColorBoxes[0]);
MouseFlag(P.x, P.y, 3, 3, 1);
If i = 3 then
//begin
Break;
Result := True;
ColorToleranceSpeed(1);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
end;
function Find_Banker: Boolean;
var
TPA: TPointArray;
CTS, i, z, j: Integer;
ATPA: T2DPointArray;
begin
If not(LoggedIn) then Exit;
If not(AreWeInBank) then
begin
Writeln('Relocating...');
SymbolAccuracy := 0.4;
if (FindSymbol(x, y, 'bank')) or (FindSymbol(x ,y, 'Dungeon')) then
begin
Mouse(x, y +10, 4, 4, True);
Flag;
Wait(250 + Random(400));
end;
end;
SetAngle(True);
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
FindColorsSpiralTolerance(MMCX, MMCY, TPA, 5850188, MSX1, MSY1, MSX2, MSY2, 14); //looks for color of bankers
if (Length(TPA) = 0) then
begin
Writeln('No color, exiting...');
ColorToleranceSpeed(CTS);
Exit;
end;
ColorToleranceSpeed(CTS);
ATPA :=TPAtoATPAEx(TPA, 5, 5);
SortATPAFrom(ATPA, Point(MSCX, MSCY));
z := High(ATPA);
for i:= 0 to z do
begin
If MiddleTPAEx(ATPA[i], x, y) then
MMouse(x, y, 2, 2);
If IsUpText('Banker') then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
Wait(200 +Random(200));
ChooseOption('Bank');
Writeln('Clicked Banker');
Flag;
repeat
Wait(1000 + Random(500));
inc(j);
until (BankScreen) or (PinScreen) or (j =4);
begin
SetColorToleranceSpeed(1);
result := true;
exit;
end;
end;
end;
end;
function Find_RCAltar: TPoint;
var
RCPoint: TPointArray;
RCBox: T2DPointArray;
CTS: integer;
begin
if not(LoggedIn) then exit;
CTS := GetColorToleranceSpeed;
SetColorSpeed2Modifiers(0.27, 4.79);
SetColorToleranceSpeed(2);
begin
FindColorsTolerance(RCPoint, 15251847, MSX1, MSY1, MSX2, MSY2, 6);
if (Length(RCPoint) = 0) then
begin
Writeln('Failed To Find Altar');
Exit;
end;
RCBox := TPAtoATPAEx(RCPoint, 5, 5);
SortATPAFromFirstPoint(RCBox, Point(MSCX, MSCY));
Result:= (RCBox[0] [0]);
SetColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
end;
Function Click_RCAltar: Boolean;
begin
if not(LoggedIn) then Exit;
if Find_Tali then
begin
Click_Tali;
Writeln('Found Talisman in inventory');
end;
RCPoint := Find_RCAltar;
MMouse(RCPoint.x, RCPoint.y, 5, 5);
Wait(250 + Random(250));
If IsUpTextMultiCustom(['ter','yster', 'une']) then
begin
GetMousePos(x, y);
case Random(10) of
0..9 : Mouse(x, y, 0, 0, True);
10 : begin
Mouse(x, y, 5, 5, False);
Wait(250 + Random(250));
ChooseOption('Enter');
end;
end;
end;
Flag;
Wait(RandomRange(3000, 5000));//Waits for game to load
Writeln('Entered Altar');
Result := True;
end;
Procedure Blindclick;
begin
If not (LoggedIn) then Exit;
If (WalktoAltar) then
begin
Writeln('Starting Blind Click');
Mouse(582, 130, 2, 3, True);
Flag;
Wait(RandomRange(1000, 2000));
If Click_RCAltar then
begin
Writeln('Blind Click Worked');
Exit;
end;
end;
end;
Function Find_Portal: TPoint;
var
Portal: TPointArray;
PortalBox: T2DPointArray;
begin
If not(LoggedIn) then Exit;
SetAngle(True);
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.11, 0.62);
FindColorsSpiralTolerance(MSCX, MSCY, Portal, 7580340, MSX1, MSY1, MSCX, MSY2, 15);
ColorToleranceSpeed(1);
SetColorSpeed2Modifiers(0.2, 0.2);
if (Length(Portal) = 0) then
begin
Writeln('Failed to find Portal, exiting');
ColorToleranceSpeed(1);
SetColorSpeed2Modifiers(0.2, 0.2);
If (LoggedIn) then logout;
Exit;
end;
PortalBox := (TPAtoATPA(Portal, 2));
SortATPAFromFirstPoint(PortalBox, Point(MSCX, MSCY));
Result := MiddleTPA(PortalBox[0]);
SetColorToleranceSpeed(1);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
Procedure Leave_Altar;
var time: integer;
begin
if(not(LoggedIn)) then Exit;
Wait(2000 + Random(500));
AntiBan;
MarkTime(time);
begin
MMouse(Find_Portal.x, Find_Portal.y +12, 2, 2);
if IsUpTextMultiCustom(['nter', 'ortal']) then
begin
GetMousePos(x, y);
Wait(50 + Random(50));
Mouse(x, y, 0, 0, True);
Flag;
Wait(RandomRange(10000, 11000))//loading time
end;
if (TimeFromMark(time) > 20000) then
TerminateScript;
end;
end;
function WalkToBank: Boolean;
var
TPA: TPointArray;
ColorBoxes: T2DPointArray;
P: TPoint;
i, t : Integer;
begin
If not (LoggedIn) then Exit;
If (RunEnergy(60 + random(10))) then SetRun(true);
Leave_Altar;
Wait(250 +Random(250));
for i := 0 to 4 do
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(24.11, 2.54);
FindColorsSpiralTolerance(MMCX, MMCY, TPA, 8752264, MMCX, MMY1, MMX2, MMY2, 8)
if (GetArrayLength(TPA) <10 ) then
begin
Writeln('Error, not enough color found, add tolerance');
TerminateScript;
end;
ColorToleranceSpeed(1);
SetColorSpeed2Modifiers(0.2, 0.2);
ColorBoxes := TPAToATPAEx(TPA, 10, 10);
SortATPAFromFirstPoint(ColorBoxes, Point(671, 64));
P := MiddleTPA(ColorBoxes[0]);
MouseFlag(P.x, P.y, 3, 3, 1);
Wait(500 + Random(250));
If i = 4 then
Break;
end;
Wait(RandomRange(1000, 3000));
SymbolAccuracy := 0.5;
MarkTime(t);
if FindSymbol(x, y, 'dungeon') or FindSymbol(x, y, 'bank') then
begin
Mouse(x, y, 5, 5, True);
Wait(250 + Random(250));
Flag;
Wait(RandomRange(2000, 3000));
Writeln('Successfull Walk to Bank');
If (TimeFromMark(t) > 30000) then
begin
if (AreWeInBank) then
Result := True;
Exit;
end;
end else
SetColorToleranceSpeed(1);
SetColorSpeed2Modifiers(0.2, 0.2);
//Writeln('Failed to Walk To Bank');
SymbolAccuracy := 0.8;
Exit;
end;
Function In_Altar: Boolean;
var
TPA: TPointArray;
ATPA: T2DPointArray;
CTS, i, z: Integer;
begin
If not(LoggedIn) then Exit;
CTS := GetColorToleranceSpeed;
SetColorToleranceSpeed(1);
FindColorsTolerance(TPA, 6645095, MSCX, MSY1, MSX2, MSY2, 13);
if (High(TPA) < 30) then
begin
SetColorToleranceSpeed(CTS);
Writeln('Failed finding altar');
SetColorToleranceSpeed(CTS);
Exit;
end;
ATPA :=TPAtoATPAEx(TPA, 40, 40);
SortATPAFrom(ATPA, Point(MSCX, MSCY));
z := High(ATPA);
for i:= 0 to z do
begin
If MiddleTPAEx(ATPA[i], x, y) then
MMouse(x, y, 10, 5);
If IsUptext('ltar') then
begin
Wait(500 + Random(250));
GetMousePos(x, y);
Mouse(x, y, 0, 0, True);
Wait(RandomRange(500, 750));
While IsMoving or FlagPresent do
AntiBan;
Wait(RandomRange(1000, 3000));
If (InvCount < 2) or (Load_DTM(1)) then
begin
Writeln('Crafted Air Runes');
Result := True;
end else
Writeln('No essences in inventory?');
Exit;
end;
end;
end;
Procedure Main_Deposit;
begin
if(not(Find_Banker)) then
begin
Writeln('Could not find Bank');
Exit;
end;
If PinScreen then
begin
InPin((Players[CurrentPlayer].Pin));
Wait(RandomRange(250, 500));
end else
begin
if BankScreen then
If Load_DTM(1) and Load_DTM(3) then
begin
Deposit(2, 28, True);
Wait(RandomRange(1000, 2000));
end;
If Load_DTM(1) then
DepositAll;
end
end;
Procedure Main_Withdraw;
begin
If not(LoggedIn) then exit;
If (BankScreen) then
begin
If Load_DTM(4) then
begin
Mouse(x, y, 5, 5, false);
Wait(100 + Random(250));
If WaitOptionMulti(['Withdraw-All', 'draw-All'], 300) then
begin
Wait(RandomRange(1500, 3000));
CloseBank;
If(InvFull) then
Writeln('Finished Banking');
end;
end;
end else
begin
Writeln('Could Not Withdraw');
TerminateScript;
end;
Report;
Inc(Loads)
Inc(Players[CurrentPlayer].Integers[1]);
end;
Procedure SetupPlayers;
begin
If(not(LoggedIn)) then LoginPlayer;
Wait(1000 + Random(1000));
MakeCompass('N');
SetAngle(True);
SetRun(True);
Loads:= 0
end;
Procedure SetupScript;
begin
{$IFDEF SRL_SMART}
Smart_Server := SmartWorld;
Smart_Members := Members;
Smart_Signed := SignedClient;
Smart_SuperDetail := Highdetail;
{$ENDIF}
SetupSRL;
DeclarePlayers;
activateclient;
SetupPlayers;
end;
begin
SetupScript;
repeat
BlindClick;
In_Altar;
If WalktoBank then
begin
Main_Deposit;
Main_Withdraw;
If (PlayersActive > 1) Then
Begin
If (Loads = Players[CurrentPlayer].Integers[0]) then
NextPlayer(false);
end;
end;
until (AllPlayersInactive);
end.
~RM