SCAR Code:
Program AlKaridSmetler;
{-----------------------------------------------------|
| Title : Al-Karid Auto Smelter |
| Author : RedDevil12312 |
| Description : Smelts Ores Into Bars DUH! |
| Version : 1.0 |
|-----------------------------------------------------|
| Credits : YoHoJo, For overall help with many |
| questions over scripting. |
| Narlces, I have learned a lot from |
| just reading his scripts. |
| 3Garret3, His tut on TPA Walking |
| helped me out alot. |
|-----------------------------------------------------|
| Instructions |
| ~~~~~~~~~~~~~~~ |
| [1] Fill Out Script Setup Section |
| [2] Fill Out Declare Players Section |
| [3] Start In Bank |
| [4] Read, To Know's Section |
| [5] Push Play, And Watch A Few Times |
| [6] Enjoy Result :) |
| |
| To Know's |
| ~~~~~~~~~~~~ |
| [1] Its Best To Start With A Empty Inventory |
| [2] Put Ores, In the First and Second Places |
| [3] Put Rings Of Forging In Bank Screen Veiw |
| [4] Its Easy To Add New Ores, So Just Learn |
| And Add To [Procedure BankInst] |
| [5] Report Any Bugs Or Suggestions Please |
|-----------------------------------------------------}
{.include SRL/SRL.scar}
{.include srl/srl/Skill/Smithing.scar}
{.include SRL/SRL/Misc///Reports.scar}
{.include SRL/SRL/Misc///Debug.scar}
// current job := Walk to furnace 2
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
// SCRIPT SETUP
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
{Default= 15,3,24}
Const MouseSpeedRate = 15; // Speed of Mouse Movements
Const SmeltingSpeed = 3; // Time In Between Inventory Checks, for Smelting- Seconds
Const AntiBanRate = 24; // Chances- 6=100% 12=50% 24=25% and so on
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
// DECLARE PLAYERS
// **************************
// To Add More Players, Just Add More Player Forms
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
procedure DeclarePlayers;
begin
HowManyPlayers:= 1; //how many players
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0; //Current player
With Players[0] Do
Begin
Name := ''; // username
Pass := ''; // password
Nick := ''; // 3-4 letters of your username, no caps or first letter
Strings[0] := 'Bronze'; // Ore To Smelt
Booleans[0] := False; // If Smelting Iron, Use Rings Of Forgings?
Integers[0] := 150; // Amount to Smelt
Integers[1] := 60; // Total time in minutes
Active := True; //Active or not. Until Multiplayer, leave true
End;
{ With Players[1] Do
Begin
Name := 'UserName'; // Username
Pass := 'PassWord'; // Password
Nick := 'ser'; // 3-4 letters of your username, no caps or first letter
Strings[0] := 'iron'; // Ore To Smelt
Booleans[0] := True; // If Smelting Iron, Use Rings Of Forgings?
Integers[0] := 1000; // Amount to Smelt
Integers[1] := 60; // Total time in minutes 0=No Time Limit
Active := False; // Active or not.
End; }
end;
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
// DONT TOUCH BELOW THIS
// *****************************
// Unless you know what you're doing
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
Var
FirstInvCheck: Boolean;
BarsMade, RingValue: Integer;
ShopWalk1,ShopWalk2,BankWalk1, BankWalk2:Integer; //DTM's
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
// Debug Signature
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
Procedure DevilSig;
Begin
ClearReport;
ChangeReportWidth(200);
AddToReport(' _ _ _ ');
AddToReport(' | \ made by _ | | ');
AddToReport(' | |\ \ |_|| | ');
AddToReport(' | || | _ _ __ __ _ | | ');
AddToReport(' | || | / _ \ \ \ / / | || | ');
AddToReport(' | |/ / | __/ \ \/ / | || | ');
AddToReport(' |_ _/ \___| \__/ |_||_| ');
End;
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
// ENDING SIGNATURE AND THANK YOU
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*`*`*~*~*~*~*~*~*~*
Procedure EndSig;
Begin
ClearReport;
AddToReport('Thank You Very Much For Using Reddevils');
AddToReport(' Auto Smelter. ');
AddToReport('****************** ');
AddToReport('Please Post Any Known Bugs, Theyll be ');
AddToReport(' FiXed as Soon as Possible ');
AddToReport('****************** ');
AddToReport('I Want This Script to be as Good as It ');
AddToReport('Can Get, So Please Post any Suggestions');
End;
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
// Progress Report
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
Procedure Report;
Begin
WriteLn(' Al-Karid Auto Smelter - ' + 'Made By RedDevil');
Writeln('*********************************************');
WriteLN(' Player = ' + Players[CurrentPlayer].Name)
Writeln(' Time Running = ' + TimeRunning);
Writeln(' Bars Made = ' + IntToStr(BarsMade));
WriteLn('**********************************************');
end;
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
// Sets Up Script
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
Procedure ScriptStart; //I have a lot left to do to this...
Begin
SetupSRL;
DevilSig;
WriteLn(' Script Setup is Good!' );
WriteLN(' Here we go, and good luck :)');
end;
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
// My Faster to Use Version of Wait(I)
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
Procedure EasyWait(Min, MaX: integer);
Begin
Wait(Min + Random(MaX-Min));
End;
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
// Find Randoms While Wait
// Got the idea from Narcles Scripts
// Thank you Narcles, please tell me, if you want more
// Creddit
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
Procedure RandomWait;
Begin
WaitFunc(@BankScreen, 40, 750);
EasyWait(600, 1200);
End;
//************************************************
// Withdrawing Directions
//************************************************
Procedure BankInst;
Begin
EasyWait(400, 700);
Case LowerCase(Players[CurrentPlayer].Strings[0]) Of
'bronze' : Begin
Withdraw(0, 0, 14);
EasyWait(1000, 1450);
WithDraw(0, 1, 14)
EasyWait(1000, 1450);
End;
'iron' : Begin
WithDraw(0,0,0)
EasyWait(1000, 1450);
End;
'steel' : Begin
WithDraw(0, 0, 9);
EasyWait(1000, 1450);
WithDraw(0, 1, 0);
EasyWait(1000, 1450);
End;
End;
End;
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
// Sets Up Rings Of Forgings
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
Procedure EquipRing;
Var RubyRingBTM, TpaLength, I, X, Y: Integer;
FoundRing: Boolean;
BmpTPA: Array of Tpoint;
Begin
If Not LoggedIn Then EXit;
If (InvCount > 0) Then DepositAll;
RubyRingBTM := SRL_GetBitmap(bmp_Ring_Ruby);
If FindBitmapsTolerance(RubyRingBTM, BmpTPA ,MSX1, MSY1, MSX2, MSY2, 4) Then
Begin
TpaLength := Length(BmpTPA);
For I := 0 To (TpaLength-1) Do
Begin
MMouse(BmpTPA[I].X, BmpTPA[I].Y, 4, 4);
If (GetUpTeXt = 'orging') Then
Begin
FoundRing := True;
EasyWait(400,750);
Mouse(X,Y, 5, 5, False);
EasyWait(1000, 1500);
WaitOption('1',5000);
WriteLn('Equiped Another Ring');
FreeBitmap(BMP_Ring_Ruby);
Break;
End;
End;
If (Not(FoundRing)) Then
Begin
WriteLn('Make Sure You Have the Right Rings in Bank');
WriteLn('Or Put Rings of Forgings in Bank Veiw' );
LogOut;
Report;
EndSig;
TerminateScript; // Stays Like this, Until I Come Up With A Fail Safe
End;
CloseBank;
InvMouse(1, 1);
If (Not(OpenBank('akb', True, True))) Then
Begin
WriteLn(' Equiping Ring = Fail')
Report;
LogOut;
NeXtPlayer(False);
End;
End Else
Begin
WriteLn('Please Make Sure You Have Rings Of Forging In Bank Veiw');
LogOut;
Report;
LogOut;
NeXtPlayer(False);
End;
End;
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
// Sets Up Players Inventory
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
Procedure PlayerSetup;
begin
If not LoggedIn then
LoginPlayer;
MakeCompass('e');
FirstInvCheck := InvCount > 0;
If (FirstInvCheck)Then
Writeln('Beginning Script') Else
Writeln('Banking On Start');
end;
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
// Declares All DTM's
// Alot of updates to come
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
Procedure DeclareAllPics;
begin
ShopWalk1 := DTMFromString('78DA63DCC3C4C0D0C0C8800C9EBFFDC22002A' +
'461A28CDB88500332A78A809A1D403535A86A16B6E4A0A80100B3A50' +
'F2A');
ShopWalk2 := DTMFromString('78DA634C676260C862644006DE05660C5C401' +
'A26CA9801549347404D0E504D26AA9A43ABF350D52401D5A4E357030' +
'07087091A');
BankWalk1 := DTMFromString('78DA63F46662608861644006CFDF7E61E002D' +
'2305146909A60026AEC816A6209A8F104AA8944555319E38AAAC61DA' +
'8261ABF1A00B0C10DFD');
BankWalk2 := DTMFromString('78DA63F4676260C8606440064736353370016' +
'99828A327504D26AA9A431B9A50D580CC494655737C6B1BAA9A504C3' +
'5187681CCC9C2AF0600E9450DB9');
End;
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
// Regular ole Antiban
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
procedure AntiBan;
begin
if not LoggedIn then EXit;
case Random(AntiBanRate) of
0: RandomWait;
1: begin
RandomMovement;
SetAngle(true);
end;
3: PickUpMouse;
4: HoverSkill('smithing', False);
5: EasyWait(10000, 30000);
6: BoredHuman;
end;
end;
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
// FiXes the Inventory to start the Script
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
Procedure PreBank;
var T: integer;
Begin
If (Not(Loggedin)) Then LoginPlayer;
If (FirstInvCheck = False) Then
Begin
REPEAT
INC(T);
OpenBank('akb', True, True);
Until Bankscreen Or (T=3);
end;
If Bankscreen Then
Begin
EasyWait(400, 700);
DepositAll;
EasyWait(450, 750);
WithDraw(1,1,0);
End Else
Begin
WriteLn('Could Not Find Bank!!!')
WriteLn('Script Closing');
NeXtPlayer(False);
End;
End;
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
// Banking Procedures
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
Procedure Banking;
var TP:TPoint;
Begin
If (Not(Loggedin)) Then EXit;
TP := BankIndeXToMSPoint(1);
FindNormalRandoms;
Writeln('Atempting to Bank');
If OpenBank('akb', True, True) then
Begin
WaitFunc(@Bankscreen, 25, 3000);
DepositAll;
IF LowerCase(Players[CurrentPlayer].Strings[0]) = 'iron' Then
Begin
If Players[CurrentPlayer].Booleans[0] Then
Begin
IF (RingValue = 5) Then
Begin
EquipRing;
RingValue := 0; //Resets Ring Value
End;
End;
End;
BankInst;
If (Not(InvCount = 28)) then
begin
If ((InvCount + GetAmount(TP.X,TP.y))< 28) Then //Reason for tpoint above
Begin
WriteLn('Ran Out Of Ore')
CloseBank;
EasyWait(500, 1000);
AntiBan;
LogOut;
NeXtPlayer(False);
End Else
Begin
EasyWait(1000, 1500);
BankInst;
WriteLn('Continued After Bank Check');
CloseBank;
RandomWait;
End;
End;
End Else
Begin
LogOut;
WriteLn('Can Not Find Bank!!!');
Report;
NeXtPlayer(False);
end;
End;
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
// Smelting Timer
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
Procedure SmeltCheck;
Var BAmount, EAmount, Color, L: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
Begin
BAmount := InvCount;
Color := GetColor(581, 227);
Repeat
FindColors(TPA, Color, MIX1, MIY1, MIX2, MIY2);
ATPA := TPAtoATPAEX(TPA, 20, 20);
L := Length(ATPA);
Wait(SmeltingSpeed+Random(500));
Until (L = 0);
EAmount := InvCount;
WriteLN('Came With/Ended With ' + IntToStr(BAmount) + '/' + IntToStr(EAmount));
End;
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
// Smelting Procedure
// Some Updates to Come
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
Procedure SmeltingTime;
var InvTotal:integer;
Begin
If (Not(Loggedin)) Then EXit;
If OpenFurnace then
Begin
RandomWait;
Smelt(Players[0].strings[3], IntToStr(35+Random(50)));
SmeltCheck;
InvTotal := InvCount;
BarsMade := (BarsMade + InvTotal);
RingValue := (RingValue + 1);
AntiBan;
FindNormalRandoms;
End Else
Begin
WriteLn('Could Not Find Furnace');
LogOut;
Report;
NeXtPlayer(False);
End;
End;
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
// Walk to Furnace
// *******************
// Many Differnt Parts
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
Function WAlktoFurnace1: Boolean;
var X,y:Integer;
Begin
If (Not(Loggedin)) Then EXit;
MakeCompass('e');
If DTMRotated(ShopWalk1,X,Y,MMX1,MMY1,MMX2,MMY2) Then
Begin
Result := True;
Mouse((X+4),(y+5),4,5, true);
FFlag(8);
End Else
Begin
If DTMRotated(ShopWalk2,X,Y, MMX1,MMY1,MMX2,MMY2) Then
Begin
Result := True;
Mouse((X+2),(y+7),3,4,True);
FFlag(5);
End Else
Begin
WriteLn('Shop DTMs dont Work!');
Result := False;
End;
End;
End;
Procedure WalkToFurnace2;
Var X, Y, H, I: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
Begin
If (Not(LoggedIn)) Then EXit;
MakeCompass('e');
FindColorsSpiralTolerance(MMCX+20, MMCY+15, TPA, 9025477, MMCX,MMCY, MMX2, MMY2, 15);
If (Length(TPA)=0) Then
FindColorsSpiralTolerance(MMCX+20, MMCY+15, TPA, 2830858, MMCX,MMCY, MMX2, MMY2, 30);
ATPA := SplitTPAEX(TPA, 5, 5);
SortATPASize(ATPA, True);
H := High(ATPA)
For I := 0 to H Do
Begin
MiddleTPAEX(ATPA[i], X, Y);
If RS_OnMinimap(X,Y) Then
Begin
WriteLn('Used TPA Walking, to Furnace');
If (MFF(X, Y, 4, 1)) Then EXit;
End;
End;
WriteLn('Walking To Furnace := Fail')
Report;
NeXtPlayer(False);
End;
Procedure FindFurnaceSymbol;
Var X2, Y2: Integer;
Begin
If FindSymbol(X2,Y2,'furnace') Then
Begin
Mouse(X2,(Y2+6),3,3,True);
If FlagPresent Then
Begin
FFlag(0);
WriteLn('Succesfully Made Trip to Furnace');
EasyWait(0, 2000);
EXit;
End Else
Begin
MFF(X2, Y2, 1, 1)
WriteLn('Finally Found Symbol');
End;
End Else
Begin
WriteLn('Could Not Find Furnace Symbol');
WriteLN('Got Lost Walk to Furnace');
LogOut;
Report;
NeXtPlayer(False);
End;
End;
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
// WAlk to Bank
// ****************
// Many Different Parts
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
Function WAlktoBank1: Boolean;
var X, y :Integer;
Begin
If (Not(LoggedIn)) Then EXit;
MakeCompass('e');
If DTMRotated(BankWalk1,X,y,MMX1,MMY1,MMX2,MMY2) Then
Begin
Mouse((X+4),(y+5),4,5, true);
FFlag(8);
Result := True;
FreeDTM(BankWalk1);
End Else
Begin
If DTMRotated(BankWalk2,X,Y, MMX1,MMY1,MMX2,MMY2) Then
Begin
Result := True;
Mouse((X+2),(y+7),3,4,True);
FFlag(5);
FreeDTM(BankWalk2);
End Else
Begin
Result := False;
WriteLn('Bank DTMs dont Work!');
End;
End;
End;
Procedure WalkToBank2;
Begin
End;
Procedure FindBankSymbol;
Var X2, Y2 : Integer;
Begin
If FindSymbol(X2,Y2,'bank') Then
Begin
Mouse(X2,(Y2+6),3,3,True);
If FlagPresent Then
Begin
FFlag(0);
WriteLn('Succesfully Made Trip to Bank');
Wait(0+random(2000));
EXit;
End Else
Begin
MFF(X2, Y2, 1, 1)
WriteLn('Finally Found Symbol');
End;
End Else
Begin
WriteLn('Could Not Find Bank Symbol');
WriteLN('Got Lost Walking to Bank');
LogOut;
Report;
NeXtPlayer(False);
End;
End;
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
// //***********Main Operation************\\
//~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
Begin
MouseSpeed := MouseSpeedRate;
ScriptStart;
DeclarePlayers;
DeclareAllPics;
Repeat
PlayerSetup;
PreBank;
Repeat
Banking;
If (Not(WalkToFurnace1)) Then WalkToFurnace2;
FindFurnaceSymbol;
SmeltingTime;
IF (Not(WalkToBank1)) Then WalkToBank2;
FindBankSymbol;
Until (BarsMAde >= Players[CurrentPlayer].Integers[0])
or (GetTimeRunning >= (Players[CurrentPlayer].Integers[1] * 60000))
or (Not(LoggedIn));
NeXtplayer(False);
BarsMade := 0;
RingValue := 0;
Until AllPlayersInactive;
EndSig;
End.