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:
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.