SRL Archive - OSR Help

Help...having trouble with a script, possible antileech?


beastmode92

2013-05-10 00:42:43

im new to this but i have been reading tutorials and SRL core references for hours.

if someone wouldn't mind helping me out with skype, raidcall, irc, or any instant chat that would be great.

idk if its how he writes his code but it doesn't work well at all



program FlaxSpinner;
{$DEFINE SMART8} // Uncomment for SMART
{$I SRL-OSR/SRL.simba}

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := ''; // Username
Pass := ''; // Password
Nick := ''; // Nickname (3-4 unique characters from name
Active := True; // Use this player (True/False)
Integers[0] := 4000; // Number of flax to spin
end;
{
with Players[1] do
begin
Name := ''; // Username
Pass := ''; // Password
Nick := ''; // Nickname (3-4 unique characters from name
Active := True; // Use this player (True/False)
Integers[0] := 1000; // Number of flax to spin
end;
}
end;

const VERSION = 0.90;
LVL_ERROR = 0;
LVL_BANK = 1;
LVL_SPIN = 2;
LOC_ERROR = 0;
LOC_STAIRS = 1;
LOC_BANK = 2;
LOC_SPIN = 3;
GOTO_START = 0;
GOTO_GOTFLAX = 1;
GOTO_GOTBOWSTRINGS = 2;
GOTO_ONLYDEPOSIT = 3;
GOTO_FLAXSPIN = 4;

var FlaxDTM, BowStringDTM, StairsDTM, BankDTM, SpinningWheelDTM, DoorDTM, JumpTo: Integer;

{ Null variables }
NullInt: Integer;
NullFloat: Extended;
NullTPA: TPointArray;
NullT2DEA: T2DExtendedArray;

label Start, GotFlax, GotBowStrings, OnlyDeposit, FlaxSpin;

function GetRemoteVersion: Extended;
begin
Result := StrToFloat(Trim(GetPage('removed link')));
end;

procedure AutoUpdate;
var NewData, OldData: String;
FileHandle: Integer;
RemoteVersion: Extended;
begin
RemoteVersion := GetRemoteVersion;
if (RemoteVersion <= VERSION) then begin
Writeln('Script version ' + FloatToStr(VERSION) + ' is up-to-date.');
exit;
end;
Writeln('Fetching version ' + FloatToStr(RemoteVersion) + ' from remote.');
NewData := Trim(GetPage('removed link'));
FileHandle := OpenFile(ScriptPath + ScriptFile, False);
ReadFileString(FileHandle, OldData, FileSize(FileHandle));
CloseFile(FileHandle);
FileHandle := RewriteFile(ScriptPath + ScriptFile, False);
try
WriteFileString(FileHandle, NewData);
except begin
Writeln('Error updating script from remote. Terminating script...');
CloseFile(FileHandle);
TerminateScript;
end;
end;
CloseFile(FileHandle);
Writeln('Script has been updated to version ' + FloatToStr(RemoteVersion) + ', please reload script.');
TerminateScript;
end;

procedure ProgressReport;
var I, Seconds: Integer;
BSPH: Extended;
begin
Seconds := (GetTimeRunning div 1000);
Writeln('+----------------------------------------------+');
Writeln('| Flax Spinner ver ' + Padr(FloatToStr(VERSION), 16) + '|');
Writeln('+----------------------------------------------+');
Writeln('| Time running: ' + Padr(TimeRunning, 31) + '|');
Writeln('+----------------------------------------------+');
for I := 0 to High(Players) do begin
if (Players[I].Integers[5] = 0) then begin
BSPH := 0.0;
end else begin
BSPH := ((((Players[I].Integers[5] * 1.0) div (Seconds * 1.0)) * 60.0) * 60.0);
end;
Writeln('| Player: ' + Padr(Players[I].Nick, 37) + '|');
Writeln('| - Trips made: ' + Padr(IntToStr(Players[I].Integers[4]), 30) + '|');
Writeln('| - Bow strings crafted: ' + Padr(IntToStr(Players[I].Integers[5]), 21) + '|');
Writeln('| - Bow strings per hour: ' + Padr(Format('%0.2f', [BSPH]), 20) + '|');
Writeln('+----------------------------------------------+');
end;
end;

procedure AntiBan;
begin
case RandomRange(1, 100) of
1, 12, 52: MMouse(Random(173), Random(271), 3, 3);
32, 41, 64: Wait(98 + Random(31));
92: PickUpMouse;
end;
end;

procedure CountBowStrings;
var I: Integer;
CurrentBox: TBox;
begin
for I := 1 to 28 do begin
CurrentBox := InvBox(I);
if (FindDTM(BowStringDTM, NullInt, NullInt, CurrentBox.x1, CurrentBox.y1, CurrentBox.x2, CurrentBox.y2)) then
Inc(Players[CurrentPlayer].Integers[5]);
end;
end;

function FindBlackChatMessageMulti(ChatMsg: TStringArray): Boolean;
var I: Integer;
begin
for I := 0 to High(ChatMsg) do begin
Result := (Pos(ChatMsg[I], GetChatBoxText(8, clMessage)) > 0);
if (Result) then
exit;
end;
end;

procedure SetupDTMs;
begin
FlaxDTM := DTMFromString('mFQEAAHic42VgYIgF4hAgjgbiFCBOAuJ4IA4F4nCoeBwQJwJxOhAnA3EgEPsCsRcU+0D5IPFgIA6D0iB+EBD7AzGDFQdD6LbdDOG79zNEHjgMpkFiyJgjjpeBww2obssOBg4vDgZdoDZSMSMZGAUAAD/wFqE=');
BowStringDTM := DTMFromString('mKgEAAHicnctBCkBQFIXhawN2YiGSlxTPSsx5A6X0XhGW61d3wPSe+ganzslFJGLFgoAZO07cuHAgYdPdu3GqRoVSe4MWHXp4DB/T6E0KvhaZ0T8P3oshBQ==');
StairsDTM := DTMFromString('mggAAAHicY2NgYGBmQAAQmw2I2YGYCYpZgZgFikEgQhGhHsSGYQ0gXxKKNZAwIw4MAQCyWgLn');
BankDTM := DTMFromString('mVAEAAHicE2BgYBADYmYGCBAAYhYgZgViDiBmg/KFgFgWiHWAWB2IxYGYCYjZofpUgVgXiA2A2ByIjYBYH4r1gFgRioWh5koCsSgQiwAxIyMjAy7gpwih3356C6dDfH3BGARA9Bfc2hm8sdBRUMwApRmhfiEXowMAFgwO5A==');
SpinningWheelDTM := DTMFromString('m5wEAAHicE2dgYJADYhYgZgVidiDmBGIuKBskBgOMQMwGleMHYiEgFoWKMQGxBJRtCcQ6QCwCxLxArAHE2lAxbShfHYgVoDRITB+IDYHYAIh1oeKqQCwJxJpQtgwQSyG5J8TXF0z7KUIwOhsf+PjuI178hRFidwAUo7Px4QACmBEaXrTAOAAA2z0jbw==');
DoorDTM := DTMFromString('mKgEAAHic42NgYGBkQABGErACEDsAsTUQmwGxNhBrALEqECtBzWMFYk4gFgViSSCWAeI0F2WGED8/MPZycWHI9VQF40x3CAaJ+bq7Mfh7ejIU+2mCMUiPCFAvOZgUPyFjVAAAXZMPEQ==');
end;

function GetLevel: Integer;
begin
Result := LVL_ERROR;
if (FindDTMsRotatedSE(BankDTM, NullTPA, MMX1, MMY1, MMX2, MMY2, -10.0, 10.0, 1.0, NullT2DEA)) then begin
Result := LVL_BANK;
end;
if (FindDTMsRotatedSE(SpinningWheelDTM, NullTPA, MMX1, MMY1, MMX2, MMY2, -10.0, 10.0, 1.0, NullT2DEA)) then begin
Result := LVL_SPIN;
end;
end;

function GetLocation: Integer;
var Points: TPointArray;
begin
Result := LOC_ERROR;
if (GetLevel = LVL_BANK) then
if (FindDTMsRotatedSE(BankDTM, Points, MMX1, MMY1, MMX2, MMY2, -10.0, 10.0, 1.0, NullT2DEA)) then begin
SortTPAFrom(Points, Point(645, 165));
if (Distance(Points[0].x, Points[0].y, MMCX, MMCY) <= 7) then
Result := LOC_BANK
else
Result := LOC_STAIRS;
end;
if (GetLevel = LVL_SPIN) then
if (FindDTMsRotatedSE(SpinningWheelDTM, Points, MMX1, MMY1, MMX2, MMY2, -10.0, 10.0, 1.0, NullT2DEA)) then begin
SortTPAFrom(Points, Point(645, 165));
if (Distance(Points[0].x, Points[0].y, MMCX, MMCY) <= 7) then
Result := LOC_SPIN
else
Result := LOC_STAIRS;
end;
end;

function OpenLumbridgeBank: Boolean;
var Colors: TPointArray;
GlassATPA: T2DPointArray;
MPoint: TPoint;
I, CTS: Integer;
begin
Result := False;
CTS := GetToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.11, 0.40);
FindColorsTolerance(Colors, 8624291, MSX1, MSY1, MSX2, MSY2, 10);
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.02, 0.02);
GlassATPA := TPAToATPAEx(Colors, 25, 8);
SortATPAFromFirstPoint(GlassATPA, Point(MSCX, MSCY));
for I := 0 to High(GlassATPA) do begin
MPoint := MiddleTPA(GlassATPA[I]);
MMouse(MPoint.x, MPoint.y, 2, 2);
ClickMouse2(Mouse_Right);
if (ChooseOptionMulti(['Bank', 'Ban', 'ank'])) then
break;
end;
repeat
Wait(250);
until(not IsMoving);
WaitFunc(@BankScreen, 250, 1500);
Result := BankScreen;
end;

procedure WalkTo(Location: String);
var DTM, Loc, WalkingMark, I, CTS: Integer;
Points: TPointArray;
PointsATPA: T2DPointArray;
CheckDoor: Boolean;
FlagPoint: TPoint;
begin
CheckDoor := False;
MarkTime(WalkingMark);
case Location of
'stairs': begin
DTM := StairsDTM;
Loc := LOC_STAIRS;
if (GetLevel = LVL_SPIN) then
CheckDoor := True;
CTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.19, 2.14);
if (FindColorsTolerance(Points, 468571, MMX1, MMY1, MMX2, MMY2, 25)) then begin
SetColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.02, 0.02);
PointsATPA := TPAToATPAEx(Points, 5, 8);
SortATPAFromFirstPoint(PointsATPA, Point(645, 165));
if (Distance(PointsATPA[0][0].x, PointsATPA[0][0].y, MMCX, MMCY) >= 10) then begin
MMouse(PointsATPA[0][0].x, PointsATPA[0][0].y, 1, 1);
ClickMouse2(Mouse_Left);
if (CheckDoor) then begin
FindFlag(FlagPoint);
if (not PointInBox(FlagPoint, IntToBox(Points[0].x - 5, Points[0].y - 5, Points[0].x + 5, Points[0].y + 5))) then begin
repeat
Wait(100);
until(not IsMoving) or (TimeFromMark(WalkingMark) >= 30000);
if (FindDTMsRotatedSE(DoorDTM, Points, MSCX - 140, MSCY - 140, MSCX + 140, MSCY + 140, -30.0, 30.0, 2.5, NullT2DEA)) then begin
SortTPAFrom(Points, Point(MSCX, MSCY));
for I := 0 to High(Points) do begin
MMouse(Points[I].x, Points[I].y, 0, 0);
if (IsUpTextMultiCustom(['Open Door', 'en Do', 'pen D'])) then begin
ClickMouse2(Mouse_Right);
ChooseOptionMulti(['Open', 'pen']);
repeat
Wait(250);
until(not IsMoving);
WalkTo(Location);
Exit;
end;
end;
end;
end;
end;
end;
repeat
Wait(100);
until(not IsMoving) or (TimeFromMark(WalkingMark) >= 30000);
if (not GetLocation = Loc) then begin
WalkTo(Location);
Exit;
end;
Exit;
end;
SetColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.02, 0.02);
end;
'bank': begin
DTM := BankDTM;
Loc := LOC_BANK;
end;
'wheel': begin
DTM := SpinningWheelDTM;
Loc := LOC_SPIN;
CheckDoor := True;
end;
end;
if (FindDTMsRotatedSE(DTM, Points, MMX1, MMY1, MMX2, MMY2, -22.5, 22.5, 0.5, NullT2DEA)) then begin
SortTPAFrom(Points, Point(645, 165));
if (Distance(Points[0].x, Points[0].y, MMCX, MMCY) >= 10) then begin
MMouse(Points[0].x, Points[0].y, 1, 1);
ClickMouse2(Mouse_Left);
if (CheckDoor) then begin
FindFlag(FlagPoint);
if (not PointInBox(FlagPoint, IntToBox(Points[0].x - 3, Points[0].y - 3, Points[0].x + 3, Points[0].y + 3))) then begin
repeat
Wait(100);
until(not IsMoving) or (TimeFromMark(WalkingMark) >= 30000);
if (FindDTMsRotatedSE(DoorDTM, Points, MSCX - 140, MSCY - 140, MSCX + 140, MSCY + 140, -30.0, 30.0, 2.5, NullT2DEA)) then begin
SortTPAFrom(Points, Point(MSCX, MSCY));
for I := 0 to High(Points) do begin
MMouse(Points[I].x, Points[I].y, 0, 0);
if (IsUpTextMultiCustom(['Open Door', 'en Do', 'pen D'])) then begin
ClickMouse2(Mouse_Right);
ChooseOptionMulti(['Open', 'pen']);
repeat
Wait(250);
until(not IsMoving);
WalkTo(Location);
Exit;
end;
end;
end;
end;
end;
end;
end else begin
Writeln('Error walking to ' + Location + '. Retrying...');
WalkTo(Location);
Exit;
end;
repeat
Wait(250);
until(not IsMoving) or (TimeFromMark(WalkingMark) >= 30000);
if (not GetLocation = Loc) then
WalkTo(Location);
end;

procedure Climb(Up: Boolean);
var Colors: TPointArray;
StairsATPA: T2DPointArray;
MPoint: TPoint;
Texts: T2DStringArray;
I, CTS, WaitTimer: Integer;
begin
MarkTime(WaitTimer);
SetArrayLength(Texts, 2);
case Up of
True: begin
Texts[0] := ['Climb-up', 'limb-u', 'up'];
Texts[1] := ['Climb', 'limb St', 'mb Stair'];
end;
False: begin
Texts[0] := ['Climb-down', 'limb-d', 'down'];
Texts[1] := ['Climb-down', 'limb-d', 'down'];
end;
end;
CTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.07, 1.16);
if (not FindColorsTolerance(Colors, 604501, MSX1, MSY1, MSX2, MSY2, 10)) then begin
Climb(Up);
Exit;
end;
SetColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.02, 0.02);
StairsATPA := TPAToATPAEx(Colors, 15, 15);
SortATPAFromFirstPoint(StairsATPA, Point(MSCX, MSCY + 20));
for I := 0 to High(StairsATPA) do begin
MPoint := MiddleTPA(StairsATPA[I]);
MMouse(MPoint.x, MPoint.y, 1, 1);
if (IsUpTextMultiCustom(Texts[1])) then begin
ClickMouse2(Mouse_Right);
if (ChooseOptionMulti(Texts[0])) then
break;
end;
end;
CTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.19, 2.14);
repeat
Wait(250);
until(FindColorsTolerance(NullTPA, 468571, MMX1, MMY1, MMX2, MMY2, 25)) or (TimeFromMark(WaitTimer) >= 3000);
SetColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.02, 0.02);
end;

function HaveFlax: Boolean;
begin
Result := (FindDTM(FlaxDTM, NullInt, NullInt, MIX1, MIY1, MIX2, MIY2));
end;

function HaveBowStrings: Boolean;
begin
Result := (FindDTM(BowStringDTM, NullInt, NullInt, MIX1, MIY1, MIX2, MIY2));
end;

procedure WithdrawFlax;
var ItemSlot: TPoint;
X, Y: Integer;
begin
if (HaveFlax) and (InvFull) then
exit;
if (not BankScreen) then begin
WaitFunc(@BankScreen, 100, 3000);
if (not OpenLumbridgeBank) then
OpenBankFast('lb');
end;
FixBank;
if (FindDTM(FlaxDTM, X, Y, MBX1, MBY1, MBX2, MBY2)) then begin
ItemSlot := MSTPointToBankPoint(Point(X, Y));
if (Withdraw(ItemSlot.x, ItemSlot.y, 0)) then
CloseBank;
end else begin
NextPlayer(False);
end;
CloseBank;
end;

procedure DepositBowStrings;
var X, Y: Integer;
begin
if (not HaveBowStrings) then
exit;
if (FindDTM(BowStringDTM, X, Y, MIX1, MIY1, MIX2, MIY2)) then begin
if (not BankScreen) then begin
if (not OpenLumbridgeBank) then
if (not OpenBankFast('lb')) then begin
Writeln('Error finding and opening bank, reset.');
WalkTo('bank');
DepositBowStrings;
Exit;
end;
end;
MMouse(X, Y, 2, 2);
CountBowStrings;
ClickMouse2(Mouse_Right);
if (WaitOptionMultiEx(['Store All', 're A','All','ll '], 'All', Nothing, 600)) then
ChooseOptionMulti(['Store All', 're A','All','ll ']);
Inc(Players[CurrentPlayer].Integers[4]);
end;
end;

procedure SpinFlax(SkipLevelUp: Boolean);
var WhiteColors, BrownColors: TPointArray;
WheelATPA: T2DPointArray;
MPoint: TPoint;
CTS, I, SpinningMark, X, Y: Integer;
begin
if (not HaveFlax) then
exit;
MarkTime(SpinningMark);
CTS := GetToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.27, 1.77);
FindColorsTolerance(WhiteColors, 4680632, MSX1, MSY1, MSX2, MSY2, 21);
SetColorSpeed2Modifiers(0.04, 0.33);
FindColorsTolerance(BrownColors, 1138058, MSX1, MSY1, MSX2, MSY2, 10);
SetColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.02, 0.02);
WhiteColors := CombineTPA(WhiteColors, BrownColors);
WheelATPA := TPAToATPAEx(WhiteColors, 15, 20);
FindDTMRotatedSE(SpinningWheelDTM, X, Y, MMX1, MMY1, MMX2, MMY2, -15.0, 15.0, 0.5, NullFloat);
SortATPAFromFirstPoint(WheelATPA, MMToMS(Point(X - 4, Y + 9)));
for I := 0 to High(WheelATPA) do begin
MPoint := MiddleTPA(WheelATPA[I]);
MMouse(MPoint.x, MPoint.y, 1, 1);
if (IsUpTextMultiCustom(['Spin', 'pin ', 'pin S', 'Spinning wheel', 'ning whe'])) then begin
ClickMouse2(Mouse_Right);
if (ChooseOptionMulti(['Spin', 'Spi', 'pin'])) then begin
Wait(RandomRange(1450, 1950));
MMouse(259, 110, 2, 2);
ClickMouse2(Mouse_Right);
ChooseOptionMulti(['Make X', 'ake X', ' X']);
Wait(RandomRange(500, 750));
Wait(350 + Random(100));
TypeSendEx('9999', False);
TypeSend('');
repeat
if (FindBlackChatMessageMulti(['I can', 't reach that', 'ch that'])) then
Break;
Wait(250);
AntiBan;
if (FindNormalRandoms) then begin
SpinFlax(SkipLevelUp);
exit;
end;
if (not SkipLevelUp) then
if (LevelUp) then begin
SpinFlax(True);
exit;
end;
until(FindBlackChatMessageMulti(['out of flax', 't of f', 'f flax', 'run out of'])) or (not HaveFlax) or (TimeFromMark(SpinningMark) >= 90000);
break;
end;
end;
end;
end;

function ResetPlayer: Integer;
begin
if (GetLevel = LVL_BANK) then
if (HaveFlax) and (not HaveBowStrings) then begin
Result := GOTO_GOTFLAX;
exit;
end else if (HaveBowStrings) then begin
Result := GOTO_ONLYDEPOSIT;
exit;
end;
if (GetLevel = LVL_SPIN) then
if (HaveBowStrings) then begin
Result := GOTO_GOTBOWSTRINGS;
exit;
end else if (HaveFlax) then begin
Result := GOTO_FLAXSPIN;
exit;
end;
Result := GOTO_START;
if (GetLevel = LVL_ERROR) or (GetLocation = LOC_ERROR) then begin
NextPlayer(False);
end;
end;

procedure EndScript;
begin
ProgressReport;
FreeDTMs([FlaxDTM, BowStringDTM, StairsDTM, BankDTM, SpinningWheelDTM, DoorDTM]);
end;

begin
{$IFDEF SMART}
SMART_FixSpeed := True;
{$ENDIF}
DeclarePlayers;
SetupSRL;
SRL_CombatRandoms := False;
ActivateClient;
AutoUpdate;
SetupDTMs;
AddOnTerminate('EndScript');

repeat
repeat
if (not LoggedIn) then
LoginPlayer;
SetAngle(SRL_ANGLE_HIGH);
MakeCompass('N');
JumpTo := ResetPlayer;
if (JumpTo = GOTO_START) then
goto Start;
if (JumpTo = GOTO_GOTFLAX) then
goto GotFlax;
if (JumpTo = GOTO_FLAXSPIN) then
goto FlaxSpin;
if (JumpTo = GOTO_GOTBOWSTRINGS) then
goto GotBowStrings;
if (JumpTo = GOTO_ONLYDEPOSIT) then
goto OnlyDeposit;
Start:
WithdrawFlax;
GotFlax:
WalkTo('stairs');
Climb(False);
FlaxSpin:
WalkTo('wheel');
SpinFlax(False);
GotBowStrings:
WalkTo('stairs');
Climb(True);
OnlyDeposit:
WalkTo('bank');
DepositBowStrings;
ProgressReport;
until(Players[CurrentPlayer].Integers[5] >= Players[CurrentPlayer].Integers[0]);
NextPlayer(False);
ProgressReport;
until(AllPlayersInactive);

ProgressReport;
LogOut;
end.

Neznam

2013-05-10 01:10:04

What seems to be the problem? Anti leech should have been removed by now from all scripts. This could be broken.
Perhaps it's an error you are getting so it would be best to post it so we can help you accordingly.

beastmode92

2013-05-10 01:44:37

well it was typing 9999 into the chat
TypeSendEx('9999', False);
so i changed it to true