PDA

View Full Version : Unknown declaration help



i am boo
11-13-2014, 12:33 PM
Why am i getting this error,

Error: Unknown declaration "HowManyPlayers" at line 31
Compiling failed.


i am remastering my friends outdated by a few months script for flaxing and i have no clue

riwu
11-13-2014, 12:36 PM
what include are u using?
HowManyPlayers is only declared in the srl5 and osrs include

i am boo
11-13-2014, 12:39 PM
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do

riwu
11-13-2014, 12:42 PM
what do u think 'include' means?
nvm post the entire script...

i am boo
11-13-2014, 12:45 PM
lol ok
sorry i am pretty new to scripting


program boosFlaxSpinner;
//{$DEFINE SMART} // Uncomment for SMART
{$DEFINE SMART}
{$I SRL-6/SRL.Simba}
{$i srl-6/lib/misc/srlplayerform.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] := 10000; // 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.79;
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, JumpTo: Integer;

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

label Start, GotFlax, GotBowStrings, OnlyDeposit, FlaxSpin;

function GetRemoteVersion: Extended;
begin
Result := StrToFloat(Trim(GetPage('http://static.frement.net/srl/flaxspinner/version')));
end;

procedure AutoUpdate;
var NewData, OldData, AccountCredentials: String;
FileHandle: Integer;
begin
if (GetRemoteVersion <= VERSION) then begin
Writeln('Script version ' + FloatToStr(VERSION) + ' is up-to-date.');
exit;
end;
NewData := Trim(GetPage('http://static.frement.net/srl/flaxspinner/data'));
FileHandle := OpenFile(ScriptPath + 'FlaxSpinner.simba', False);
ReadFileString(FileHandle, OldData, FileSize(FileHandle));
CloseFile(FileHandle);
AccountCredentials := Trim(Between('{$I SRL-OSR/SRL.simba}', 'const VERSION = ' + FloatToStr(VERSION) + ';', OldData));
NewData := ReplaceWrap(NewData, '{%DECLARE_PLAYERS%}', AccountCredentials, []);
FileHandle := RewriteFile(ScriptPath + 'FlaxSpinner.simba', 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(GetRemoteVersion) + ', please reload script.');
TerminateScript;
end;

procedure ProgressReport;
var I: Integer;
begin
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
Writeln('| Player: ' + Padr(Players[CurrentPlayer].Nick, 37) + '|');
Writeln('| - Trips made: ' + Padr(IntToStr(Players[CurrentPlayer].Integers[4]), 30) + '|');
Writeln('| - Bow strings crafted: ' + Padr(IntToStr(Players[CurrentPlayer].Integers[5]), 21) + '|');
Writeln('+----------------------------------------------+');
end;
end;

procedure AntiBan;
begin
case RandomRange(1, 20) of
1, 5, 12: MMouse(Random(173), Random(271), 3, 3);
3, 4, 16: Wait(98 + Random(31));
9: PickUpMouse;
19: RandomRClick;
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('mFQEAAHic42VgYIgF4hAgjgbiFCBOAuJ4IA 4F4nCoeBwQJwJxOhAnA3EgEPsCsRcU+0D5IPFgIA6D0iB+EBD7 AzGDFQdD6LbdDOG79zNEHjgMpkFiyJgjjpeBww2obssOBg4vDg ZdoDZSMSMZGAUAAD/wFqE=');
BowStringDTM := DTMFromString('mKgEAAHicnctBCkBQFIXhawN2YiGSlxTPSs x5A6X0XhGW61d3wPSe+ganzslFJGLFgoAZO07cuHAgYdPdu3Gq RoVSe4MWHXp4DB/T6E0KvhaZ0T8P3oshBQ==');
StairsDTM := DTMFromString('mggAAAHicY2NgYGBmQAAQmw2I2YGYCYpZgZ gFikEgQhGhHsSGYQ0gXxKKNZAwIw4MAQCyWgLn');
BankDTM := DTMFromString('mVAEAAHicnc/BCoJQEIXhuWnpUtQSFwoikQu1cONT6Mr3fwM34QP03xxCojYe+ DjcCzMwgYhc4MiaAC6O8HHSd4gMNW5IcICnc1c0eKBHh7tqUah I96Y4I4YxRv5lLNaen/Onp2F4s7G9MJ7Lb5V2uelq82/b6C17fecFL5gO6Q==');
SpinningWheelDTM := DTMFromString('m5wEAAHicE2dgYJADYhYgZgVidiDmBGIuKB skBgOMQMwGleMHYiEgFoWKMQGxBJRtCcQ6QCwCxLxArAHE2lAx bShfHYgVoDRITB+IDYHYAIh1oeKqQCwJxJpQtgwQSyG5J8TXF0 z7KUIwOhsf+PjuI178hRFitxEUo7PxYTcCmBEaXrTAOAAAWCUi pw==');
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: Integer;
begin
Result := False;
FindColorsTolerance(Colors, 8624291, MSX1, MSY1, MSX2, MSY2, 10);
GlassATPA := TPAToATPAEx(Colors, 25, 8);
SortATPAFrom(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;
WaitFunc(@BankScreen, 250, 1250);
Result := BankScreen;
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, 500, 2500);
if (not OpenLumbridgeBank) then
OpenBankFast('lb');
end;
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
NextPlayer(False);
CloseBank;
end;

procedure DepositBowStrings;
var X, Y: Integer;
begin
if (not HaveBowStrings) then
exit;
CountBowStrings;
Inc(Players[CurrentPlayer].Integers[4]);
if (FindDTM(BowStringDTM, X, Y, MIX1, MIY1, MIX2, MIY2)) then begin
if (not BankScreen) then begin
WaitFunc(@BankScreen, 500, 2500);
if (not OpenLumbridgeBank) then
OpenBankFast('lb');
end;
MMouse(X, Y, 2, 2);
ClickMouse2(Mouse_Right);
if (WaitOptionMultiEx(['Store All', 're A','All','ll '], 'All', Nothing, 600)) then
ChooseOptionMulti(['Store All', 're A','All','ll ']);
end;
end;

procedure WalkTo(Location: String);
var DTM, Loc, WalkingMark: Integer;
Points: TPointArray;
begin
MarkTime(WalkingMark);
case Location of
'stairs': begin
DTM := StairsDTM;
Loc := LOC_STAIRS;
end;
'bank': begin
DTM := BankDTM;
Loc := LOC_BANK;
end;
'wheel': begin
DTM := SpinningWheelDTM;
Loc := LOC_SPIN;
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) >= 15) then begin
MMouse(Points[0].x, Points[0].y, 1, 1);
ClickMouse2(Mouse_Left);
end;
end else begin
Writeln('Error walking to ' + Location + '. Terminating script.');
TerminateScript;
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: TStringArray;
I: Integer;
begin
case Up of
True: Texts := ['Climb-up', 'limb-u', 'up'];
False: Texts := ['Climb-down', 'limb-d', 'down'];
end;
FindColorsTolerance(Colors, 537162, MSX1, MSY1, MSX2, MSY2, 20);
StairsATPA := TPAToATPAEx(Colors, 15, 15);
SortATPAFromFirstPoint(StairsATPA, Point(MSCX, MSCY));
for I := 0 to High(StairsATPA) do begin
MPoint := MiddleTPA(StairsATPA[I]);
MMouse(MPoint.x, MPoint.y, 1, 1);
ClickMouse2(Mouse_Right);
if (ChooseOptionMulti(Texts)) then
break;
end;
Wait(1500);
end;

procedure SpinFlax(SkipLevelUp: Boolean);
var Colors: TPointArray;
WheelATPA: T2DPointArray;
MPoint: TPoint;
I, SpinningMark: Integer;
begin
if (not HaveFlax) then
exit;
MarkTime(SpinningMark);
FindColorsTolerance(Colors, 14342879, MSX1, MSY1, MSX2, MSY2, 20);
WheelATPA := TPAToATPAEx(Colors, 5, 5);
SortATPAFromFirstPoint(WheelATPA, Point(MSCX, MSCY));
for I := 0 to High(WheelATPA) do begin
MPoint := MiddleTPA(WheelATPA[I]);
MMouse(MPoint.x, MPoint.y, 1, 1);
ClickMouse2(Mouse_Right);
if (ChooseOptionMulti(['Spin', 'Spi', 'pin'])) then begin
Wait(RandomRange(1250, 1750));
MMouse(259, 110, 2, 2);
ClickMouse2(Mouse_Right);
ChooseOptionMulti(['Make X', 'ake X', ' X']);
Wait(RandomRange(500, 750));
TypeSendEx('9999', False);
TypeSend('');
repeat
Wait(250);
AntiBan;
FindNormalRandoms;
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 (TimeFromMark(SpinningMark) >= 90000);
break;
end;
end;
Wait(1500);
end;

function ResetPlayer: Integer;
begin
if (GetLevel = LVL_BANK) then
if (HaveFlax) 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
NextPlayer(False);
end;

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

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

repeat
repeat
ProgressReport;
if (not LoggedIn) then
LoginPlayer;
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);
until(AllPlayersInactive);

ProgressReport;
LogOut;
end.

i am boo
11-13-2014, 12:48 PM
http://pastebin.com/SYC4GvXW