SRL Archive - Senior Scripts and Snippets

SuperFlaxer Sv2


n3ss3s

2008-04-30 05:44:22

Well the walking in my public flaxer using DDTMs wasn't that good so now that Ruroken updated the fields, see the Reflection.scar thread, I reflectionized it.

New features: TileWalking and if the flax you picked earlier is still there it picks that again, like humans do like first pick one flax until it dissapears etc.

Average RoundTime in the "proggie" is around the 120 seconds, which I consider quite fast, so you can get rich before getting banned :p

EDIT: Seems like I've forgotten the pin completing from the banking proc so if you have a pin go put it yourself…
program New;
{.include SRL/SRL/Misc/SMART.scar}
{.include SRL/SRL/Misc/Reflection.scar}
{.include SRL/SRL.scar}



Const
LoadsPerLog = 3;


Var
dtmFlax, FC, RoundTime, RoundMarker, Counter: Integer;

Var
FlaxPath: TPointArray;



Procedure DeclarePlayers;

Begin

HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';

Players[0].Pin := '';

Players[0].Active := True;

End;


Procedure LoadDTMs;
Begin

dtmFlax := DTMFromString('78DA637466626078C98002B8E3F9182481342' +
'310FF07024633A09AC70C6880118904D2B64035F708A801D9758B' +
'801A7FA09A3B04D47803D5BC405511BE732FDCCD6035EE40350F5' +
'1D544ECDE8FAAC616534DF4A163A86ACC816A9EA2AA893F7D1E45' +
'0D00693916D2');
End;


Procedure LoadPath;
Begin

SetArrayLength(FlaxPath, 7);

FlaxPath[0].x := 2726;
FlaxPath[0].y := 3492;
FlaxPath[1].x := 2726;
FlaxPath[1].y := 3484;
FlaxPath[2].x := 2727;
FlaxPath[2].y := 3473;
FlaxPath[3].x := 2727;
FlaxPath[3].y := 3463;
FlaxPath[4].x := 2729;
FlaxPath[4].y := 3453;
FlaxPath[5].x := 2734;
FlaxPath[5].y := 3443;
FlaxPath[6].x := 2740;
FlaxPath[6].y := 3443;

End;


Function n_FFlag(Dist: Integer): Boolean;

Var
FlagSafe: Integer;

Begin

FlagSafe := GetSystemTime;

While FlagDistance > Dist Do
If GetSystemTime - FlagSafe >= 20000 Then
Exit
Else
Wait(20);

Result := True;
End;


Function WalkTile(TileX, TileY: Integer): Boolean;

Var
X, Y: Integer;
Begin
TileToMinimap(TileX, TileY, X, Y);
X := X - 2 + Random(4);
Y := Y - 2 + Random(4);
If InCircle(X, Y, MMCX, MMCY, 74) Then
Begin
MFNF(X, Y, 2, 2);
n_FFlag(8);
Result := True;
Wait(25);
End;
End;


Function WalkTo(Bank: Boolean): Boolean;

Var
I: Integer;
CS: String;
Begin
If GetMMLevels('run', CS) > 40 Then
SetRun(True);
If Bank Then
Begin
For I := High(FlaxPath)-1 DownTo 0 Do
Begin
If Not WalkTile(FlaxPath[i].x, FlaxPath[i].y) Then
Exit;
End;
End Else
For I := 1 To High(FlaxPath) Do
If Not WalkTile(FlaxPath[i].x, FlaxPath[i].y) Then
Exit;
Result := True;
End;



Function FindFlaxes: TPointArray;

Var
CTS: Integer;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, Result, 15328935, MSX1, MSY1, MSX2, MSY2, 10);
ColorToleranceSpeed(CTS);
End;


Function ClickFlax: Boolean;

Var
TPA: TPointArray;
X, Y, Z: Integer;

Begin

TPA := FindFlaxes;

Result := IsUpText('lax');

While (z <= High(TPA)) and (Not(Result)) Do
Begin
MMouse(TPA[z].x, TPA[z].y, 2, 2);
Result := IsUpText('lax');
z := z + 1;
End;

If Result Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, True);
If FlagPresent Then
Begin
Flag;
Wait(500 + Random(250));
End;
End;

End;


Procedure PickingLoop;

Var
FlaxSafe, FailSafe, RT, RTimes, I: Integer;
Begin

FlaxSafe := GetSystemTime;

Repeat
If Not ClickFlax Then
I := I + 1
Else
Begin
I := 0;
FailSafe := GetSystemTime
Wait(200 + Random(400));
RT := GetSystemTime;
If FindNormalRandoms Then
If Not LoggedIn Then
Begin
Writeln('*** Unsolvable random encountered. Breaking out of picking ***');
Break;
End Else
RTimes := RTimes + (GetSystemTime - RT);
End;
If I > 10 Then
Begin
Writeln('*** Over ten fails to find flax in a row, breaking out of picking ***');
Break;
End;
If InvFull Then
Begin
Writeln('*** Inventory full, heading to bank ***');
Break;
End;
If (GetSystemTime - FlaxSafe - RTimes) >= 90000 Then
Begin
Writeln('*** Time spent to picking and randoms exceeded 90 seconds ***');
Writeln(' - breaking out of picking.');
Break;
End;
If GetSystemTime - FailSafe >= 15000 Then
Begin
Writeln('*** Time from last flax picked exceeded 15 seconds ***');
Writeln(' - breaking out of picking.');
Break;
End;
Wait(100 + Random(200));
Until(Not(LoggedIn));
End;


Function FastFindBank: Boolean;

Var
X, Y: Integer;
Begin
X := MSCX;
Y := MSCY;
If FindObjTPA(X, Y, 3823205, 10, 2, 20, 20, 30, ['boot']) Then
Begin
Mouse(X, Y, 2, 2, False);
Result := ChooseOption('uickl');
If Result Then
n_FFlag(0);
End;
End;


Procedure BankWait; Forward;


Function OpenTheBank: Boolean;
Begin
If FastFindBank Then
Begin
BankWait;
If Players[CurrentPlayer].Pin <> '' Then
If PinScreen Then
Result := InPin(Players[CurrentPlayer].Pin);
Result := BankScreen;
End;
End;


Procedure BankWait;

Var
Safe: Integer;
Begin
Safe := GetSystemTime;
While GetColor(487, 42) <> 65536 Do
If GetSystemTime - Safe > 5000 Then
Break
Else
Wait(25);
End;


Procedure DepositFlax;

Var
X, Y: Integer;
Begin
If FindDTM(dtmFlax, X, Y, MIX1, MIY1, MIX2, MIY2) Then
Begin
Mouse(X, Y, 2, 2, False);
ChooseOption('ll');
End;
Wait(800 + Random(400));
If InvCount > 0 Then
DepositAll;
End;


Procedure LocAndLoad(S: String);
Begin
Players[CurrentPlayer].Loc := S;
Logout;
End;


Procedure ShowStats;

Var
A, B, C: Integer;
S: String;
Begin
A := Players[CurrentPlayer].Integers[0];
B := FC;
C := Players[CurrentPlayer].Integers[1];
S := (IntToStr(B)+' / '+IntToStr(A)+'; Flax: '+IntToStr(C * 28));
Writeln(S);
Disguise(S);
RoundTime := RoundTime + (GetSystemTime - RoundMarker);
Try
Writeln('Average RoundTime: ' + IntToStr(RoundTime Div Counter Div 1000) + ' Seconds.');
Except
Writeln('Dodged a Divide By Zero.');
End;
End;


Procedure ScriptTerminate;
Begin
FreeDTM(DTMFlax);
End;


begin
SmartSetup('swe5', False, True);
Wait(5000);
SetTargetDC(SmartGetDC);
SetupSRL;
LoadDTMs;
LoadPath;
DeclarePlayers;
Repeat
LoginPlayer;
SetChat('off', 2);
SetAngle(True);
Players[CurrentPlayer].Integers[0] := LoadsPerLog + Random(6);
FC := 0;
Repeat
RoundMarker := GetSystemTime;
If Not WalkTo(False) Then
Begin
LocAndLoad('Lost');
Break;
End;
PickingLoop;
If Not LoggedIn Then Break;
If Not WalkTo(True) Then
Begin
LocAndLoad('Lost');
Break;
End;
Wait(2000 + Random(1000));
If Not OpenTheBank Then
Begin
LocAndLoad('BankFail');
Break;
End;
DepositFlax;
CloseBank;
FindNormalRandoms;
FC := FC + 1;
Inc(Players[CurrentPlayer].Integers[1]);
Counter := Counter + 1;
ShowStats;
Until(Not(LoggedIn)) or (FC > Players[CurrentPlayer].Integers[0]);
ShowStats;
NextPlayer(LoggedIn);
Until(False);
end.

Bobarkinator

2008-04-30 19:11:28

Yay! No members for me!

Markus

2008-05-01 03:32:30

Wewt! Time to run this, I need 400k cash fast.