SRL Archive - OSR Script Requests

[request] an iron arrow tip / iron throwing knife Varrock west smither


hakishakataki

2014-04-23 20:15:56

just simply that.
-banks
-smiths some tips
-has a count on how many i want smithed (i like to split iron arrow tips and knives 50/50)

Im learning how to script and if no one can do it ill try myself! :)

Flight

2014-04-23 20:58:13

It's actually a good suggestion for a AIO Varrock-smither script. It would be quite simple I imagine. I might give that a shot after I've released AeroLib, that should provide some good test-runs for the library…

Sk1nyNerd

2014-04-23 21:03:47

From: Flight
It's actually a good suggestion for a AIO Varrock-smither script. It would be quite simple I imagine. I might give that a shot after I've released AeroLib, that should provide some good test-runs for the library…


#Frement already has then done, he can prob lend a hand

Flight

2014-04-23 21:58:04

From: Sk1nyNerd
#Frement already has then done, he can prob lend a hand


You might want to provide a link here to his s ohakishakataki may use it. As for mine it will not be using SRL-OSR or the reflection include.

rj

2014-04-23 22:19:25

I would do this, but I don't have many bars

Frement

2014-04-24 02:04:05

Have fun :)

Also, @Sk1nyNerd; you're doing the mentioning wrong :P

EDUT: It's: # @ Name ;

program VarrockWestAIOSmither;
{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}
{$I SRL-OSR\SRL\misc\SmartGraphics.simba}
{$I SRL-OSR/SRL/Reflection/Reflection.simba}

type
TItem = record
Name: String;
Bars: Integer;
Experience: Extended;
end;

TItemArray = Array of TItem;

T2DItemArray = Array of TItemArray;

var
BankBooth, Anvil: TPoint;
NULL_ITEM: TItem;
Items: T2DItemArray;
Types: TStringArray;
InventoryCount, LevelsGained, StartExp: Integer;

const
TYPE_BRONZE = 0;
TYPE_IRON = 1;
TYPE_STEEL = 2;
TYPE_MITHRIL = 3;
TYPE_ADAMANT = 4;
TYPE_RUNE = 5;

BRONZE_DAGGER = 0;
BRONZE_AXE = 1;
BRONZE_CHAINBODY = 2;
BRONZE_MEDIUMHELM = 3;
BRONZE_DARTTIPS = 4;
BRONZE_BOLTS = 5;
BRONZE_SWORD = 6;
BRONZE_MACE = 7;
BRONZE_PLATELEGS = 8;
BRONZE_FULLHELM = 9;
BRONZE_ARROWTIPS = 10;
BRONZE_LIMBS = 11;
BRONZE_SCIMITAR = 12;
BRONZE_WARHAMMER = 13;
BRONZE_PLATESKIRT = 14;
BRONZE_SQUARESHIELD = 15;
BRONZE_THROWINGKNIVES = 16;
BRONZE_LONGSWORD = 18;
BRONZE_BATTLEAXE = 19;
BRONZE_PLATEBODY = 20;
BRONZE_KITESHIELD = 21;
BRONZE_WIRE = 22;
BRONZE_2HANDSWORD = 24;
BRONZE_NAILS = 26;

IRON_DAGGER = 0;
IRON_AXE = 1;
IRON_CHAINBODY = 2;
IRON_MEDIUMHELM = 3;
IRON_DARTTIPS = 4;
IRON_BOLTS = 5;
IRON_SWORD = 6;
IRON_MACE = 7;
IRON_PLATELEGS = 8;
IRON_FULLHELM = 9;
IRON_ARROWTIPS = 10;
IRON_LIMBS = 11;
IRON_SCIMITAR = 12;
IRON_WARHAMMER = 13;
IRON_PLATESKIRT = 14;
IRON_SQUARESHIELD = 15;
IRON_THROWINGKNIVES = 16;
IRON_LONGSWORD = 18;
IRON_BATTLEAXE = 19;
IRON_PLATEBODY = 20;
IRON_KITESHIELD = 21;
IRON_IRONSPIT = 22;
IRON_2HANDSWORD = 24;
IRON_NAILS = 26;
IRON_OILLANTERNFRAME = 27;

STEEL_DAGGER = 0;
STEEL_AXE = 1;
STEEL_CHAINBODY = 2;
STEEL_MEDIUMHELM = 3;
STEEL_DARTTIPS = 4;
STEEL_BOLTS = 5;
STEEL_SWORD = 6;
STEEL_MACE = 7;
STEEL_PLATELEGS = 8;
STEEL_FULLHELM = 9;
STEEL_ARROWTIPS = 10;
STEEL_LIMBS = 11;
STEEL_SCIMITAR = 12;
STEEL_WARHAMMER = 13;
STEEL_PLATESKIRT = 14;
STEEL_SQUARESHIELD = 15;
STEEL_THROWINGKNIVES = 16;
STEEL_LONGSWORD = 18;
STEEL_BATTLEAXE = 19;
STEEL_PLATEBODY = 20;
STEEL_KITESHIELD = 21;
STEEL_STUDS = 22;
STEEL_2HANDSWORD = 24;
STEEL_NAILS = 26;
STEEL_BULLSEYELANTERN = 27;

BASEX = 40;
BASEY = 60;
MODX = 80;
MODY = 55;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';//Username
Players[0].Pass := '';//Password
Players[0].Nick := ''; //Nickname
Players[0].Pin := ''; //Pin
Players[0].Integers[0] := TYPE_STEEL; //Type of bar to use: TYPE_BRONZE, TYPE_IRON, TYPE_STEEL, TYPE_MITHRIL, TYPE_ADAMANT, TYPE_RUNE
Players[0].Integers[1] := STEEL_ARROWTIPS; //Item to smith
Players[0].Integers[2] := 4; //Bar column
Players[0].Integers[3] := 0; //Bar row
Players[0].LampSkill := SKILL_SMITHING;
Players[0].Active := True;
end;

procedure F_SetRun(Run: Boolean);
var
X, Y: Integer;
begin
if (not LoggedIn) then
Exit;

if (FindColorTolerance(X, Y, 6806252, 570, 130, 589, 146, 30)) then begin
if (Run) then
Exit
else begin
MMouse(X, Y, 1, 1);
ClickMouse2(Mouse_Left);
end;
end else begin
X := 580 + Random(3);
Y := 137 + Random(3);
if (Run) then begin
MMouse(X, Y, 1, 1);
ClickMouse2(Mouse_Left);
end else
Exit;
end;
end;

function InventoryModified: Boolean;
begin
Result := False;
if (InvCount <> InventoryCount) then
Result := True;

InventoryCount := InvCount;
end;

procedure SetupPlayer;
begin
SetAngle(SRL_ANGLE_HIGH);
MakeCompass('N');
StartExp := R_GetSkillExp(SKILL_SMITHING);
F_SetRun(True);
InventoryCount := InvCount;
end;

function CreateItem(Name: String; Bars: Integer; Experience: Extended): TItem;
begin
Result.Name := Name;
Result.Bars := Bars;
Result.Experience := Experience;
end;

procedure SetupScript;
var
BronzeArray, IronArray, SteelArray: TItemArray;
begin
BankBooth := Point(3186, 3436);
Anvil := Point(3188, 3426);
Types := [
'Bronze',
'Iron',
'Steel',
'Mithril',
'Adamant',
'Rune'
];
NULL_ITEM := CreateItem('', 0, 0.0);
BronzeArray := [
CreateItem('Dagger', 1, 12.5),
CreateItem('Axe', 1, 12.5),
CreateItem('Chainbody', 3, 37.5),
CreateItem('Medium Helmet', 1, 12.5),
CreateItem('Dart Tips', 1, 12.5),
CreateItem('Bolts', 1, 12.5),
CreateItem('Sword', 1, 12.5),
CreateItem('Mace', 1, 12.5),
CreateItem('Platelegs', 3, 37.5),
CreateItem('Full Helmet', 2, 25.0),
CreateItem('Arrowtips', 1, 12.5),
CreateItem('Limbs', 1, 12.5),
CreateItem('Scimitar', 2, 25.0),
CreateItem('Warhammer', 3, 37.5),
CreateItem('Plateskirt', 3, 37.5),
CreateItem('Square Shield', 2, 25.0),
CreateItem('Throwing Knives', 1, 12.5),
NULL_ITEM,
CreateItem('Longsword', 2, 25.0),
CreateItem('Battleaxe', 3, 37.5),
CreateItem('Platebody', 5, 62.5),
CreateItem('Kiteshield', 3, 37.5),
CreateItem('Wire', 1, 12.5),
NULL_ITEM,
CreateItem('Two-handed Sword', 3, 37.5),
NULL_ITEM,
CreateItem('Nails', 1, 12.5)
];
IronArray := [
CreateItem('Dagger', 1, 25.0),
CreateItem('Axe', 1, 25.0),
CreateItem('Chainbody', 3, 75.0),
CreateItem('Medium Helmet', 1, 25.0),
CreateItem('Dart Tips', 1, 25.0),
CreateItem('Bolts', 1, 25.0),
CreateItem('Sword', 1, 25.0),
CreateItem('Mace', 1, 25.0),
CreateItem('Platelegs', 3, 75.0),
CreateItem('Full Helmet', 2, 50.0),
CreateItem('Arrowtips', 1, 25.0),
CreateItem('Limbs', 1, 25.0),
CreateItem('Scimitar', 2, 50.0),
CreateItem('Warhammer', 3, 75.0),
CreateItem('Plateskirt', 3, 75.0),
CreateItem('Square Shield', 2, 50.0),
CreateItem('Throwing Knives', 1, 25.0),
NULL_ITEM,
CreateItem('Longsword', 2, 50.0),
CreateItem('Battleaxe', 3, 75.0),
CreateItem('Platebody', 5, 125.0),
CreateItem('Kiteshield', 3, 75.0),
CreateItem('Spit', 1, 25.0),
NULL_ITEM,
CreateItem('Two-handed Sword', 3, 75.0),
NULL_ITEM,
CreateItem('Nails', 1, 25.0),
CreateItem('Oil Lantern Frame', 1, 25.0)
];
SteelArray := [
CreateItem('Dagger', 1, 37.5),
CreateItem('Axe', 1, 37.5),
CreateItem('Chainbody', 3, 112.5),
CreateItem('Medium Helmet', 1, 37.5),
CreateItem('Dart Tips', 1, 37.5),
CreateItem('Bolts', 1, 37.5),
CreateItem('Sword', 1, 37.5),
CreateItem('Mace', 1, 37.5),
CreateItem('Platelegs', 3, 112.5),
CreateItem('Full Helmet', 2, 112.5),
CreateItem('Arrowtips', 1, 37.5),
CreateItem('Limbs', 1, 37.5),
CreateItem('Scimitar', 2, 112.5),
CreateItem('Warhammer', 3, 112.5),
CreateItem('Plateskirt', 3, 112.5),
CreateItem('Square Shield', 2, 112.5),
CreateItem('Throwing Knives', 1, 37.5),
NULL_ITEM,
CreateItem('Longsword', 2, 112.5),
CreateItem('Battleaxe', 3, 112.5),
CreateItem('Platebody', 5, 187.5),
CreateItem('Kiteshield', 3, 112.5),
CreateItem('Stud', 1, 37.5),
NULL_ITEM,
CreateItem('Two-handed Sword', 3, 112.5),
NULL_ITEM,
CreateItem('Nails', 1, 37.5),
CreateItem('Bullseye lantern', 1, 37.5)
];
Items := [
BronzeArray,
IronArray,
SteelArray
];
end;

function ItemToCoords(Item: Integer): TPoint;
var
OffsetX, OffsetY: Integer;
begin
OffsetX := ((Item mod 6) * MODX);
OffsetY := (((Item div 6) mod 5) * MODY);

Result := Point(BASEX + OffsetX, BASEY + OffsetY);
end;

function ItemToBox(Item: Integer): TBox;
var
C: TPoint;
begin
C := ItemToCoords(Item);

Result := IntToBox(C.X - 10, C.Y - 10, C.X + 15, C.Y + 15);
end;

function DoneSmithing: Boolean;
begin
Result := ClickContinueEx(False, False);
end;

procedure WalkToBank;
begin
F_SetRun(True);
R_WalkToTileMM(BankBooth);
Wait(500 + Random(100));
Flag;
Wait(500 + Random(100));
end;

procedure WalkToAnvil;
begin
F_SetRun(True);
R_WalkToTileMM(Anvil);
Wait(500 + Random(100));
Flag;
Wait(1500 + Random(100));
end;

function F_OpenBank: Boolean;
var
Booth: TPoint;
begin
if (not LoggedIn) or (BankScreen) then
Exit;

Booth := R_TileToMS(BankBooth);
MMouse(Booth.X, Booth.Y, 2, 2);
Sleep(100 + Random(100));
if (R_IsUpText('Bank Ba')) then begin
ClickMouse2(Mouse_Left);
end else begin
ClickMouse2(Mouse_Right);
Sleep(250 + Random(250));
R_ChooseOption('Bank Ba');
end;
Sleep(500 + Random(250));

if (PinScreen) then
InPin(Players[CurrentPlayer].Pin);

Result := WaitFunc(@BankScreen, 250, 2500);
Sleep(1000 + Random(250));
end;

procedure F_CloseBank;
begin
if (not LoggedIn) or (not BankScreen) then
Exit;

MMouse(486, 42, 2, 2);
ClickMouse2(Mouse_Left);
Sleep(250 + Random(250));
end;

function F_WithdrawEx(Col, Row, Amount: Integer; Uptexts: TStringArray): Boolean;
var
BBox: TBox;
X, Y: Integer;
begin
Result := False;
FixBank;
if not bankscreen then
exit;

BBox := BankIndexToMSBox(BankPointToBankIndex(Point(Col, Row)));
BBox := IntToBox(BBox.X1 - 2, BBox.Y1 + 10, BBox.X2 - 2, BBox.Y2 + 3);
GetMousePos(X, Y);
if (not PointInBox(Point(X, Y), BBox)) then
MouseBox(BBox.X1 - 2, BBox.Y1 + 10, BBox.X2 - 2, BBox.Y2 + 3, mouse_move);

if (Length(Uptexts) > 0) then
if (not R_WaitUpTextMulti(Uptexts, 500)) then
Exit;

if (Amount = 1) then
ClickMouse2(mouse_left)
else
ClickMouse2(mouse_right);
if (Amount = 1) then
begin
Result := True;
Wait(RandomRange(250, 550));
Exit;
end;

if (Amount = -1) then
begin
if (WaitOptionMultiEx(['Withdraw-All-but', 'l-b'], 'All', Nothing, 300)) then
Result := R_ChooseOption('Withdraw-All-but');
end else
if (Amount = 0) then
begin
if (WaitOptionMultiEx(['Withdraw-All', 'w-A'], 'All', Nothing, 300)) then
Result := R_ChooseOption('Withdraw-All');
end else
if (WaitOptionMultiEx(['Withdraw-' + IntToStr(Amount) + ' ', 'w-' + IntToStr(Amount) + ' '], 'All', Nothing, 300)) then
Result := R_ChooseOption('Withdraw-' + IntToStr(Amount) + ' ');

if (not (Result)) and (Amount > 0) then
begin
if (not OptionsExist(['Withdraw', 'ithdraw', 'draw'], False)) then
MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, mouse_right);

if WaitOptionMulti(['Withdraw-X', 'w-X', 'X'], 500) then
begin
X := GetSystemTime + 10000;
while (X >= GetSystemTime) and (not (InRange(CountColor(0, 211, 394, 308, 411), 200, 300))) do
Wait(50);
Wait(RandomRange(75, 400));
TypeSend(IntToStr(Amount));
Result := True;
end;
end;
end;

procedure DepositItems;
begin
Deposit(2, 28, True);
end;

procedure WithdrawItems;
begin
if (not F_WithdrawEx(Players[CurrentPlayer].Integers[2], Players[CurrentPlayer].Integers[3], 0, [Types[Players[CurrentPlayer].Integers[0]] + ' bar'])) then begin
Writeln('Out of bars.');
TerminateScript;
end;
end;

procedure AntiBan;
begin
if (not LoggedIn) then
Exit;

case Randomrange(1, 30) of
1, 5, 12, 15, 19: MMouse(Random(MSX2), Random(MSY2), 3, 3);
20, 25: begin
HoverSkill('Smithing', False);
while (R_IsAnimating) do
Sleep(250);
end;
end;
end;

procedure ProgressReport;
var
ExpGained, ExpGainedPerHour, ItemsPerHour: Integer;
begin
ExpGained := R_GetSkillExp(SKILL_SMITHING) - StartExp;
ExpGainedPerHour := Round((ExpGained * 3600) / (GetTimeRunning / 1000));
ItemsPerHour := Round(((ExpGained / Items[Players[CurrentPlayer].Integers[0]][Players[CurrentPlayer].Integers[1]].Experience) * 3600) / (GetTimeRunning / 1000));
Writeln('');
Writeln('Varrock West Smither - By Frement');
Writeln(' - Time Running: ' + TimeRunning);
Writeln(' - ' + Items[Players[CurrentPlayer].Integers[0]][Players[CurrentPlayer].Integers[1]].Name + ' smithed: ' + ToStr(Round(ExpGained / Items[Players[CurrentPlayer].Integers[0]][Players[CurrentPlayer].Integers[1]].Experience)) + ' (' + ToStr(ItemsPerHour) + '/H)');
Writeln(' - Experience Gained: ' + ToStr(ExpGained) + ' (' + ToStr(ExpGainedPerHour) + '/H)');
Writeln(' - Levels Gained: ' + ToStr(LevelsGained) + ' (' + ToStr(R_GetSkillLevel(SKILL_SMITHING)) + ')');
end;

procedure Smith;
var
C, A: TPoint;
Timer, I: Integer;
IB: TBox;
begin
GameTab(tab_Inv);
C := ItemToCoords(Players[CurrentPlayer].Integers[1]);
for I := 28 downto 2 do begin
IB := InvBox(I);
if (CountColor(65536, IB.X1, IB.Y1, IB.X2, IB.Y2) > 0) then begin
MouseBox(IB.X1, IB.Y1, IB.X2, IB.Y2, Mouse_Left);
Break;
end;
end;
Sleep(100 + Random(100));
A := R_TileToMS(Anvil);
MMouse(A.X, A.Y, 2, 2);
Sleep(250 + Random(100));
if (R_IsUpText('Anvil')) then
ClickMouse2(Mouse_Left)
else begin
ClickMouse2(Mouse_Right);
Sleep(100 + Random(100));
R_ChooseOption('Anvil');
Sleep(100 + Random(100));
end;
Sleep(100 + Random(100));
Flag;
Sleep(750 + Random(100));
MMouse(C.X, C.Y, 2, 2);
Sleep(100 + Random(100));
ClickMouse2(Mouse_Right);
Sleep(100 + Random(100));
R_ChooseOption('Smith X');
Sleep(500 + Random(250));
TypeSend('55');
Sleep(1000);
MarkTime(Timer);
while (not DoneSmithing) do begin
if (InventoryModified) then
MarkTime(Timer);

if (TimeFromMark(Timer) > 15000) then begin
Writeln('Something went wrong, trying to recover.');
Break;
end;

if (R_FindNormalRandoms) then begin
Smith;
Break;
end;

if (LevelUp) then begin
Inc(LevelsGained);
Smith;
Break;
end;

AntiBan;

ProgressReport;
end;
end;

begin
DeclarePlayers;
SetupSRL;
SetupReflection;
SetupScript;
SMART_ClearCanvas;
SetupPlayer;
repeat
F_OpenBank;
WithdrawItems;
F_CloseBank;
WalkToAnvil;
Smith;
WalkToBank;
Sleep(1000 + Random(250));
F_OpenBank;
DepositItems;
ProgressReport;
until(False);
end.

hakishakataki

2014-05-03 15:28:18

From: Frement
Have fun :)

Also, @Sk1nyNerd; you're doing the mentioning wrong :P

EDUT: It's: # @ Name ;

program VarrockWestAIOSmither;
{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}
{$I SRL-OSR\SRL\misc\SmartGraphics.simba}
{$I SRL-OSR/SRL/Reflection/Reflection.simba}

type
TItem = record
Name: String;
Bars: Integer;
Experience: Extended;
end;

TItemArray = Array of TItem;

T2DItemArray = Array of TItemArray;

var
BankBooth, Anvil: TPoint;
NULL_ITEM: TItem;
Items: T2DItemArray;
Types: TStringArray;
InventoryCount, LevelsGained, StartExp: Integer;

const
TYPE_BRONZE = 0;
TYPE_IRON = 1;
TYPE_STEEL = 2;
TYPE_MITHRIL = 3;
TYPE_ADAMANT = 4;
TYPE_RUNE = 5;

BRONZE_DAGGER = 0;
BRONZE_AXE = 1;
BRONZE_CHAINBODY = 2;
BRONZE_MEDIUMHELM = 3;
BRONZE_DARTTIPS = 4;
BRONZE_BOLTS = 5;
BRONZE_SWORD = 6;
BRONZE_MACE = 7;
BRONZE_PLATELEGS = 8;
BRONZE_FULLHELM = 9;
BRONZE_ARROWTIPS = 10;
BRONZE_LIMBS = 11;
BRONZE_SCIMITAR = 12;
BRONZE_WARHAMMER = 13;
BRONZE_PLATESKIRT = 14;
BRONZE_SQUARESHIELD = 15;
BRONZE_THROWINGKNIVES = 16;
BRONZE_LONGSWORD = 18;
BRONZE_BATTLEAXE = 19;
BRONZE_PLATEBODY = 20;
BRONZE_KITESHIELD = 21;
BRONZE_WIRE = 22;
BRONZE_2HANDSWORD = 24;
BRONZE_NAILS = 26;

IRON_DAGGER = 0;
IRON_AXE = 1;
IRON_CHAINBODY = 2;
IRON_MEDIUMHELM = 3;
IRON_DARTTIPS = 4;
IRON_BOLTS = 5;
IRON_SWORD = 6;
IRON_MACE = 7;
IRON_PLATELEGS = 8;
IRON_FULLHELM = 9;
IRON_ARROWTIPS = 10;
IRON_LIMBS = 11;
IRON_SCIMITAR = 12;
IRON_WARHAMMER = 13;
IRON_PLATESKIRT = 14;
IRON_SQUARESHIELD = 15;
IRON_THROWINGKNIVES = 16;
IRON_LONGSWORD = 18;
IRON_BATTLEAXE = 19;
IRON_PLATEBODY = 20;
IRON_KITESHIELD = 21;
IRON_IRONSPIT = 22;
IRON_2HANDSWORD = 24;
IRON_NAILS = 26;
IRON_OILLANTERNFRAME = 27;

STEEL_DAGGER = 0;
STEEL_AXE = 1;
STEEL_CHAINBODY = 2;
STEEL_MEDIUMHELM = 3;
STEEL_DARTTIPS = 4;
STEEL_BOLTS = 5;
STEEL_SWORD = 6;
STEEL_MACE = 7;
STEEL_PLATELEGS = 8;
STEEL_FULLHELM = 9;
STEEL_ARROWTIPS = 10;
STEEL_LIMBS = 11;
STEEL_SCIMITAR = 12;
STEEL_WARHAMMER = 13;
STEEL_PLATESKIRT = 14;
STEEL_SQUARESHIELD = 15;
STEEL_THROWINGKNIVES = 16;
STEEL_LONGSWORD = 18;
STEEL_BATTLEAXE = 19;
STEEL_PLATEBODY = 20;
STEEL_KITESHIELD = 21;
STEEL_STUDS = 22;
STEEL_2HANDSWORD = 24;
STEEL_NAILS = 26;
STEEL_BULLSEYELANTERN = 27;

BASEX = 40;
BASEY = 60;
MODX = 80;
MODY = 55;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';//Username
Players[0].Pass := '';//Password
Players[0].Nick := ''; //Nickname
Players[0].Pin := ''; //Pin
Players[0].Integers[0] := TYPE_STEEL; //Type of bar to use: TYPE_BRONZE, TYPE_IRON, TYPE_STEEL, TYPE_MITHRIL, TYPE_ADAMANT, TYPE_RUNE
Players[0].Integers[1] := STEEL_ARROWTIPS; //Item to smith
Players[0].Integers[2] := 4; //Bar column
Players[0].Integers[3] := 0; //Bar row
Players[0].LampSkill := SKILL_SMITHING;
Players[0].Active := True;
end;

procedure F_SetRun(Run: Boolean);
var
X, Y: Integer;
begin
if (not LoggedIn) then
Exit;

if (FindColorTolerance(X, Y, 6806252, 570, 130, 589, 146, 30)) then begin
if (Run) then
Exit
else begin
MMouse(X, Y, 1, 1);
ClickMouse2(Mouse_Left);
end;
end else begin
X := 580 + Random(3);
Y := 137 + Random(3);
if (Run) then begin
MMouse(X, Y, 1, 1);
ClickMouse2(Mouse_Left);
end else
Exit;
end;
end;

function InventoryModified: Boolean;
begin
Result := False;
if (InvCount <> InventoryCount) then
Result := True;

InventoryCount := InvCount;
end;

procedure SetupPlayer;
begin
SetAngle(SRL_ANGLE_HIGH);
MakeCompass('N');
StartExp := R_GetSkillExp(SKILL_SMITHING);
F_SetRun(True);
InventoryCount := InvCount;
end;

function CreateItem(Name: String; Bars: Integer; Experience: Extended): TItem;
begin
Result.Name := Name;
Result.Bars := Bars;
Result.Experience := Experience;
end;

procedure SetupScript;
var
BronzeArray, IronArray, SteelArray: TItemArray;
begin
BankBooth := Point(3186, 3436);
Anvil := Point(3188, 3426);
Types := [
'Bronze',
'Iron',
'Steel',
'Mithril',
'Adamant',
'Rune'
];
NULL_ITEM := CreateItem('', 0, 0.0);
BronzeArray := [
CreateItem('Dagger', 1, 12.5),
CreateItem('Axe', 1, 12.5),
CreateItem('Chainbody', 3, 37.5),
CreateItem('Medium Helmet', 1, 12.5),
CreateItem('Dart Tips', 1, 12.5),
CreateItem('Bolts', 1, 12.5),
CreateItem('Sword', 1, 12.5),
CreateItem('Mace', 1, 12.5),
CreateItem('Platelegs', 3, 37.5),
CreateItem('Full Helmet', 2, 25.0),
CreateItem('Arrowtips', 1, 12.5),
CreateItem('Limbs', 1, 12.5),
CreateItem('Scimitar', 2, 25.0),
CreateItem('Warhammer', 3, 37.5),
CreateItem('Plateskirt', 3, 37.5),
CreateItem('Square Shield', 2, 25.0),
CreateItem('Throwing Knives', 1, 12.5),
NULL_ITEM,
CreateItem('Longsword', 2, 25.0),
CreateItem('Battleaxe', 3, 37.5),
CreateItem('Platebody', 5, 62.5),
CreateItem('Kiteshield', 3, 37.5),
CreateItem('Wire', 1, 12.5),
NULL_ITEM,
CreateItem('Two-handed Sword', 3, 37.5),
NULL_ITEM,
CreateItem('Nails', 1, 12.5)
];
IronArray := [
CreateItem('Dagger', 1, 25.0),
CreateItem('Axe', 1, 25.0),
CreateItem('Chainbody', 3, 75.0),
CreateItem('Medium Helmet', 1, 25.0),
CreateItem('Dart Tips', 1, 25.0),
CreateItem('Bolts', 1, 25.0),
CreateItem('Sword', 1, 25.0),
CreateItem('Mace', 1, 25.0),
CreateItem('Platelegs', 3, 75.0),
CreateItem('Full Helmet', 2, 50.0),
CreateItem('Arrowtips', 1, 25.0),
CreateItem('Limbs', 1, 25.0),
CreateItem('Scimitar', 2, 50.0),
CreateItem('Warhammer', 3, 75.0),
CreateItem('Plateskirt', 3, 75.0),
CreateItem('Square Shield', 2, 50.0),
CreateItem('Throwing Knives', 1, 25.0),
NULL_ITEM,
CreateItem('Longsword', 2, 50.0),
CreateItem('Battleaxe', 3, 75.0),
CreateItem('Platebody', 5, 125.0),
CreateItem('Kiteshield', 3, 75.0),
CreateItem('Spit', 1, 25.0),
NULL_ITEM,
CreateItem('Two-handed Sword', 3, 75.0),
NULL_ITEM,
CreateItem('Nails', 1, 25.0),
CreateItem('Oil Lantern Frame', 1, 25.0)
];
SteelArray := [
CreateItem('Dagger', 1, 37.5),
CreateItem('Axe', 1, 37.5),
CreateItem('Chainbody', 3, 112.5),
CreateItem('Medium Helmet', 1, 37.5),
CreateItem('Dart Tips', 1, 37.5),
CreateItem('Bolts', 1, 37.5),
CreateItem('Sword', 1, 37.5),
CreateItem('Mace', 1, 37.5),
CreateItem('Platelegs', 3, 112.5),
CreateItem('Full Helmet', 2, 112.5),
CreateItem('Arrowtips', 1, 37.5),
CreateItem('Limbs', 1, 37.5),
CreateItem('Scimitar', 2, 112.5),
CreateItem('Warhammer', 3, 112.5),
CreateItem('Plateskirt', 3, 112.5),
CreateItem('Square Shield', 2, 112.5),
CreateItem('Throwing Knives', 1, 37.5),
NULL_ITEM,
CreateItem('Longsword', 2, 112.5),
CreateItem('Battleaxe', 3, 112.5),
CreateItem('Platebody', 5, 187.5),
CreateItem('Kiteshield', 3, 112.5),
CreateItem('Stud', 1, 37.5),
NULL_ITEM,
CreateItem('Two-handed Sword', 3, 112.5),
NULL_ITEM,
CreateItem('Nails', 1, 37.5),
CreateItem('Bullseye lantern', 1, 37.5)
];
Items := [
BronzeArray,
IronArray,
SteelArray
];
end;

function ItemToCoords(Item: Integer): TPoint;
var
OffsetX, OffsetY: Integer;
begin
OffsetX := ((Item mod 6) * MODX);
OffsetY := (((Item div 6) mod 5) * MODY);

Result := Point(BASEX + OffsetX, BASEY + OffsetY);
end;

function ItemToBox(Item: Integer): TBox;
var
C: TPoint;
begin
C := ItemToCoords(Item);

Result := IntToBox(C.X - 10, C.Y - 10, C.X + 15, C.Y + 15);
end;

function DoneSmithing: Boolean;
begin
Result := ClickContinueEx(False, False);
end;

procedure WalkToBank;
begin
F_SetRun(True);
R_WalkToTileMM(BankBooth);
Wait(500 + Random(100));
Flag;
Wait(500 + Random(100));
end;

procedure WalkToAnvil;
begin
F_SetRun(True);
R_WalkToTileMM(Anvil);
Wait(500 + Random(100));
Flag;
Wait(1500 + Random(100));
end;

function F_OpenBank: Boolean;
var
Booth: TPoint;
begin
if (not LoggedIn) or (BankScreen) then
Exit;

Booth := R_TileToMS(BankBooth);
MMouse(Booth.X, Booth.Y, 2, 2);
Sleep(100 + Random(100));
if (R_IsUpText('Bank Ba')) then begin
ClickMouse2(Mouse_Left);
end else begin
ClickMouse2(Mouse_Right);
Sleep(250 + Random(250));
R_ChooseOption('Bank Ba');
end;
Sleep(500 + Random(250));

if (PinScreen) then
InPin(Players[CurrentPlayer].Pin);

Result := WaitFunc(@BankScreen, 250, 2500);
Sleep(1000 + Random(250));
end;

procedure F_CloseBank;
begin
if (not LoggedIn) or (not BankScreen) then
Exit;

MMouse(486, 42, 2, 2);
ClickMouse2(Mouse_Left);
Sleep(250 + Random(250));
end;

function F_WithdrawEx(Col, Row, Amount: Integer; Uptexts: TStringArray): Boolean;
var
BBox: TBox;
X, Y: Integer;
begin
Result := False;
FixBank;
if not bankscreen then
exit;

BBox := BankIndexToMSBox(BankPointToBankIndex(Point(Col, Row)));
BBox := IntToBox(BBox.X1 - 2, BBox.Y1 + 10, BBox.X2 - 2, BBox.Y2 + 3);
GetMousePos(X, Y);
if (not PointInBox(Point(X, Y), BBox)) then
MouseBox(BBox.X1 - 2, BBox.Y1 + 10, BBox.X2 - 2, BBox.Y2 + 3, mouse_move);

if (Length(Uptexts) > 0) then
if (not R_WaitUpTextMulti(Uptexts, 500)) then
Exit;

if (Amount = 1) then
ClickMouse2(mouse_left)
else
ClickMouse2(mouse_right);
if (Amount = 1) then
begin
Result := True;
Wait(RandomRange(250, 550));
Exit;
end;

if (Amount = -1) then
begin
if (WaitOptionMultiEx(['Withdraw-All-but', 'l-b'], 'All', Nothing, 300)) then
Result := R_ChooseOption('Withdraw-All-but');
end else
if (Amount = 0) then
begin
if (WaitOptionMultiEx(['Withdraw-All', 'w-A'], 'All', Nothing, 300)) then
Result := R_ChooseOption('Withdraw-All');
end else
if (WaitOptionMultiEx(['Withdraw-' + IntToStr(Amount) + ' ', 'w-' + IntToStr(Amount) + ' '], 'All', Nothing, 300)) then
Result := R_ChooseOption('Withdraw-' + IntToStr(Amount) + ' ');

if (not (Result)) and (Amount > 0) then
begin
if (not OptionsExist(['Withdraw', 'ithdraw', 'draw'], False)) then
MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, mouse_right);

if WaitOptionMulti(['Withdraw-X', 'w-X', 'X'], 500) then
begin
X := GetSystemTime + 10000;
while (X >= GetSystemTime) and (not (InRange(CountColor(0, 211, 394, 308, 411), 200, 300))) do
Wait(50);
Wait(RandomRange(75, 400));
TypeSend(IntToStr(Amount));
Result := True;
end;
end;
end;

procedure DepositItems;
begin
Deposit(2, 28, True);
end;

procedure WithdrawItems;
begin
if (not F_WithdrawEx(Players[CurrentPlayer].Integers[2], Players[CurrentPlayer].Integers[3], 0, [Types[Players[CurrentPlayer].Integers[0]] + ' bar'])) then begin
Writeln('Out of bars.');
TerminateScript;
end;
end;

procedure AntiBan;
begin
if (not LoggedIn) then
Exit;

case Randomrange(1, 30) of
1, 5, 12, 15, 19: MMouse(Random(MSX2), Random(MSY2), 3, 3);
20, 25: begin
HoverSkill('Smithing', False);
while (R_IsAnimating) do
Sleep(250);
end;
end;
end;

procedure ProgressReport;
var
ExpGained, ExpGainedPerHour, ItemsPerHour: Integer;
begin
ExpGained := R_GetSkillExp(SKILL_SMITHING) - StartExp;
ExpGainedPerHour := Round((ExpGained * 3600) / (GetTimeRunning / 1000));
ItemsPerHour := Round(((ExpGained / Items[Players[CurrentPlayer].Integers[0]][Players[CurrentPlayer].Integers[1]].Experience) * 3600) / (GetTimeRunning / 1000));
Writeln('');
Writeln('Varrock West Smither - By Frement');
Writeln(' - Time Running: ' + TimeRunning);
Writeln(' - ' + Items[Players[CurrentPlayer].Integers[0]][Players[CurrentPlayer].Integers[1]].Name + ' smithed: ' + ToStr(Round(ExpGained / Items[Players[CurrentPlayer].Integers[0]][Players[CurrentPlayer].Integers[1]].Experience)) + ' (' + ToStr(ItemsPerHour) + '/H)');
Writeln(' - Experience Gained: ' + ToStr(ExpGained) + ' (' + ToStr(ExpGainedPerHour) + '/H)');
Writeln(' - Levels Gained: ' + ToStr(LevelsGained) + ' (' + ToStr(R_GetSkillLevel(SKILL_SMITHING)) + ')');
end;

procedure Smith;
var
C, A: TPoint;
Timer, I: Integer;
IB: TBox;
begin
GameTab(tab_Inv);
C := ItemToCoords(Players[CurrentPlayer].Integers[1]);
for I := 28 downto 2 do begin
IB := InvBox(I);
if (CountColor(65536, IB.X1, IB.Y1, IB.X2, IB.Y2) > 0) then begin
MouseBox(IB.X1, IB.Y1, IB.X2, IB.Y2, Mouse_Left);
Break;
end;
end;
Sleep(100 + Random(100));
A := R_TileToMS(Anvil);
MMouse(A.X, A.Y, 2, 2);
Sleep(250 + Random(100));
if (R_IsUpText('Anvil')) then
ClickMouse2(Mouse_Left)
else begin
ClickMouse2(Mouse_Right);
Sleep(100 + Random(100));
R_ChooseOption('Anvil');
Sleep(100 + Random(100));
end;
Sleep(100 + Random(100));
Flag;
Sleep(750 + Random(100));
MMouse(C.X, C.Y, 2, 2);
Sleep(100 + Random(100));
ClickMouse2(Mouse_Right);
Sleep(100 + Random(100));
R_ChooseOption('Smith X');
Sleep(500 + Random(250));
TypeSend('55');
Sleep(1000);
MarkTime(Timer);
while (not DoneSmithing) do begin
if (InventoryModified) then
MarkTime(Timer);

if (TimeFromMark(Timer) > 15000) then begin
Writeln('Something went wrong, trying to recover.');
Break;
end;

if (R_FindNormalRandoms) then begin
Smith;
Break;
end;

if (LevelUp) then begin
Inc(LevelsGained);
Smith;
Break;
end;

AntiBan;

ProgressReport;
end;
end;

begin
DeclarePlayers;
SetupSRL;
SetupReflection;
SetupScript;
SMART_ClearCanvas;
SetupPlayer;
repeat
F_OpenBank;
WithdrawItems;
F_CloseBank;
WalkToAnvil;
Smith;
WalkToBank;
Sleep(1000 + Random(250));
F_OpenBank;
DepositItems;
ProgressReport;
until(False);
end.


Thank you frement!
Your script acts like an adhd smither haha, anyway I can tone down the antiban?

edit: found the sleep function for antiban, Im messing with it and i'll update what i figure out

Frement

2014-05-03 15:45:05

From: hakishakataki
Thank you frement!
Your script acts like an adhd smither haha, anyway I can tone down the antiban?

edit: found the sleep function for antiban, Im messing with it and i'll update what i figure out


Thats what I would do if I would legit smithing.

hakishakataki

2014-05-03 17:25:42

From: Frement
Thats what I would do if I would legit smithing.


hehehah, If I'm going for long periods of time I try to find a monotonous rhythm to it all. It makes the time pass faster