Daniel
2009-07-05 15:03:04
Yes, well, basically this is my near completed SCAR script which i cannot seem to get to work (seems to terminate after line 1018)…
Basically, could someone please fix this? If you don't understand, run the script and see (place player in Al-Kharic bank and enter details in the multi-player area). On some occasions, it got to the step where it hovers over the ore in the bank (meaning it found it), but does not withdraw the item..
Also, if you're wondering, it's near completion. Meaning it might be ready anytime soon xD Since i still need to finish the sleeping, in the script, etc ;)
So, yer… could someone please help me? As at the moment, i'm stumped (xD):
Thanks in advance.
Basically, could someone please fix this? If you don't understand, run the script and see (place player in Al-Kharic bank and enter details in the multi-player area). On some occasions, it got to the step where it hovers over the ore in the bank (meaning it found it), but does not withdraw the item..
Also, if you're wondering, it's near completion. Meaning it might be ready anytime soon xD Since i still need to finish the sleeping, in the script, etc ;)
So, yer… could someone please help me? As at the moment, i'm stumped (xD):
program AKSmelter;
{.include SRL\SRL\misc\SMART.scar}
{.include SRL\SRL.scar}
const
World = 94; //World to use for SMART?
Yes = True;
No = False;
Debug = Yes; //Debug the script?
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := 'Username'; //RuneScape Player Name
Players[0].Pass := 'Password'; //Runescape Player Pass
Players[0].Pin := '0000'; //Bank Pin - Leave if none.
Players[0].Strings := ['bronze']; //What to smelt?
Players[0].Integers[0] := 1; //Loads to do?
Players[0].Integers[1] := 0; //Random extra loads to do? NOTE: This will be added randomly onto the loads.
Players[0].Booleans[0] := Yes; //Do you want this player to run?
Players[0].Integers[2] := 15; //Run time percentage? 0% = Don't run at all -- 100% = Always run.
Players[0].Booleans[1] := Yes; //Sleep at all?
Players[0].Integers[3] := 30; //If above is Yes (or True), time between sleeping? (in Minutes)
Players[0].Integers[4] := 12; //How long to sleep for? (in Minutes)
Players[0].Loc := 'bank'; //Player Location (Bank or Furnace)?
Players[0].Active := Yes; //Are you using this player?
Writeln('You are using ' + IntToStr(HowManyPlayers) + ' player(s).');
end;
type
Float = Extended;
TOre = (Clay, Copper, Tin, Blurite, Iron, Silver, Coal, Gold, Mithril,
Adamantite, Runite);
TBar = (Bronze, Blurite, Iron, Silver, Steel, Gold, Mithril, Adamant, Runite);
TSmeltBar = record
mOre, sOre: Integer;
m_Ore, s_Ore: TOre;
mOLoc, sOLoc: TPoint;
sBar: TBar;
end;
TSmeltBarArray = array of TSmeltBar;
T2DSmeltBarArray = array of TSmeltBarArray;
TRGB = record
Red, Green, Blue: Byte;
end;
var
X, Y, t_Loads, t_Smelted: Integer;
XPPerHour: Float;
GST, NST: Integer;
TSBA: T2DSmeltBarArray;
CurPlayer, CMMCactus, CMMFurnace, CMMBank, CurOre, CBSOreM, CBSOreS: Integer;
const
//Bank screen edge points
BSX1 = 25;
BSX2 = 480;
BSY1 = 85;
BSY2 = 295;
//Bank screen centre point
BSCX = 252;
BSCY = 190;
//Bank screen tab edge points
BTX1 = 25;
BTX2 = 255;
BTY1 = 50;
BTY2 = 85;
function TabCoord(i: Integer): TBox;
var
bIX, bIY: Integer;
begin
bIX := 50 * (i - 1);
Result.X1 := BTX1 + bIX + 5;
Result.X2 := BTX1 + bIX + 10;
Result.Y1 := BTY1 + 10;
Result.Y2 := BTY2 - 10;
end;
procedure SetRGB(RGB: TRGB; Red, Green, Blue: Byte);
begin
RGB.Red := Red;
RGB.Green := Green;
RGB.Blue := Blue;
end;
const
CurVer = 0.1;
t_CurVer = 'a';
procedure SafeClick(X, Y: Integer; Left: Boolean);
var
i: Integer;
begin
if(Debug) then
Writeln('PERFORMING: procedure SafeClick(X, Y: Integer; Left: Boolean');
HoldMouse(X, Y, Left);
repeat
Sleep(5 + RandomRange(3, 9));
Inc(i);
Until(I > 4);
ReleaseMouse(X, Y, Left);
if(Debug) then
Writeln('PERFORMED: procedure SafeClick(X, Y: Integer; Left: Boolean');
end;
function CheckVersion: Boolean;
var
SVer: Float;
TSA: array of String;
i, bI: Integer;
SS: String;
begin
if(Debug) then
Writeln('PERFORMING: function CheckVersion: Boolean;');
SS := GetPage('http://thesimtoon.com/maya/alk/cuve.txt');
SVer := StrToFloat(Between('is', ',', SS));
if(SVer > CurVer) then
begin
Writeln(' | A newer version of the script is available, please update');
Writeln('| Current Version: ' + FloatToStr(CurVer));
Writeln('| Latest Version: ' + FloatToStr(CurVer));
Writeln('|');
Writeln('| The latest update primarily addresses these fixes:');
TSA := Explode('\n', GetPage('http://thesimtoon.com/maya/alk/cufx.txt'));
bI := High(TSA);
for i := 0 to bI do
Writeln('| - ' + TSA[i]);
Writeln('| Please visit: [url]http://villavu.com[/url] to receive version ' + FloatToStr(SVer));
end else
Writeln('You'#39're using the latest version :)');
if(Debug) then
Writeln('PERFORMED: function CheckVersion: Boolean;');
end;
function SetCompass(Deg: Integer): Boolean;
var
i, bI: Integer;
begin
Result := False;
if(Debug) then
Writeln('PERFORMING: function SetCompass(Deg: Integer): Boolean;');
i := Deg + RandomRange(-10, 10);
FixD(i)
bI := Floor(rs_GetCompassAngleDegrees);
if(bI < Deg) then
begin
KeyDown(VK_RIGHT);
while (not(Floor(rs_GetCompassAngleDegrees) >= i)) do
Wait(2 + RandomRange(1, 3));
KeyUp(VK_RIGHT);
Result := True;
end else
if(bI > Deg) then
begin
KeyDown(VK_LEFT);
while (not(Floor(rs_GetCompassAngleDegrees) <= i)) do
Wait(2 + RandomRange(1, 3));
KeyUp(VK_LEFT);
Result := True;
end else
if(bI = i) then
Result := True;
if(Debug) then
Writeln('PERFORMED: function SetCompass(Deg: Integer): Boolean;');
end;
function FindCactusColour: Integer;
var
TPA: TPointArray;
i, bI, TemporaryCTS: Integer;
BakColour: Integer;
Red, Green, Blue: Integer;
begin
if(Debug) then
Writeln(' PERFORMING: function FindCactusColour: Integer;');
TemporaryCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
FindColorsSpiralTolerance(MMCX, MMCY, TPA, 1925696, MMX1, MMY1, MMX2, MMY2, 35);
bI := High(TPA);
if(bI + 1 > 0) then
begin
for i := 0 to bI do
begin
BakColour := GetColor(TPA[i].X, TPA[i].Y);
ColorToRGB(BakColour, Red, Green, Blue);
if(InRange(Red, 45, 85)) then
if(InRange(Green, 75, 120)) then
if(InRange(Blue, 5, 55)) then
if(GetColor(TPA[i].X + 5, TPA[i].Y) = BakColour) then
if(GetColor(TPA[i].X + 5, TPA[i].Y + 1) = BakColour) then
if(GetColor(TPA[i].X + 1, TPA[i].Y + 1) = BakColour) then
if(GetColor(TPA[i].X + 2, TPA[i].Y) = BakColour) then
if(GetColor(TPA[i].X + 2, TPA[i].Y + 1) = BakColour) then
begin
Result := BakColour;
Writeln('Cactus colour found: ' + IntToStr(BakColour));
if(Debug) then
Writeln(' PERFORMED: function FindCactusColour: Integer;');
Exit;
end;
end;
Writeln('Found a relating cactus colour, but not the one we'#39're looking for :(');
end;
Writeln('Could not find any cactus colours.');
ColorToleranceSpeed(TemporaryCTS);
if(Debug) then
Writeln(' PERFORMED: function FindCactusColour: Integer;');
end;
function FindMMFurnaceColour: Integer;
var
TPA: TPointArray;
i, bI, TemporaryCTS: Integer;
BakColour: Integer;
Red, Green, Blue: Integer;
begin
if(Debug) then
Writeln(' PERFORMING: function FindMMFurnaceColour: Integer;');
TemporaryCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
FindColorsSpiralTolerance(MMCX, MMCY, TPA, 3620683, MMX1, MMY1, MMX2, MMY2, 15);
bI := High(TPA);
if(bI + 1 > 0) then
begin
for i := 0 to bI do
begin
BakColour := GetColor(TPA[i].X, TPA[i].Y);
ColorToRGB(BakColour, Red, Green, Blue);
if(InRange(Red, 60, 90)) then
if(InRange(Green, 60, 70)) then
if(InRange(Blue, 45, 65)) then
if(GetColor(TPA[i].X + 1, TPA[i].Y) = BakColour) then
if(GetColor(TPA[i].X + 2, TPA[i].Y) = BakColour) then
begin
Result := BakColour;
Writeln('MM Furnace colour found: ' + IntToStr(BakColour));
ColorToleranceSpeed(TemporaryCTS);
if(Debug) then
Writeln(' PERFORMED: function FindMMFurnaceColour: Integer;');
Exit;
end;
end;
Writeln('Found a relating MM Furnace colour, but not the one we'#39're looking for :(');
ColorToleranceSpeed(TemporaryCTS);
end;
Writeln('Could not find any MM Furnace colours.');
ColorToleranceSpeed(TemporaryCTS);
if(Debug) then
Writeln(' PERFORMED: function FindMMFurnaceColour: Integer;');
end;
function FindMMBankColour: Integer;
var
TPA: TPointArray;
i, bI, TemporaryCTS: Integer;
BakColour: Integer;
Red, Green, Blue: Integer;
begin
if(Debug) then
Writeln(' PERFORMING: function FindMMBankColour: Integer;');
TemporaryCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
FindColorsSpiralTolerance(MMCX, MMCY, TPA, 2215920, MMX1, MMY1, MMX2, MMY2, 2);
bI := High(TPA);
if(bI + 1 > 0) then
begin
for i := 0 to bI do
begin
BakColour := GetColor(TPA[i].X, TPA[i].Y);
ColorToRGB(BakColour, Red, Green, Blue);
if(InRange(Red, 235, 245)) then
if(InRange(Green, 200, 210)) then
if(InRange(Blue, 30, 35)) then
if(GetColor(TPA[i].X + 1, TPA[i].Y) = BakColour) then
if(GetColor(TPA[i].X + 2, TPA[i].Y) = BakColour) then
begin
Result := BakColour;
Writeln('MM Bank colour found: ' + IntToStr(BakColour));
ColorToleranceSpeed(TemporaryCTS);
if(Debug) then
Writeln(' PERFORMED: function FindMMBankColour: Integer;');
Exit;
end;
end;
Writeln('Found a relating MM Bank colour, but not the one we'#39're looking for :(');
ColorToleranceSpeed(TemporaryCTS);
end;
Writeln('Could not find any MM Bank colours.');
ColorToleranceSpeed(TemporaryCTS);
if(Debug) then
Writeln(' PERFORMED: function FindMMBankColour: Integer;');
end;
function FindMSFurnaceColour(var fTP: TPoint): Boolean;
var
TPA: TPointArray;
TIA: TIntegerArray;
T2DPA: T2DPointArray;
TP: TPoint;
TemporaryCTS, I, D, bI, bD, A: Integer;
Red, Green, Blue: Integer;
begin
Result := False;
if(Debug) then
Writeln(' PERFORMING: function FindMSFurnaceColour(var fTP: TPoint): Integer;');
TemporaryCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 3163035, MSX1, MSY1, MSX2, MSY2, 60);
bI := High(TPA);
if(bI + 1 > 0) then
begin
for i := 0 to bI do
begin
ColorToRGB(GetColor(TPA[i].X, TPA[i].Y), Red, Green, Blue);
if(InRange(Red, 100, 210)) then
if(InRange(Green, 40, 90)) then
if(InRange(Blue, 25, 70)) then
begin
T2DPA := SplitTPAEx(TPA, 25, 25);
bD := High(T2DPA);
for D := 0 to bD do
begin
if(Length(T2DPA[D]) < 25) then
Continue;
TP := MiddleTPA(T2DPA[D]);
MMouse(TP.X, TP.Y, 4, 4);
if(IsUpText('rnac')) then
begin
Result := True;
fTP := TP;
Writeln('Found the Furnace');
ColorToleranceSpeed(TemporaryCTS);
if(Debug) then
Writeln(' PERFORMED: function FindMSFurnaceColour(var fTP: TPoint): Integer;');
Exit;
end;
end;
end;
end;
end;
ColorToleranceSpeed(TemporaryCTS);
if(Debug) then
Writeln(' PERFORMED: function FindMSFurnaceColour(var fTP: TPoint): Integer;');
end;
function FindBSOreColour(Ore: TOre; var _bTP: TPoint): Integer;
var
TPA: TPointArray;
TIA: TIntegerArray;
T2DPA: T2DPointArray;
TP: TPoint;
TemporaryCTS, I, D, bI, bD, A: Integer;
Red, Green, Blue, SC, Tol: Integer;
MinO, MaxO: TRGB;
x, y: Integer;
begin
if(Debug) then
Writeln(' PERFORMING: function FindBSOreColour(Ore: TOre; var _bTP: TPoint): Integer;');
case (Ore) of
Copper:
begin
SetRGB(MinO, 115, 65, 25);
SetRGB(MaxO, 225, 130, 60);
SC := 2909099;
Tol := 65;
end;
Tin:
begin
SetRGB(MinO, 70, 65, 65);
SetRGB(MaxO, 145, 135, 135);
SC := 6579307;
Tol := 60;
end;
Blurite:
begin
SetRGB(MinO, 65, 65, 135);
SetRGB(MaxO, 140, 140, 220);
SC := 11036775;
Tol := 70;
end;
Iron:
begin
SetRGB(MinO, 30, 20, 10);
SetRGB(MaxO, 80, 50, 40);
SC := 1712953;
Tol := 30;
end;
Silver:
begin
SetRGB(MinO, 95, 95, 100);
SetRGB(MaxO, 170, 170, 185);
SC := 9471622;
Tol := 65;
end;
Coal:
begin
SetRGB(MinO, 20, 20, 10);
SetRGB(MaxO, 65, 65, 45);
SC := 1780780;
Tol := 35;
end;
Gold:
begin
SetRGB(MinO, 110, 90, 10);
SetRGB(MaxO, 220, 180, 35);
SC := 1410724;
Tol := 70;
end;
Mithril:
begin
SetRGB(MinO, 35, 35, 55);
SetRGB(MaxO, 80, 80, 120);
SC := 5651258;
Tol := 45;
end;
Adamantite:
begin
SetRGB(MinO, 40, 50, 40);
SetRGB(MaxO, 85, 105, 85);
SC := 4083005;
Tol := 40;
end;
Runite:
begin
SetRGB(MinO, 35, 45, 55);
SetRGB(MaxO, 85, 115, 125);
SC := 5853244;
Tol := 50;
end;
end;
TemporaryCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
FindColorsTolerance(TPA, SC, BSX1, BSY1, BSX2, BSY2, Tol);
bI := High(TPA);
if(bI + 1 > 0) then
begin
for i := 0 to bI do
begin
ColorToRGB(GetColor(TPA[i].X, TPA[i].Y), Red, Green, Blue);
if(InRange(Red, MinO.Red, MaxO.Red)) then
if(InRange(Green, MinO.Green, MaxO.Green)) then
if(InRange(Blue, MinO.Blue, MaxO.Blue)) then
begin
T2DPA := SplitTPAEx(TPA, 5, 5);
bD := High(T2DPA);
for D := 0 to bD do
begin
if(Length(T2DPA[D]) < 5) then
Continue;
TP := MiddleTPA(T2DPA[D]);
MMouse(TP.X, TP.Y, 4, 4);
if(IsUpText('Ore')) then
begin
Writeln('Found the Ore');
GetMousePos(x, y);
Result := GetColor(x, y);
_bTP := MSTPointToBankPoint(IntToPoint(x, y));
ColorToleranceSpeed(TemporaryCTS);
if(Debug) then
Writeln(' PERFORMED: function FindBSOreColour(Ore: TOre; var _bTP: TPoint): Integer;');
Exit;
end;
end;
end;
end;
end;
ColorToleranceSpeed(TemporaryCTS);
if(Debug) then
Writeln(' PERFORMED: function FindBSOreColour(Ore: TOre; var _bTP: TPoint): Integer;');
end;
procedure FixBankHuman;
var
x, y: Integer;
begin
if(Debug) then
Writeln(' PERFORMING: procedure FixBankHuman;');
if(BankScreen) then
begin
if(GetColor(489, 102) = 2830904) then
Exit;
if(GetColor(489, 102) <> 5532018) then
begin
MouseBox(483, 88, 494, 99, 3);
GetMousePos(x, y);
HoldMouse(x, y, True);
while (GetColor(489, 102) <> 5532018) do
Wait(20 + RandomRange(10, 20));
ReleaseMouse(x, y, True);
end;
end;
if(Debug) then
Writeln(' PERFORMED: procedure FixBankHuman;');
end;
function Walking(T: Integer): Boolean;
begin
Result := False;
if(Debug) then
Writeln('PERFORMING: function Walking(T: Integer): Boolean;');
if(not(LoggedIn)) then
begin
Players[CurrentPlayer].Loc := 'dontknow';
Exit;
end;
if(CMMCactus = 0) then
CMMCactus := FindCactusColour;
case (T) of
0: begin
if(RadialWalk(CMMCactus, 40, 95, 45, 3, 3)) then
begin
Writeln(IntToStr(GetSystemTime) + ': Walked to the cactus');
FFlag(3 + Random(3));
if(CMMFurnace = 0) then
CMMFurnace := FindMMFurnaceColour;
if(RadialWalk(CMMFurnace, 20, 345, 80, 3, 3)) then
begin
Writeln(IntToStr(GetSystemTime) + ': Walked to the furnace');
FFlag(1 + Random(3));
Players[CurrentPlayer].Loc := 'furnace';
Result := True;
end else
begin
Writeln(IntToStr(GetSystemTime) + ': Furnace Colour not found');
Players[CurrentPlayer].Loc := 'dontknow';
end;
if(Debug) then
Writeln('PERFORMED: function Walking(T: Integer): Boolean;');
Exit;
end;
end;
1: begin
if(RadialWalk(FindCactusColour, 0, 0, 45, 3, 3)) then
begin
Writeln('Walked Cactus');
FFlag(3 + Random(3));
if(CMMBank = 0) then
CMMBank := FindMMBankColour;
if(RadialWalk(CMMBank, 0, 0, 80, 3, 3)) then
begin
FFlag(1 + Random(3));
Players[CurrentPlayer].Loc := 'bank';
Result := True;
end else
begin
Writeln('Bank not found');
Players[CurrentPlayer].Loc := 'dontknow';
end;
end;
end;
end;
if(Debug) then
Writeln('PERFORMED: function Walking(T: Integer): Boolean;');
end;
procedure dSleep;
var
i, CALC: Integer;
H, M, S: Integer;
begin
if(Debug) then
Writeln('PERFORMING: procedure dSleep;');
if(Players[CurrentPlayer].Booleans[1]) then
begin
NST := ((Players[CurrentPlayer].Integers[3] * 60) * 1000) + Random(Ceil(((Players[CurrentPlayer].Integers[3] * 60) * 1000) / 3));
if((GetTimeRunning - GST) > NST) then
begin
LogOut;
CALC := ((Players[CurrentPlayer].Integers[4] * 60) * 1000) + Random(Ceil(((Players[CurrentPlayer].Integers[4] * 60) * 1000) / 3));
ConvertTime(CALC, H, M, S);
Writeln('Player ' + IntToStr(CurrentPlayer) + ' (' + Players[CurrentPlayer].Name +
'), and is sleeping for ' + IntToStr(CALC) + ' milliseconds (' +
IntToStr(M) + ' minutes and ' + IntToStr(S) + ' seconds).');
i := GetTimeRunning;
while ((GetTimeRunning - i) < CALC) do
Sleep(100 + RandomRange(5, 231));
LoginPlayer;
GST := GetTimeRunning;
end;
end;
if(Debug) then
Writeln('PERFORMED: procedure dSleep;');
end;
procedure OpenAndFixBank;
var
i, bI: Integer;
bTB: TBox;
begin
if(Debug) then
Writeln('PERFORMING: procedure OpenAndFixBank;');
if(not(LoggedIn)) then
Exit;
Wait(403 + RandomRange(203, 407));
bI := RandomRange(3, 6);
Writeln('WHILE BANKSCREEN OR I < BI');
while ((not(BankScreen)) or (i < bI)) do
begin
OpenBankFast('akb');
Wait(203 + RandomRange(303, 507));
Inc(i);
end;
if(BankScreen) then
if(PinScreen) then
begin
Writeln('CHECKING PIN SCREEN');
bI := RandomRange(2, 7);
while ((PinScreen) or (i < bI)) do
begin
InPin(Players[CurrentPlayer].Pin);
if(not(PinScreen)) then
Break;
Inc(i);
Wait(203 + RandomRange(54, 102));
end;
end else
begin
WRITELN('FIXING BANK');
FixBankHuman;
Wait(100 + RandomRange(149, 243));
WRITELN('CHECKING BANK TAB');
if(not(CurrentBankTab > 0)) then
begin
bTB := TabCoord(0);
WRITELN('CHANGING TABS');
case (Random(4)) of
0, 2, 3: MouseBox(bTB.X1, bTB.Y1, bTB.X2, bTB.Y2, 0);
1:
begin
MouseBox(bTB.X1, bTB.Y1, bTB.X2, bTB.Y2, 3);
Wait(80 + RandomRange(15, 87));
if(not(ChooseOption('View all'))) then
begin
WRITELN('NOT CHOOSEOPTION');
bI := RandomRange(2, 7);
for i := 0 to bI do
begin
MouseBox(bTB.X1, bTB.Y1, bTB.X2, bTB.Y2, 0);
Wait(65 + RandomRange(20, 92));
if(not(ChooseOption('View all'))) then
Continue;
Break;
end;
if(i >= bI) then
begin
Writeln('[ERROR] in procedure OpenAndFixBank :: Could not switch tabs ' +
'for player ' + IntToStr(CurrentPlayer));
Writeln('Switching players');
Players[CurrentPlayer].Active := No;
if(Debug) then
Writeln('PERFORMED: procedure OpenAndFixBank;');
Exit;
end;
end;
end;
end;
end;
end;
if(Debug) then
Writeln('PERFORMED: procedure OpenAndFixBank;');
end;
function ClickOnFurnace: Boolean;
var
TP: TPoint;
x, y: Integer;
begin
if(Debug) then
Writeln('PERFORMING: function ClickOnFurnace: Boolean;');
FindMSFurnaceColour(TP);
GetMousePos(x, y);
SafeClick(x, y, True);
Result := (GetColor(235, 375) = 128);
if(Debug) then
Writeln('PERFORMED: function ClickOnFurnace: Boolean;');
end;
procedure IdleSmelt;
var
i: Integer;
begin
if(Debug) then
Writeln(' PERFORMING: procedure IdleSmelt;');
FindNormalRandoms;
case (Random(9)) of
0: GetSkillLevel('smithing');
1: SetCompass(Floor(rs_GetCompassAngleDegrees) + RandomRange(-9, 10));
2, 3, 4, 5, 6, 7: Null;
8: MouseBox(MSX1 - 10, MSY1 - 10, MSX2 + 10, MSY2 + 10, 3);
end;
FindNormalRandoms;
if(Debug) then
Writeln(' PERFORMED: procedure IdleSmelt;');
end;
function ChatEnterAmount: Boolean;
begin
if(Debug) then
Writeln(' PERFORMING: function ChatEnterAmount: Boolean;');
Result := (GetColor(230, 400) = 0);
if(Debug) then
Writeln(' PERFORMED: function ChatEnterAmount: Boolean;');
end;
function ClickBarFurnace(TB: TBox): Boolean;
var
i, x, y: Integer;
begin
if(Debug) then
Writeln(' PERFORMING: function ClickBarFurnace(TB: TBox): Boolean;');
if(not(LoggedIn)) then
Exit;
MouseBox(TB.X1, TB.Y1, TB.X2, TB.Y2, 2);
GetMousePos(x, y);
Wait(301 + RandomRange(93, 189));
if(not(ChooseOption('Smelt X'))) then
while (not(ChatEnterAmount) or (i < 10)) do
begin
SafeClick(x, y, False);
Wait(201 + RandomRange(107, 197));
ChooseOption('Smelt X');
Inc(i);
Wait(102 + RandomRange(203, 319));
end;
Result := ChatEnterAmount;
if(Debug) then
Writeln(' PERFORMED: function ClickBarFurnace(TB: TBox): Boolean;');
end;
function Rand11: Integer;
begin
if(Debug) then
Writeln(' PERFORMING: functon Rand11: Integer;');
case (Random(7)) of
0: Result := 33;
1: Result := 44;
2: Result := 55;
3: Result := 66;
4: Result := 77;
5: Result := 88;
6: Result := 99;
end;
if(Debug) then
Writeln(' PERFORMED: function Rand11: Integer;');
end;
procedure SmeltBar;
var
BarLocs: TBoxArray;
i, bI: Integer;
begin
if(Debug) then
Writeln('PERFORMING: procedure SmeltBar;');
if(not(LoggedIn)) then
Exit;
BarLocs := [IntToBox(35, 397, 72, 424), IntToBox(87, 399, 120, 424),
IntToBox(136, 396, 172, 424), IntToBox(187, 397, 222, 424),
IntToBox(240, 397, 275, 424), IntToBox(292, 399, 327, 424),
IntToBox(344, 398, 380, 424), IntToBox(398, 398, 432, 424),
IntToBox(450, 397, 485, 424)];
case (TSBA[CurrentPlayer][CurOre].sBar) of
Bronze:
begin
bI := RandomRange(4, 8);
while (not(ClickBarFurnace(BarLocs[0])) or (i < bI)) do
Inc(i);
bI := Random(7);
case (bI) of
0: TypeSend(IntToStr(TSBA[CurrentPlayer][CurOre].mOre));
1: TypeSend(IntToStr(TSBA[CurrentPlayer][CurOre].mOre + Random(3)));
2, 3, 4, 5, 6: TypeSend(IntToStr(Rand11));
end;
end;
Blurite:
begin
bI := RandomRange(3, 9);
while (not(ClickBarFurnace(BarLocs[1])) or (i < bI)) do
Inc(i);
bI := Random(7);
case (bI) of
0: TypeSend(IntToStr(TSBA[CurrentPlayer][CurOre].mOre));
1: TypeSend(IntToStr(TSBA[CurrentPlayer][CurOre].mOre + Random(3)));
2, 3, 4, 5, 6: TypeSend(IntToStr(Rand11));
end;
end;
Iron:
begin
bI := RandomRange(4, 9);
while (not(ClickBarFurnace(BarLocs[2])) or (i < bI)) do
Inc(i);
bI := Random(7);
case (bI) of
0: TypeSend(IntToStr(TSBA[CurrentPlayer][CurOre].mOre));
1: TypeSend(IntToStr(TSBA[CurrentPlayer][CurOre].mOre + Random(3)));
2, 3, 4, 5, 6: TypeSend(IntToStr(Rand11));
end;
end;
Silver:
begin
bI := RandomRange(4, 9);
while (not(ClickBarFurnace(BarLocs[3])) or (i < bI)) do
Inc(i);
bI := Random(7);
case (bI) of
0: TypeSend(IntToStr(TSBA[CurrentPlayer][CurOre].mOre));
1: TypeSend(IntToStr(TSBA[CurrentPlayer][CurOre].mOre + Random(3)));
2, 3, 4, 5, 6: TypeSend(IntToStr(Rand11));
end;
end;
Steel:
begin
bI := RandomRange(4, 9);
while (not(ClickBarFurnace(BarLocs[4])) or (i < bI)) do
Inc(i);
bI := Random(7);
case (bI) of
0: TypeSend(IntToStr(TSBA[CurrentPlayer][CurOre].mOre));
1: TypeSend(IntToStr(TSBA[CurrentPlayer][CurOre].mOre + Random(3)));
2, 3, 4, 5, 6: TypeSend(IntToStr(Rand11));
end;
end;
Gold:
begin
bI := RandomRange(4, 9);
while (not(ClickBarFurnace(BarLocs[5])) or (i < bI)) do
Inc(i);
bI := Random(7);
case (bI) of
0: TypeSend(IntToStr(TSBA[CurrentPlayer][CurOre].mOre));
1: TypeSend(IntToStr(TSBA[CurrentPlayer][CurOre].mOre + Random(3)));
2, 3, 4, 5, 6: TypeSend(IntToStr(Rand11));
end;
end;
Mithril:
begin
bI := RandomRange(4, 9);
while (not(ClickBarFurnace(BarLocs[6])) or (i < bI)) do
Inc(i);
bI := Random(7);
case (bI) of
0: TypeSend(IntToStr(TSBA[CurrentPlayer][CurOre].mOre));
1: TypeSend(IntToStr(TSBA[CurrentPlayer][CurOre].mOre + Random(3)));
2, 3, 4, 5, 6: TypeSend(IntToStr(Rand11));
end;
end;
Adamantite:
begin
bI := RandomRange(4, 9);
while (not(ClickBarFurnace(BarLocs[7])) or (i < bI)) do
Inc(i);
bI := Random(7);
case (bI) of
0: TypeSend(IntToStr(TSBA[CurrentPlayer][CurOre].mOre));
1: TypeSend(IntToStr(TSBA[CurrentPlayer][CurOre].mOre + Random(3)));
2, 3, 4, 5, 6: TypeSend(IntToStr(Rand11));
end;
end;
Runite:
begin
bI := RandomRange(4, 9);
while (not(ClickBarFurnace(BarLocs[8])) or (i < bI)) do
Inc(i);
bI := Random(7);
case (bI) of
0: TypeSend(IntToStr(TSBA[CurrentPlayer][CurOre].mOre));
1: TypeSend(IntToStr(TSBA[CurrentPlayer][CurOre].mOre + Random(3)));
2, 3, 4, 5, 6: TypeSend(IntToStr(Rand11));
end;
end;
end;
IncEx(Players[CurrentPlayer].Integers[5], InvCount);
if(Debug) then
Writeln('PERFORMED: procedure SmeltBar;');
end;
procedure ItemSetup;
var
i, sI, bsI: Integer;
begin
if(Debug) then
Writeln(' PERFORMING: procedure ItemSetup;');
SetLength(TSBA, HowManyPlayers - 1);
for i := 0 to HowManyPlayers - 1 do
begin
bsI := High(Players[i].Strings);
SetLength(TSBA[i], bsI + 1);
for sI := 0 to bsI do
case (Lowercase(Players[i].Strings[i][sI])) of
'bronze':
begin
TSBA[i][sI].mOre := 14;
TSBA[i][sI].sOre := 14;
TSBA[i][sI].m_Ore := Copper;
TSBA[i][sI].s_Ore := Tin;
TSBA[i][sI].sBar := Bronze;
// TSBA[i][sI].mOCol
end;
'blurite':
begin
TSBA[i][sI].mOre := 28;
TSBA[i][sI].m_Ore := Blurite;
TSBA[i][sI].sBar := Blurite;
end;
'iron':
begin
TSBA[i][sI].mOre := 28;
TSBA[i][sI].m_Ore := Iron;
TSBA[i][sI].sBar := Iron;
end;
'silver':
begin
TSBA[i][sI].mOre := 28;
TSBA[i][sI].m_Ore := Silver;
TSBA[i][sI].sBar := Silver;
end;
'steel':
begin
TSBA[i][sI].mOre := 9;
TSBA[i][sI].sOre := 18;
TSBA[i][sI].m_Ore := Iron;
TSBA[i][sI].s_Ore := Coal;
TSBA[i][sI].sBar := Steel;
end;
'gold':
begin
TSBA[i][sI].mOre := 28;
TSBA[i][sI].m_Ore := Gold;
TSBA[i][sI].sBar := Gold;
end;
'mithril', 'mith':
begin
TSBA[i][sI].mOre := 5;
TSBA[i][sI].sOre := 20;
TSBA[i][sI].m_Ore := Mithril;
TSBA[i][sI].s_Ore := Coal;
TSBA[i][sI].sBar := Mithril;
end;
'addy', 'adamant', 'adamantite':
begin
TSBA[i][sI].mOre := 4;
TSBA[i][sI].sOre := 24;
TSBA[i][sI].m_Ore := Adamantite;
TSBA[i][sI].s_Ore := Coal;
TSBA[i][sI].sBar := Adamant;
end;
'rune', 'runite':
begin
TSBA[i][sI].mOre := 3;
TSBA[i][sI].sOre := 24;
TSBA[i][sI].m_Ore := Runite;
TSBA[i][sI].s_Ore := Coal;
TSBA[i][sI].sBar := Runite;
end;
end;
end;
if(Debug) then
Writeln(' PERFORMED: procedure ItemSetup;');
end;
procedure SSetup;
var
i: Integer;
begin
if(Debug) then
Writeln('PERFORMING: procedure SSetup;');
Smart_Server := World;
Smart_Signed := True;
SetupSRL;
ItemSetup;
CurPlayer := CurrentPlayer;
for i := 0 to HowManyPlayers - 1 do
Players[i].BoxRewards := ['ote', 'ost', 'XP', 'em', 'thr', 'oal'];
for i := 0 to HowManyPlayers - 1 do
Players[i].Loc := Lowercase(Players[i].Loc);
DeclarePlayers;
CurOre := 0;
CBSOreM := 0;
CBSOreS := 0;
if(Debug) then
Writeln('PERFORMED: procedure SSetup;');
end;
var
ForVar: Integer;
begin
SSetup;
if(Debug) then
Writeln('PERFORMING: Main Loop.');
if(not(LoggedIn)) then
LoginPlayer;
// SetCompass(-2 + Random(5));
SetAngle(True);
MakeCompass('n');
repeat
if(CurrentPlayer <> CurPlayer) then
CurPlayer := CurrentPlayer;
case (Lowercase(Players[CurPlayer].Loc)) of
'bank':
begin
OpenAndFixBank;
Writeln('PERFORMED OPENANDFIXBANK');
if(InvCount <> 0) then
begin
DepositAll;
Writeln('DEPOSITING ALL');
end else
begin
WRITELN('NOT DEPOSITING ALL');
if(CBSOreM = 0) then
CBSOreM := FindBSOreColour(TSBA[CurrentPlayer][CurOre].m_Ore,
TSBA[CurrentPlayer][CurOre].mOLoc);
if(CBSOreS = 0) then
CBSOreS := FindBSOreColour(TSBA[CurrentPlayer][CurOre].s_Ore,
TSBA[CurrentPlayer][CurOre].sOLoc);
Withdraw(TSBA[CurrentPlayer][CurOre].mOLoc.X - 5, TSBA[CurrentPlayer][CurOre].mOLoc.Y - 5,
TSBA[CurrentPlayer][CurOre].mOre);
if(TSBA[CurrentPlayer][CurOre].sOre > 0) then
Withdraw(TSBA[CurrentPlayer][CurOre].sOLoc.X - 5, TSBA[CurrentPlayer][CurOre].sOLoc.Y - 5,
TSBA[CurrentPlayer][CurOre].sOre);
end;
Wait(701 + RandomRange(207, 341));
Walking(0);
Wait(301 + RandomRange(109, 987));
end;
'furnace':
begin
if(InvCount = 0) then
Walking(1) else
begin
if(ClickOnFurnace) then
SmeltBar;
Wait(801 + RandomRange(101, 432));
Players[CurPlayer].Loc := 'furnace';
Walking(1);
end;
end else
begin
Writeln('Unknown location provided, switching players.');
Writeln('Player with unknown location is: ' + Players[CurPlayer].Name);
RandomNextPlayer(False);
end;
end;
Writeln(' /=============================================================\');
Writeln('| Mayazcherquois'' Al-Kharid Smelter |');
Writeln('|---------------------------------------------------------------|');
Writeln('| |');
for ForVar := 0 to HowManyPlayers - 1 do
Writeln(Padr(' Name: ' + Players[ForVar].Name + ' -- Location: ' +
Players[ForVar].Loc + ' -- Smelted: ' + IntToStr(Players[ForVar].Integers[5]) +
' Active: ' + BoolToStr(Players[ForVar].Active), 63) + ' |');
Writeln('|---------------------------------------------------------------|');
Writeln(Padz('| Script Version: ' + FloatToStr(CurVer), 63) +
' |');
Writeln(' \=============================================================/');
Until(AllPlayersInactive);
if(Debug) then
Writeln('PERFORMED: Main Loop.');
end.Thanks in advance.