Sin
2012-04-12 20:18:37
I'll be needing a few testers, there're quite a few functions that are made by me, so please critique.
This WILL go public, just waiting till I get 99 Firemaking.
Script is now stable enough to run :p
This will NOT pay the butler just yet, this isn't meant to be used by any of the members, just to comment on and tell me what to improve on.
Thanks all ! :)
This WILL go public, just waiting till I get 99 Firemaking.
program new;
{$include srl/srl/misc/smart.simba}
{$I SRL/SRL.simba}
{$I srl/srl/misc/debug.simba}
{$I sps/sps.simba}
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; // Username
Players[0].Pass := ''; // Password
Players[0].Active := True;
Players[0].Pin := '';
Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
end;// declare players
procedure SetupLogin;
begin
ClearDebug;
Smart_Server := 87;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
end;
function FindButler(var fx, fy: Integer): Boolean;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.39, 1.37);
if not(FindColorsTolerance(arP, 2174030, 196,79,349,222, 9)) then
begin
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 1.53) and (X <= 7.94) and (Y >= 1.28) and (Y <= 6.22) and (Z >= 0.91) and (Z <= 3.49) then
begin
for j := 0 to arL2 do
begin
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;
end;
end;
SortTPAFrom(arAP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arAP, 10, 10);
arL := High(ararP);
for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
Wait(100 + Random(100));
if (IsUpText('emon')) then
begin;
Result := True;
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
begin
Exit;
end;
GetMousePos(fx, fy);
end;
function WaitNPCChatText(Text:String; Time:Integer):Boolean;
var
t:Integer;
begin
MarkTime(t);
repeat
wait(10);
if TimeFromMark(t) > Time then
begin
Result := False;
Exit;
end;
until(FindNPCChatText(Text,ClickLeft));
Result := True;
end;
function WaitInvCountInc(Time:Integer):Boolean;
var
Inv1,Inv2,t:Integer;
begin
MarkTime(t);
Inv1 := InvCount;
repeat
wait(10);
Inv2 := InvCount;
if TimeFromMark(t) > Time then
begin
Result := False;
Exit;
end;
until(Inv2 > Inv1);
Result := True;
end;
function WaitInvCountDec(Time:Integer):Boolean;
var
Inv1,Inv2,t:Integer;
begin
MarkTime(t);
Inv1 := InvCount;
repeat
wait(10);
Inv2 := InvCount;
if TimeFromMark(t) > Time then
begin
Result := False;
Exit;
end;
until(Inv2 < Inv1);
Result := True;
end;
function WaitXPIncrease(Time:Integer):Boolean;
var
First,Second,t:Integer;
begin
First := GetXPBarTotal;
MarkTime(T);
repeat
wait(10);
Second := GetXPBarTotal;
if TimeFromMark(t) > Time then
begin
Result := False;
Exit;
end;
until(Second > First);
Result := True;
end;
function GetLogs(Amount:Integer):Boolean;
var
x,y,t:Integer;
begin
Result := False;
if ExistsItem(1) then
MouseItem(1,1);
if FindButler(x,y) then
begin
ClickMouse2(True);
If WaitNPCChatText('coins',1250) Then
Begin
ClickContinue(True, True);
TypeSendEx('1',False);
Wait(RandomRange(800,1000));
MouseItem(1,1);
if FindButler(x,y) then
ClickMouse2(True);
end;
if WaitNPCChatText('cert',4000) then
begin
wait(750 + random(200));
if FindColorSpiralTolerance(x,y,9877449,MCX1,MCY1,MCX2,MCY2,38) then
begin
TypeSend('26');
if WaitInvCountInc(10000) then
Result := True;
end;
end;
end;
end;
function Light(Slot:Integer):Boolean;
begin
MouseItem(Slot,0);
if WaitOptionMulti(['ight','Lig'],750) then
Result := True;
end;
function Relocate:Boolean;
var
x,y:Integer;
begin
MakeCompass(0);
case random(2) of
0:
begin
Mouse(688,77,4,4,True);
FFlag(1);
Wait(750);
Mouse(671,93,5,5,True);
FFlag(1);
Wait(750);
end;
1:
begin
Mouse(671,93,5,5,True);
FFlag(1);
Wait(750);
Mouse(688,77,4,4,True);
FFlag(1);
Wait(750);
end;
end;
Wait(1250 + random(200));
repeat
wait(10);
until(FindButler(x,y));
GetLogs(26);
end;
procedure BurnLogs;
var
i:Integer;
begin
for i := 2 to 28 do
begin
if ExistsItem(i) then
begin
Light(i);
if FindBlackChatMessage('here') then
begin
case Random(2) of
0:
begin
Mouse(627,79,5,5,True);
FFlag(1);
Wait(750);
end;
1:
begin
Mouse(628,91,5,5,True);
FFlag(1);
Wait(750);
end;
end;
end;
if WaitInvCountDec(6000) then
WaitXPIncrease(4000);
end;
end;
if InvCount = 1 then
Relocate;
end;
begin
ClearDebug;
SetupLogin;
DeclarePlayers;
LoginPlayer;
MouseSpeed := RandomRange(22,25);
GetLogs(26);
repeat
BurnLogs;
until not loggedin;
end.Script is now stable enough to run :p
Thanks all ! :)