From: slakan
hmm nop doesnt help me xD i dont understand it
Here is the script i got, modified at the end of it so it will start, but not pick flax :)
Can somone here put in that u said hooks;.. etc in it?
program New;
{.include SRL/SRL/Misc/SMART.scar}
{.include SRL/SRL.scar}
{.include SRL/SRL/Reflection/Reflection.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].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 WalkTTile(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 WalkTTile(FlaxPath[i].x, FlaxPath[i].y) Then
Exit;
End;
End Else
For I := 1 To High(FlaxPath) Do
If Not WalkTTile(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;
Function InBeeKeeper: Boolean;
Var
TPA: TPointArray;
B: TBox;
Begin
FindColorsTolerance(TPA, 0, 570, 35, 688, 129, 1);
B := GetTPABounds(TPA);
Result := GetArrayLength(TPA) = (B.x2 - B.x1) * (B.y2 - B.y1) + 200;
End;
Procedure PickingLoop;
Var
FlaxSafe, FailSafe, RT, RTimes, I: Integer;
Begin
FlaxSafe := GetSystemTime;
FailSafe := GetSystemTime
Repeat
If Not ClickFlax Then
I := I + 1
Else
Begin
I := 0;
FailSafe := GetSystemTime
Wait(200 + Random(400));
RT := GetSystemTime;
If InBeeKeeper Then
Begin
Logout;
Players[CurrentPlayer].Loc := 'Beekeeper';
Exit;
End;
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;
Var
X: TIntegerArray;
Y, I: Integer;
Z: TPointArray;
Begin
X := [2724, 2727, 2728, 2729];
Y := 3494;
SetArrayLength(Z, 4);
For I := 0 To 3 Do
TileToMS(X[i], Y, 15, Z[i].x, Z[i].y);
SortTPAFrom(Z, Point(MSCX, MSCY));
For I := 0 To High(Z) Do
Begin
Mouse(Z[i].x, Z[i].y, 5, 5, False);
If ChooseOption('uickl') Then
Begin
Result := True;
BankWait;
Exit;
End;
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('Player loc: ' + Players[CurrentPlayer].Loc);
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('world137', True, True, False);
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;
Flag;
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.
Begin
SetupSRL;
SetupReflection; // this one is a must :)
// your script;
End.
well here is mine which works fine
program New;
{.include SRL/SRL/Misc/SMART.scar}
{.include SRL/SRL.scar}
{.include SRL/SRL/Misc/Reflection.scar}
Const
LoadsPerLog = 1000;
Var
dtmFlax, FC, RoundTime, RoundMarker, Counter: Integer;
Var
FlaxPath: TPointArray;
Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := 'username';
Players[0].Pass := 'password';
Players[0].Nick := 'sern';
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 WalkTTile(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 WalkTTile(FlaxPath[i].x, FlaxPath[i].y) Then
Exit;
End;
End Else
For I := 1 To High(FlaxPath) Do
If Not WalkTTile(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;
Function InBeeKeeper: Boolean;
Var
TPA: TPointArray;
B: TBox;
Begin
FindColorsTolerance(TPA, 0, 570, 35, 688, 129, 1);
B := GetTPABounds(TPA);
Result := GetArrayLength(TPA) = (B.x2 - B.x1) * (B.y2 - B.y1) + 200;
End;
Procedure PickingLoop;
Var
FlaxSafe, FailSafe, RT, RTimes, I: Integer;
Begin
FlaxSafe := GetSystemTime;
FailSafe := GetSystemTime
Repeat
If Not ClickFlax Then
I := I + 1
Else
Begin
I := 0;
FailSafe := GetSystemTime
Wait(200 + Random(400));
RT := GetSystemTime;
If InBeeKeeper Then
Begin
Logout;
Players[CurrentPlayer].Loc := 'Beekeeper';
Exit;
End;
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;
Var
X: TIntegerArray;
Y, I: Integer;
Z: TPointArray;
Begin
X := [2724, 2727, 2728, 2729];
Y := 3494;
SetArrayLength(Z, 4);
For I := 0 To 3 Do
TileToMS(X[i], Y, 15, Z[i].x, Z[i].y);
SortTPAFrom(Z, Point(MSCX, MSCY));
For I := 0 To High(Z) Do
Begin
Mouse(Z[i].x, Z[i].y, 5, 5, False);
If ChooseOption('uickl') Then
Begin
Result := True;
BankWait;
Exit;
End;
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('Player loc: ' + Players[CurrentPlayer].Loc);
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('world137', True, True, False);
Wait(5000);
SetTargetDC(SmartGetDC);
SetupSRL;
LoadHooks;
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;
Flag;
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.
hope this one works
~shut