SRL Archive - OSR Help

Help Please


Gucci

2012-04-24 19:46:24

So this is for a series of scripts I'm working on and really want to release it but there's a problem. The script won't do the spinning part of the script like it will walk to the spinner but won't actually spin just goes back to looking for flax for some reason. Any help would be appreciated, as I've tried anything I could think of :redface:


Script:

program FlaxNSpin;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                // By Gucci
{$DEFINE SMART}
{$loadlib sps}
{$Include SRL/SRL/Misc/SMART.simba}
{$i SRL/SRL.simba}
{$I SRL/SRL/Misc/Debug.simba}
{$i sps/sps.simba}
{$i SRL/SRL/misc/paintsmart.simba}

{ Instuctions:
1. Make sure your SPS maps are updated.
2. Start at new Tavereley bank with inventory empty.
3. Hit Run. }



const
SRLSTATS_USER = ''; // Your SRL Stats Username
SRLSTATS_PASSWORD = ''; // Your SRL Stats Password
SERVER = 0; // Enter "0" to pick a random server.
MEMBERS = True;
NUMBOFPLAYERS = 1;
STARTPLAYER = 0;
FLAXPRICE = 74; // Update to latest price of flax for accurate profit counting
STRINGPRICE = 198; //Update to latest price of bow string
var
Spinner, Make, Flax: Integer;
ToFlax, ToBank, ToSpinner: TPointArray;
aFound: Extended;

procedure DeclarePlayers;
var i:integer;
begin
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer
for i := 0 to NumbOfPlayers-1 do
Players[i].BoxRewards := ['XP'];

With Players[0] do
begin
Name := ''; //Username.
Pass := ''; //Password.
Active := True;
end;

end;

function Walking(Color, Tolerance: Integer; SortFrom: tpoint): Boolean;// credit to Camaro' for the tutorial and function!
var
i, x, y, rx, ry: Integer;
TPA: TPointArray;
begin
if not LoggedIn then Exit;
FindNormalRandoms;
FindColorsSpiralTolerance(MMCX, MMCY, TPA, Color, MMX1, MMY1, MMX2, MMY2, Tolerance);
SortTPAFrom(TPA, SortFrom);

for i := 0 to High(TPA) do
begin
x := TPA[i].x;
y := TPA[i].y;

rx := RandomRange(-6, 6);
ry := RandomRange(-6, 6);
if (not rs_OnMinimap(x + rx, y + ry)) then
Continue;

Mouse(x + rx, y + ry, 0, 0, true);
FFlag(0);
Wait(300 + Random(300));
Result := True;
Break;
end;
end;

procedure FailSafe (Reason:String);
begin
Players[CurrentPlayer].Loc:=Reason;
Logout;
Stats_Commit;
TerminateScript;
end;

procedure WalkToFlax;
begin
SetupSRL;
SPS_Setup(RUNESCAPE_SURFACE, ['8_7','8_6']);
ToFlax := [Point(3340, 2981), Point(3364, 2969), Point(3364, 2946),
Point(3371, 2920), Point(3368, 2892), Point(3362, 2867), Point(3375, 2847),
Point(3394, 2824), Point(3409, 2794), Point(3376, 2789)];
SPS_WalkPath(ToFlax);
end;

procedure SpinnerToBank;
begin
SetupSRL;
SPS_Setup(RUNESCAPE_SURFACE, ['8_7','8_6']);
ToBank := [Point(3392, 2669), Point(3403, 2690), Point(3406, 2718),
Point(3408, 2749), Point(3422, 2779), Point(3414, 2795), Point(3395, 2836),
Point(3382, 2851), Point(3361, 2867), Point(3368, 2892), Point(3373, 2916),
Point(3371, 2948), Point(3364, 2972), Point(3344, 2982)];
SPS_WalkPath(ToBank);
end;

procedure FlaxPickled;
var
FlaxPicked: Integer;
begin
if (InvFull) then
IncEx(FlaxPicked, 28);
end;

procedure FlaxToSpinner;
begin
FindNormalRandoms;
MakeCompass('E');
SetupSRL;
SPS_Setup(RUNESCAPE_SURFACE, ['8_6']);
ToSpinner := [Point(3378, 2791), Point(3384, 2759), Point(3398, 2742),
Point(3404, 2709), Point(3402, 2672), Point(3390, 2668)];
SPS_WalkPath(ToSpinner);
end;

procedure StringsDone;
var
BowStrings, x, y: integer;
begin
if FindSymbol(x, y, 'spinning wheel') then
IncEx(BowStrings, 28);
end;

procedure Rest;
var
S: String;
begin
if not (LoggedIn) then
Exit;
if (GetMMLevels('Run', S) <= 25) then
RestUntil(RandomRange(75,100))
end;

procedure Report;
var
FlaxPicked, BowStrings: Integer;
begin
if (SPS_WalkPath(ToBank)) then

begin

Writeln('############ Guccis Flax N Spin ############');
Writeln('|= Player : ' + Players[CurrentPlayer].Name);
Writeln('|= Time Running : ' + TimeRunning);
Writeln('|= Flax Picked : ' + IntToStr(FlaxPicked));
Writeln('|= String Spun : ' + IntToStr(BowStrings));
Writeln('|= Profit Gained : ' + IntToStr((FlaxPicked*FLAXPRICE) - (BowStrings*STRINGPRICE)) + 'GP');
Writeln('#############################################');
end;
end;

procedure AntiBan;
begin
if(not(LoggedIn))then
exit;
FindNormalRandoms;
case Random(2) of
0:
begin
WriteLn('AntiBan, Move Camera');
MakeCompass('N');
wait(150+random(100));
MakeCompass('E');
wait(50+random(100));
MakeCompass('S');
end;
end;
end;

function FlaxColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(1.84, 2.01);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 6781760, MSX1, MSY1, MSX2, MSY2, 6);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 7.11) and (X <= 15.45) and (Y >= 9.62) and (Y <= 18.56) and (Z >= 6.31) and (Z <= 33.79) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

function FindFlax(x, y: Integer): Boolean;
var
CTS, I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(1.84, 2.01);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 6781760, MSX1, MSY1, MSX2, MSY2, 6);
ATPA := TPAToATPAEx(TPA, 15, 15);

For I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
if High(TPA) > 100 then
MMouse(x, y, 2, 2);
If(IsUpTextMultiCustom(['ick', 'lac', 'k F'])) then
begin
Result := True;
GetMousePos(x, y);
Break;
end;
end;
ColorToleranceSpeed(CTS);
end;

procedure DTMS;
begin
Spinner := DTMFromString('mGQAAAHicY2QAAiYGBl5GBobSSCcGZiCXESQGAA5aASY=');
Make := DTMFromString('mQwAAAHicY2ZgYJBmZGAQAGI5IBZiYmDgBWJZIM5JDQZjPl5eBmTAiISBAAB1kQMF');
Flax := DTMFromString('mWAAAAHicY2FgYPBgYmDwBeIwIHYC4gBGIA3EgUAcBsScztxAVUxIGBUwomEQAAC+7wLY');
end;

procedure FrDTMS;
begin
FreeDTMs([Spinner, Make, Flax]);
end;

function SpinnerColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.08, 0.23);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 5140368, MSX1, MSY1, MSX2, MSY2, 11);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 10.10) and (X <= 29.48) and (Y >= 9.69) and (Y <= 29.09) and (Z >= 5.74) and (Z <= 15.88) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

function FindSpinner(x, y: Integer): Boolean;
var
CTS, I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.08, 0.23);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, SpinnerColor, MSX1, MSY1, MSX2, MSY2, 11);
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, 15, 15);

For I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
if High(TPA) > 100 then
MMouse(x, y, 2, 2);
If(IsUpTextMultiCustom(['pin, pinning, heel'])) then
begin
Result := True;
GetMousePos(x, y);
Break;
end;
end;
end;

function Spinning: Boolean;
var
PBox: TBox;
begin
PBox := IntToBox(245, 130, 285, 195);
Result := (AveragePixelShift(PBox, 250, 700) > 650);
end;

procedure SpinFlax;
var
x, y: Integer;
begin
if FindSymbol(x, y, 'spinning wheel') or SPS_WalkPath(ToSpinner) then

begin
MakeCompass('N');
SetAngle(SRL_ANGLE_HIGH);
Wait(100 + Random(100));
if FindSpinner(x, y) or FindDTMRotated(Spinner, x, y, MSX1, MSY1, MSX2, MSY2, -Pi/4, Pi/4, Pi/60, aFound) then
Wait(RandomRange(200, 300));
ClickMouse2(mouse_right);
ChooseOption('pin');
Wait(500 + Random(100));

if FindDTM(Make, x, y, MCX1, MCY1, MCX2, MCY2) then
begin
Clickmouse2(True);
end;

if Spinning then
begin
AntiBan;
end;

Repeat
Wait(50 + Random(100));
Until(not(Spinning) or (not(FindDTM(Flax, x, y, MIX1, MIY1, MIX2, MIY2))))
end;
end;

procedure MakeStrings;
begin
FlaxToSpinner;
TypeSend('RAWR');
SpinFlax;
end;

procedure FlaxPicking;
var
x, y:Integer;
begin
if (InvEmpty) then
WalkToFlax;
begin
if (InvFull) then
MakeStrings;

if FindFlax(x, y) or FindObjCustom(x, y, ['ick', 'lax'], [10719571, 15129519], 8) then
begin
Writeln('Found Flax');
Wait(500+random(50));
Mouse(x, y, 5, 5, True);
wait(10+random(50));
end else Writeln('Cannot Find Flax');
repeat
FlaxPicking;
Until(InvFull);
end;
end;

procedure Banking;
begin
if SPS_WalkPath(ToBank) then

begin
MakeCompass('S');
SetAngle(SRL_ANGLE_HIGH);

OpenBankFast('tavb');

if BankScreen then
DepositAll;
end;
end;

begin
ClearDebug;
Smart_Signed := TRUE;
Smart_Members := MEMBERS;
Smart_SuperDetail := FALSE;
Smart_Server := 24;
ActivateClient;
SetupSRL;
FlaxColor;
SpinnerColor;
DTMS;
DeclarePlayers;
if not (LoggedIn) then
LoginPlayer;
Wait(4000+random(400));
Repeat
WalkToFlax;
FlaxPicking;
FlaxPickled;
if InvFull then
begin
MakeStrings;
end;
SpinnerToBank;
Banking;
Report;
Until(False)
FrDTMS;
end.

Total

2012-04-24 20:01:15

Maybe put something right before the last end; in your SpinFlax procedure and see if it spits it out after walking? It might be having trouble finding the symbol or the path so it's not even going into the procedure.


procedure SpinFlax;
var
x, y: Integer;
begin
if FindSymbol(x, y, 'spinning wheel') or SPS_WalkPath(ToSpinner) then

begin
Writeln('At spinning wheel');
MakeCompass('N');
SetAngle(SRL_ANGLE_HIGH);
Wait(100 + Random(100));
if FindSpinner(x, y) or FindDTMRotated(Spinner, x, y, MSX1, MSY1, MSX2, MSY2, -Pi/4, Pi/4, Pi/60, aFound) then
Wait(RandomRange(200, 300));
ClickMouse2(mouse_right);
ChooseOption('pin');
Wait(500 + Random(100));

if FindDTM(Make, x, y, MCX1, MCY1, MCX2, MCY2) then
begin
Clickmouse2(True);
end;

if Spinning then
begin
AntiBan;
end;

Repeat
Wait(50 + Random(100));
Until(not(Spinning) or (not(FindDTM(Flax, x, y, MIX1, MIY1, MIX2, MIY2))))
end else
Writeln('Not at spinning wheel');
end;

Or do something like that to test it.

Gucci

2012-04-24 20:32:12

But when I remove the

if FindSymbol(x, y, 'spinning wheel') or SPS_WalkPath(ToSpinner) then


and just loops it after FlaxToSpinner; it still doesn't work the DTM's and stuff are good and should work, it's more like why is it finding flax there when the inv is full

Total

2012-04-24 20:46:40

Try putting


if InvFull then
begin
MakeStrings;
end;

at the top of the loop instead of the middle? Not sure exactly…interesting.

Or put everything before it in a if not InvFull statement or something.

Gucci

2012-04-25 22:17:24

Bump!! Anyone?

I tried making the spinning part that includes walking there and spinning in this procedure MakeStrings; so I have it like this in the mainloop


if InvFull then
begin
MakeStrings;
end;

Also tried

if InvFull then
begin
SpinnerToFlax;
SpinFlax;
StringsDone;
end;

Really out of ideas :confused:

NCDS

2012-04-25 23:06:31

I don't have time to look through right now, but just debug your code. After every conditional, put a writeln regardless of the result so you can read along every bit of your code as it's running.

That's a sure way to find the problem, usually.

Gucci

2012-04-26 11:02:54

Okay so I tried what you said NCDS, so this is the setup:

program FlaxNSpin;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                // By Gucci
{$DEFINE SMART}
{$loadlib sps}
{$Include SRL/SRL/Misc/SMART.simba}
{$i SRL/SRL.simba}
{$I SRL/SRL/Misc/Debug.simba}
{$i sps/sps.simba}
{$i SRL/SRL/misc/paintsmart.simba}

{ Instuctions:
1. Make sure your SPS maps are updated.
2. Start at new taverly bank with iventory empty.
3. Hit Run. }



const
SRLSTATS_USER = ''; // Your SRL Stats Username
SRLSTATS_PASSWORD = ''; // Your SRL Stats Password
SERVER = 0; // Enter "0" to pick a random server.
MEMBERS = True;
NUMBOFPLAYERS = 1;
STARTPLAYER = 0;
FLAXPRICE = 74; // Update to latest price of flax for accurate profit counting
STRINGPRICE = 198; //Update to latest price of bow string
var
Spinner, Make, Flax: Integer;
ToFlax, ToBank, ToSpinner: TPointArray;
aFound: Extended;

procedure DeclarePlayers;
var i:integer;
begin
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer
for i := 0 to NumbOfPlayers-1 do
Players[i].BoxRewards := ['XP'];

With Players[0] do
begin
Name := ''; //Username.
Pass := ''; //Password.
Active := True;
end;

end;

function Walking(Color, Tolerance: Integer; SortFrom: tpoint): Boolean;// credit to Camaro' for the tutorial and function!
var
i, x, y, rx, ry: Integer;
TPA: TPointArray;
begin
if not LoggedIn then Exit;
FindNormalRandoms;
FindColorsSpiralTolerance(MMCX, MMCY, TPA, Color, MMX1, MMY1, MMX2, MMY2, Tolerance);
SortTPAFrom(TPA, SortFrom);

for i := 0 to High(TPA) do
begin
x := TPA[i].x;
y := TPA[i].y;

rx := RandomRange(-6, 6);
ry := RandomRange(-6, 6);
if (not rs_OnMinimap(x + rx, y + ry)) then
Continue;

Mouse(x + rx, y + ry, 0, 0, true);
FFlag(0);
Wait(300 + Random(300));
Result := True;
Break;
end;
end;

procedure FailSafe (Reason:String);
begin
Players[CurrentPlayer].Loc:=Reason;
Logout;
Stats_Commit;
TerminateScript;
end;

procedure WalkToFlax;
begin
SetupSRL;
SPS_Setup(RUNESCAPE_SURFACE, ['8_7','8_6']);
ToFlax := [Point(3340, 2981), Point(3364, 2969), Point(3364, 2946),
Point(3371, 2920), Point(3368, 2892), Point(3362, 2867), Point(3375, 2847),
Point(3394, 2824), Point(3409, 2794), Point(3376, 2789)];
SPS_WalkPath(ToFlax);
end;

procedure SpinnerToBank;
begin
SetupSRL;
SPS_Setup(RUNESCAPE_SURFACE, ['8_7','8_6']);
ToBank := [Point(3392, 2669), Point(3403, 2690), Point(3406, 2718),
Point(3408, 2749), Point(3422, 2779), Point(3414, 2795), Point(3395, 2836),
Point(3382, 2851), Point(3361, 2867), Point(3368, 2892), Point(3373, 2916),
Point(3371, 2948), Point(3364, 2972), Point(3344, 2982)];
SPS_WalkPath(ToBank);
end;

procedure FlaxPickled;
var
FlaxPicked: Integer;
begin
if (InvFull) then
IncEx(FlaxPicked, 28);
end;

procedure FlaxToSpinner;
begin
FindNormalRandoms;
MakeCompass('E');
SetupSRL;
SPS_Setup(RUNESCAPE_SURFACE, ['8_6']);
ToSpinner := [Point(3378, 2791), Point(3384, 2759), Point(3398, 2742),
Point(3404, 2709), Point(3402, 2672), Point(3390, 2668)];
SPS_WalkPath(ToSpinner);
Writeln('Walking to spinning wheel successful');
end;

procedure StringsDone;
var
BowStrings, x, y: integer;
begin
if FindSymbol(x, y, 'spinning wheel') then
IncEx(BowStrings, 28);
end;

procedure Rest;
var
S: String;
begin
if not (LoggedIn) then
Exit;
if (GetMMLevels('Run', S) <= 25) then
RestUntil(RandomRange(75,100))
end;

procedure Report;
var
FlaxPicked, BowStrings: Integer;
begin
if (SPS_WalkPath(ToBank)) then

begin

Writeln('############ Guccis Flax N Spin ############');
Writeln('|= Player : ' + Players[CurrentPlayer].Name);
Writeln('|= Time Running : ' + TimeRunning);
Writeln('|= Flax Picked : ' + IntToStr(FlaxPicked));
Writeln('|= String Spun : ' + IntToStr(BowStrings));
Writeln('|= Profit Gained : ' + IntToStr((FlaxPicked*FLAXPRICE) - (BowStrings*STRINGPRICE)) + 'GP');
Writeln('#############################################');
end;
end;

procedure AntiBan;
begin
if(not(LoggedIn))then
exit;
FindNormalRandoms;
case Random(2) of
0:
begin
WriteLn('AntiBan, Move Camera');
MakeCompass('N');
wait(150+random(100));
MakeCompass('E');
wait(50+random(100));
MakeCompass('S');
end;
end;
end;

function FlaxColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(1.84, 2.01);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 6781760, MSX1, MSY1, MSX2, MSY2, 6);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 7.11) and (X <= 15.45) and (Y >= 9.62) and (Y <= 18.56) and (Z >= 6.31) and (Z <= 33.79) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

function FindFlax(x, y: Integer): Boolean;
var
CTS, I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(1.84, 2.01);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 6781760, MSX1, MSY1, MSX2, MSY2, 6);
ATPA := TPAToATPAEx(TPA, 15, 15);

For I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
if High(TPA) > 100 then
MMouse(x, y, 2, 2);
If(IsUpTextMultiCustom(['ick', 'lac', 'k F'])) then
begin
Result := True;
GetMousePos(x, y);
Break;
end;
end;
ColorToleranceSpeed(CTS);
end;

procedure DTMS;
begin
Spinner := DTMFromString('mGQAAAHicY2QAAiYGBl5GBobSSCcGZiCXESQGAA5aASY=');
Make := DTMFromString('mQwAAAHicY2ZgYJBmZGAQAGI5IBZiYmDgBWJZIM5JDQZjPl5eBmTAiISBAAB1kQMF');
Flax := DTMFromString('mWAAAAHicY2FgYPBgYmDwBeIwIHYC4gBGIA3EgUAcBsScztxAVUxIGBUwomEQAAC+7wLY');
end;

procedure FrDTMS;
begin
FreeDTMs([Spinner, Make, Flax]);
end;

function SpinnerColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.01, 0.60);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 5669800, MSX1, MSY1, MSX2, MSY2, 8);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 17.83) and (X <= 33.33) and (Y >= 17.62) and (Y <= 32.85) and (Z >= 9.84) and (Z <= 17.96) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

function FindSpinner(x, y: Integer): Boolean;
var
CTS, I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.01, 0.60);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 5669800, MSX1, MSY1, MSX2, MSY2, 8);
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, 15, 15);

For I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
if High(TPA) > 100 then
MMouse(x, y, 2, 2);
If(IsUpTextMultiCustom(['pin, pinning, heel'])) then
begin
Result := True;
GetMousePos(x, y);
Break;
end;
end;
end;

function Spinning: Boolean;
var
PBox: TBox;
begin
PBox := IntToBox(245, 130, 285, 195);
Result := (AveragePixelShift(PBox, 250, 700) > 650);
end;

procedure SpinFlax;
var
x, y: Integer;
begin
if FindSymbol(x, y, 'spinning wheel') or SPS_WalkPath(ToSpinner) then

begin
Writeln('At spinning wheel');
MakeCompass('N');
SetAngle(SRL_ANGLE_HIGH);
Wait(100 + Random(100));
if (FindDTMRotated(Spinner, x, y, MSX1, MSY1, MSX2, MSY2, -Pi/4, Pi/4, Pi/60, aFound) or FindSpinner(x, y)) then
begin
Wait(RandomRange(200, 300));
ClickMouse2(mouse_right);
ChooseOption('pin');
Wait(500 + Random(100));
Mouse(158, 425, 1, 1, True);
end;

//if FindDTM(Make, x, y, MCX1, MCY1, MCX2, MCY2) then
//begin
//Clickmouse2(True);
//end;

if Spinning then
begin
AntiBan;
end;

Repeat
Wait(50 + Random(100));
Until(not(Spinning) or (not(FindDTM(Flax, x, y, MIX1, MIY1, MIX2, MIY2))))
end else
Writeln('Not at spinning wheel');
end;

procedure MakeStrings;
begin
FlaxToSpinner;
SpinFlax;
end;

procedure FlaxPicking;
var
x, y:Integer;
begin
if (InvEmpty) then
WalkToFlax;
begin
if (InvFull) then
MakeStrings;

if FindFlax(x, y) or FindObjCustom(x, y, ['ick', 'lax'], [10719571, 15129519], 8) then
begin
Writeln('Found Flax');
Wait(500+random(50));
ClickMouse2(True);
wait(10+random(50));
end else Writeln('Cannot Find Flax');
repeat
FlaxPicking;
Until(InvFull);
end;
end;

procedure Banking;
begin
if SPS_WalkPath(ToBank) then

begin
MakeCompass('S');
SetAngle(SRL_ANGLE_HIGH);

OpenBankFast('tavb');

if BankScreen then
DepositAll;
end;
end;

begin
ClearDebug;
Smart_Signed := TRUE;
Smart_Members := MEMBERS;
Smart_SuperDetail := FALSE;
Smart_Server := 24;
ActivateClient;
SetupSRL;
FlaxColor;
SpinnerColor;
DTMS;
DeclarePlayers;
if not (LoggedIn) then
LoginPlayer;
Wait(4000+random(400));
Repeat
WalkToFlax;
FlaxPicking;
FlaxPickled;
if InvFull then
begin
MakeStrings;
end;
SpinnerToBank;
Banking;
Report;
Until(False)
FrDTMS;
end.

Still no luck heres debug:

SMART Initialized.
Loaded: Server 24, Members: True, Signed: True, Super Detail: False.
Walking to spinning wheel successful
At spinning wheel
Cannot Find Flax
SRL Compiled in 16 msec
SMART Initialized.
Loaded: Server 24, Members: True, Signed: True, Super Detail: False.

NCDS

2012-04-26 11:21:33

I don't think FindDTMRotated moves the mouse for you. If that's the case, then your code will only work if FindSpinner results true. Otherwise, it will just click where the mouse currently is located.

This 'error' is never really handled in your code either as you never check to make sure you actually are spinning, just telling the script to wait until you're not spinning.

Try to compensate for that and let me know how it goes, but I've got to run for now.

Abu

2012-04-26 11:25:04

From: NCDS

This 'error' is never really handled in your code either as you never check to make sure you actually are spinning, just telling the script to wait until you're not spinning.


Gucci, you can fix that by doing this in your next procedure:
while spinning do
Wait(20);

Total

2012-04-26 12:19:42

But hes not even getting it to spin the flax, so that won't work. Just realized when NCDS said it you arent even moving your mouse to the DTM so it may just be going through the steps and when it gets to the repeat statement you aren't spinning so it continues.

johnbrown8976

2012-04-26 23:13:54

Hi, you are missing the MMouse() function which moves the mouse, findDTM just finds the location (x, y) of the DTM but does not move the mouse. Here is my updated Procedure SpinFlax. I tried to fix the part you are having problem, but the script still needs some modification. DTM of Make (which only has 3 points) cannot be found and script stops.

The lines I modified have {//} at the start.


procedure SpinFlax;
var
x, y: Integer;
begin
if FindSymbol(x, y, 'spinning wheel') or SPS_WalkPath(ToSpinner) then
begin
MakeCompass('N');
SetAngle(SRL_ANGLE_HIGH);
Wait(100 + Random(100));
if FindSpinner(x, y) or FindDTMRotated(Spinner, x, y, MSX1, MSY1, MSX2, MSY2, -Pi/4, Pi/4, Pi/60, aFound) then

{//}MMouse(x, y, 2, 2);
Wait(RandomRange(200, 300));
ClickMouse2(mouse_right);
{//}WaitOption('pin', RandomRange(200, 400));

{When I tried the script, it was finding the Spinning wheel
on the right of the screen, SO it takes longer to walk, and
and your script failed. Thus, I would recommend something like...}
{//}while IsMoving do
{//} wait(50+random(50));

Wait(1000 + Random(100));

if FindDTM(Make, x, y, MCX1, MCY1, MCX2, MCY2) then
begin
{It doesn't find the Make DTM for me. Please check the DTM, it has only 3 points.}
{//}writeln('Make DTM found')
{//}MMouse(x, y, 2, 2);
{//}wait(RandomRange(200,400));
Clickmouse2(True);
end;

if Spinning then
begin
AntiBan;
end;

Repeat
Wait(50 + Random(100));
Until(not(Spinning) or (not(FindDTM(Flax, x, y, MIX1, MIY1, MIX2, MIY2))))
end;
end;

Gucci

2012-04-26 23:20:52

Yeah I added ClickMouse2(True); but still no luck I think NCDS knows what the problem is since it isn't moving just clicking where the mouse already is

Total

2012-04-26 23:31:13

ClickMouse2(True); won't work. You need to move the mouse with MMouse and then click or just use Mouse.

johnbrown8976

2012-04-26 23:53:52

From: Gucci
Yeah I added ClickMouse2(True); but still no luck I think NCDS knows what the problem is since it isn't moving just clicking where the mouse already is


I updated your SpinFlax Procedure, now works perfectly. Just Replace your SpinFlax Procedure with this.


procedure SpinFlax;
var
x, y: Integer;
begin
if FindSymbol(x, y, 'spinning wheel') or SPS_WalkPath(ToSpinner) then
begin
MakeCompass('N');
SetAngle(SRL_ANGLE_HIGH);
Wait(100 + Random(100));
if FindSpinner(x, y) or FindDTMRotated(Spinner, x, y, MSX1, MSY1, MSX2, MSY2, -Pi/4, Pi/4, Pi/60, aFound) then

MMouse(x, y, 2, 2);
Wait(RandomRange(200, 300));
ClickMouse2(mouse_right);
WaitOption('pin', RandomRange(200, 400));

//Waits until player is moving
while IsMoving do
wait(50+random(50));
Wait(1000 + Random(100));

Make := DTMFromString('mbQAAAHicY2VgYNgNxBuBeA8QnwDi7UB8iZGB4QwQnwDi60B8B4hjgm0ZclKDGQwUFMA0CIsA1aJjRiwYDAC6jgz8');

if FindDTM(Make, x, y, MCX1, MCY1, MCX2, MCY2) then
begin
MMouse(x, y, 2, 2);
wait(RandomRange(200,400));
Clickmouse2(True);
end;

if Spinning then
begin
AntiBan;
end;

Repeat
Wait(50 + Random(100));
Until(not(Spinning) or (not(FindDTM(Flax, x, y, MIX1, MIY1, MIX2, MIY2))))
end;
end;


Gucci

2012-04-27 00:00:20

Wait so you tested and it span the flax? o.o

johnbrown8976

2012-04-27 00:09:09

From: Gucci
Wait so you tested and it span the flax? o.o


Yes I did,it Spins the flax properly, but again, you have a problem with Spinning function, which checks wheather it is spinning or not. You might want to change

Result := (AveragePixelShift(PBox, 250, 700) > 650);
//to something like
Result := (AveragePixelShift(PBox, 250, 1000) > 400);

And one recommendation I would like to give, your script is awesome but runs too fast, you might add Wait(Time:Integer) Procedures more often, most importantly when required.

Gucci

2012-04-27 00:14:54

Omg I love you. Yeah the picking is really rapid :) will release soon and your going to be in the credits ;)

johnbrown8976

2012-04-27 00:43:01

From: Gucci
Omg I love you. Yeah the picking is really rapid :) will release soon and your going to be in the credits ;)


Anytime bro, Always ready to help. One suggestion about Spinning Function:

Instead of checking the AveragePixel, which I find very difficult to master…
If I were you, I would do a easy job.

Count the following in inventory
1. "Amount of Flax" - It should decrease
2. "Amount of 'Bow String' - It should increase

CountItems('dtm',DTM,[]);

NCDS

2012-04-27 00:47:02

From: johnbrown8976
Yes I did,it Spins the flax properly, but again, you have a problem with Spinning function, which checks wheather it is spinning or not. You might want to change

Result := (AveragePixelShift(PBox, 250, 700) > 650);
//to something like
Result := (AveragePixelShift(PBox, 250, 1000) > 400);

And one recommendation I would like to give, your script is awesome but runs too fast, you might add Wait(Time:Integer) Procedures more often, most importantly when required.


From: Gucci
Omg I love you. Yeah the picking is really rapid :) will release soon and your going to be in the credits ;)

I might suggest testing that a bit. Might work fine, but pixelShift is generally something that can be ``finely tuned" to optimize performance. ;)

Gucci

2012-04-27 00:55:49

From: NCDS
I might suggest testing that a bit. Might work fine, but pixelShift is generally something that can be ``finely tuned" to optimize performance. ;)


K will look into it

@johnbrown I have it wait until not spinning or not finddtm(flax….