SRL Archive - Help and Support

Variable Expected


Naum

2009-05-22 19:07:03

Puzzled me alot :(


Line 1: [Error] (1:1): Variable Expected in script C:\Documents and Settings\Nauman\Desktop\Cow Hide Banker.scar


program New;
{.Include Srl/Srl.Scar}
{.Include Srl/Srl/Misc/DoorProfiles.Scar}

Var x, y, GateColor, XpGained : Integer;
Hides, Banked : Integer;
MR : Boolean;

Procedure N(Term : String);
Begin
WriteLn(Term);
If LoggedIn Then LogOut;
NextPlayer(False);
End;

function PlayersOnMap2(xx1, yy1, xx2, yy2 : integer) : integer;
var
P : TPointArray;
begin
If FindColorsTolerance(P, 16711422, xx1, yy1, xx2, yy2, 18 + ((1/2)*2)) Then //tol not need
RAaSTPA(P, 4);
Result := High(P);
end;

Procedure AntiBan;
Var I : Byte;
Begin
Case Random(15) Of
0 : Begin
GameTab(1 + Random(11));
Wait(200 + Random(400));
If Random(2) = 1 Then
Begin
GameTab(1 + Random(11));
Wait(200 + Random(400));
End Else
GameTab(4 + Random(3));
End;

1, 10..13 : SleepAndMoveMouse(1000 + Random(200));

2 : PickUpMouse;

3 : for i := 1 to (3 + Random(4)) do //From BoredHuman;
begin
MMouse(Random(MSX2), Random(MSY2), 0, 0);
if IsUpText('opti') then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
ChooseOption('Examine');
end;
FindNormalRandoms;
end;

4 : If PlayersOnMap2(MMX1, MMY1, MMX2, MMY2) >= 1 Then
Case Random(9) Of
0 : TypeSend(AddMistakes('Soo Boring..', 20));
1 : TypeSend(AddMistakes('laddeda', 20));
2 : TypeSend(AddMistakes('hello ppz', 20));
3 : TypeSend(AddMistakes('.', 20));
4 : TypeSend(AddMistakes('More cowhides', 20));
5 : If PlayersOnMap2(MMX1, MMY1, MMX2, MMY2) >= 1 Then
TypeSend(AddMistakes('Hey!', 20));
6 : TypeSend(AddMistakes('ll', 20));
7 : TypeSend(AddMistakes('ahah!', 20));
8 : TypeSend(AddMistakes('i got loads of hides', 20));
{ 9 : Begin
If PlayersOnMap2(MMX1, MMY1, MMX2, MMY2) >- 1 Then
TypeSend(AddMistakes('How Many cowhides you got?', 20));
If (Length(GetChatBoxText(8, clChat)) =< 10) Then
TypeSend(AddMistakes('kkll', 20)));
End;
End; }

5 : If Random(2) = 1 Then
SetRun(True);
End;
End;
End;

function LinearWalkX(TheColor: Integer; Direction: Integer; Radius: Integer; Xmod, Ymod: Integer): Boolean;
var
tpa: TPointArray;
i: Integer;
begin
Result := False;
if LinearWalkEx(tpa, MMCX, MMCY, TheColor, 0, Direction, Radius) then
for i := 0 to High(tpa) do
if MFNF(tpa[i].x - 10, tpa[i].y, Xmod, Ymod) then
begin
Wait(2000 + Random(1000));
FFlag(10);
Result := True;
Break;
end;
end;

Function FindGate_MM : Boolean;
Var TPA : Array Of TPoint;
P : TPoint;
Begin
FindColorsSpiralTolerance(MMCX, MMCY, TPA, 238, MMX1, MMY1, MMX2, MMY2, 15)
SplitTPA(TPA, 10)
FilterPointsPie(TPA, -10.0, 50.0, 10.0, 50.0, MMCX, MMCY);
FilterDropDots(TPA);
P := MiddleTPA(TPA);
GateColor := GetColor(P.x, P.y);
Result := (GateColor > 0)
If Result Then MouseFlag(P.x, P.y + 5, 2, 2, 0);
End;

Function OpenGate : Boolean;
Label Cont;
Var TPA : Array Of TPoint;
ATPA : T2DPointArray;
I : Integer;
Arr : TIntegerArray;
Begin
Arr := [4808813, 1844522, 3030084];
MouseSpeed := 25;
For I := 0 To High(Arr) Do
FindColorsSpiralTolerance(MMCX, MMCY, TPA, Arr[I], MSX1, MSY1, MSX2, MSY2, 10);
If Length(TPA) > 0 Then
Begin
ATPA := TPAtoATPAEx(TPA, 60, 25);
//InvertATPA(ATPA);
For I := 0 To High(ATPA) Do
If MiddleTPAEx(ATPA[I], x, y) Then
Begin
MMouse(x, y, 0, 0);
Wait(190 + Random(10));
If IsUpText('pen') Then
Begin
MouseFlag(x, y, 0, 0, 0);
GoTo Cont;
End Else
Begin
If IsUpText('lose') Then GoTo Cont;
If Not IsUpText('lose') Or Not IsUpText('pen') Then
Result := False
Else
Begin
Cont :
Result := True;
MouseSpeed := 15;
Exit;
End;
End;
End;
End;
End;


Function FindCow : Boolean;
Var TPA : Array Of TPoint;
Arr : TIntegerArray;
I : Integer;
ATPA : T2DPointArray;
Begin
MouseSpeed := 25;
Arr := [9541533, 7111584];
For I := 0 To High(Arr) Do
If FindColorsTolerance(TPA, Arr[I], MSX1, MSY1, MSX2, MSY2, 30) Then
Wait(1);
If Length(TPA) > 0 Then
Begin
ATPA := TPAtoATPAEx(TPA, 5, 5);
For I := 0 To High(ATPA) Do
If MiddleTPAEx(ATPA[I], x, y) Then
Begin
MMouse(x, y, 0, 0);
Wait(90 + Random(10));
If IsUpText('ilk') Then
Begin
InvertATPA(ATPA);
If Random(4) = 1 Then
Begin
WriteLn('TPA Finding mucking up becuase of Milk Cow');
WriteLn('Randomly Relocating');
MouseFlag(MMCX + 7, MMCY + 10, 20, 20, 0);
Result := False;
Break;
End;
MR := False;
End Else
If IsUpText('Cow') Then
Begin
GetMousePos(x, y);
Result := True;
MR := True;
MouseSpeed := 15;
Exit;
End;
End;
MouseSpeed := 15;
End;
Result := False;
MR := False;
End;

Procedure WalkToCows;
Label gg;
Begin
GoTo GG;
GG :
If Not LinearWalkX(FindWaterColor, 20, 60, 0, 0) Then
If Not LinearWalkX(FindWaterColor, 25, 65, -2, 3) Then
N('Lost Walk [1] in WalkToCows')
Else
FFlag(0);

If Not LinearWalk(FindFallyRoadColor, 0, 65, 0, 0) Then
If Not LinearWalk(FindFallyRoadColor, 5, 66, 3, 4) Then
N('Lost Walk [2] in WalkToCows')
Else
FFlag(0);

If Not LinearWalk(FindRoadColor, 0, 30 + Random(30), 0, 0) Then
If Not LinearWalk(FindRoadColor, 5, 40 + Random(10), 0, 0) Then
N('Lost Walk [3] in WalkToCows')
Else
FFlag(0);
Begin
If Not FindSymbolIn(x, y, 'tree', 538, 22, 643, 162) Then
Begin
If MFF(569, 93, 10, 10) Then
Wait(800 + Random(801));
If Not FlagPresent Then
N('Lost FailSafe [1] in WalkToCows')
End Else
MouseFlag(x - 10, y, 0, 0, 0);
If Not IsMoving(1000) Then
N('Lost Symbol [1] in WalkToCows - Failsafe[1]')
Else
Wait(1);
End;

If Not FindGate_MM Then N('Could not find Gate in FindGate_MM') Else
Begin
If OpenGate Then
Begin
MouseFlag(MMCX, MMCY - RandomRange(15, 45), 5, 5, 0)
WriteLn('We Are at The Cow Area');
End Else
If Not FindCow Then
N('Could not find Gate in FindGate_MM');

Exit;
End;
Wait(1);
End;

Function InFight2 : Boolean; //Modded by me
Var C, G, R : TPointArray;
Begin
FindColorsTolerance(G, 65280, MSCX - 70, MSCY - 70, MSCX + 70, MSCY + 70, 0);
FindColorsTolerance(R, 255, MSCX - 70, MSCY - 70, MSCX + 70, MSCY + 70, 0);
If High(Length(G) + Length(R)) > 0 Then
Begin
G := RemovePointsInBox(G, IntToBox(233, 134, 282, 172));
R := RemovePointsInBox(R, IntToBox(233, 134, 282, 172));
End;
C := CombineTPA(G, R)
Result := (Length(TPAToATPAEx(C, 31, 5)) > 0);
End;
Function PickUpHide : Boolean;
Var TPA : TPointArray;
P : TPoint;
Begin
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 12171971, MSCX - 50, MSCY - 50, MSCX + 50, MSCY + 50, 8);
If Length(TPA) = 0 Then FindColorsSpiralTolerance(MSCX, MSCY, TPA, 12171971, MSCX - 150, MSCY - 150, MSCX + 150, MSCY + 150, 11);
If Length(TPA) > 0 Then
Begin
P := MiddleTPA(TPA);
MMouse(P.x, P.y, 0, 0);
If IsUpText('eef') Then
Mouse(P.x, P.y, 0, 0, False);
Result := ChooseOption('Take Cowhide');
Wait(3000 + Random(1500));
End;
End;

Procedure GetCowHides; //Built On Labels :p
Label Lol, Lolx, Loly;
Var TPA : TPointArray;
IMark, I : Integer;
Begin
Repeat
Lol :
If Not FindCow Then GoTo Loly Else
Begin
Case Random(3) Of
0, 2 : Mouse(x, y, 0, 0, True);
1 : Begin
Mouse(x, y, 0, 0, False);
Wait(200 + Random(400));
ChooseOption('tack');
End;
End;
End;


If Not FindChatBoxText('ighting', 8, 0) Then
GoTo Lolx
Else
GoTo Loly;

If Not MR Then
Begin
Begin
Loly :
If FindObj(x, y, 'acks', 1143694, 15) Then
MouseFlag(MMCX - 20, MMCY + 17, 5, 5, 0)
Else
If FindColorsTolerance(TPA, 62965, MMX1, MMY1, MMX2, MMY2, 2) Then
For I := 0 to High(TPA) Do
If PointInBox(TPA[I], IntToBox(MMCX - (I*5), MMCY - (I*5), MMCX + (I*5), MMCY + (I*5))) Then
Begin
MouseFlag(TPA[I].x, TPA[I].y, 3, 3, 0);
Break;
End;
End;
GoTo Lol;
End;

Lolx :
Begin
MarkTime(IMark);
Repeat
Wait(500 + Random(300));
AntiBan;
Until(Not (InFight2)) Or (TimeFromMark(IMark) > 10000);
End;
If PickUpHide Then Inc(Hides);
XpGained := Round(XpGained + 4.375);
Until(InvFull) xOr (Not(LoggedIn));
If Not LoggedIn Then N('Not Logged In..');
End;

Function FindBankers : Boolean;
Label Cont;
Var TPA : TPointArray;
P : TPoint;
Begin
If FindColorsTolerance(TPA, 62965, MMX1, MMY1, MMX2, MMY2, 2) Then
Begin
If Not Length(TPA) > 0 Then GoTo Cont Else
SplitTPA(TPA, 2);
P := MiddleTPA(TPA);
ReArrangeandShortenArray(TPA, 1); //Incase more than 1 point[s]
Result := True;
MouseFlag(P.x - Random(10), P.y + 8, 0, 5, 2);
Exit;
End;

Cont :
Begin
If FindSymbol(x, y, 'bank') Then
Begin
WriteLn('Trying Failsafe [1]');
Mouse(x, y, 2, 3, True)
Result := IsMoving(1000);
FFlag(0);
Exit;
End Else
Begin
WriteLn('Trying Failsafe [2]');
MouseFlag(MMCX - 30, MMCY, 5, 5, 0);
Result := True;
Exit;
End;
End;
End;

Procedure Bank;
Label ll;
Label Ben;
Var TPA, TPA2 : TPointArray;
ATPA : Array Of Array Of TPoint;
Box : TBox;
Begin
Ben :
FindColorsSpiralTolerance(TPA, 238, MMCX - 80, MMCY, 731, 165, 15);
Begin
FilterDropDots(TPA);
SortCircleWise(TPA, MMCX, MMCY, 10, False, False);
ATPA := TPAToATPAEx(TPA, 3, 1);
{}InvertATPA(ATPA);{} //TPA's Bloody Awesome!
If MiddleTPAEx(ATPA[0], x, y) Then
MouseFlag(x - 3, y + 4, 5, 2, 2);

FindSymbols(TPA2, 'tree')
If Not Length(TPA2) = 2 Then
Begin
Mouse(560, 92, 10, 10, True);
FFlag(0);
GoTo Ben;
End;
End;

If Not OpenGate Then N('Couldnt Open Gate in Bank');
If Not FindSymbolIn(x, y, 'tree', 627, 1, 714, 169) Then
N('Lost Walk [1] in Bank')
Else
Begin
Mouse(x + 20, y, 5, 5, True);
Wait(5000 + Random(3000));
FFlag(0);
End;
Begin
If FindColorsTolerance(TPA, FindFallyRoadColor, MMX1, MMY1, MMX2, MMY2, 0) Then
Begin
RAaSTPA(TPA, 90); //Points Clashed, so I went for higher density
Box := GetTPABounds(TPA);
MouseBox(Box.x1 + (7 + Random(3)), Box.y1 + (7 - Random(3)), Box.x2 - 2, Box.y2 - 3, 1);
End Else
If Not LinearWalk(FindFallyRoadColor, 130, 70, -2, 3) Then
N('Lost Walk [2] in Bank')
Else
FFlag(0);

Begin
If Not CountColor(FindWaterColor, MMX1, MMY1, MMX2, MMY2) > 10 Then
N('Lost in Bank')
Else
Begin
If Not LinearWalk(FindFallyRoadColor, 160, 70, 0, 0) Then
If Not LinearWalk(FindWaterColor, 165, 72, 0, 0) Then
N('Lost Walk [3] in Bank')
Else
FFlag(0);

If Not LinearWalk(FindFallyRoadColor, 180, 73, 0, 0) Then
If Not LinearWalk(FindFallyRoadColor, 176, 72, 0, 0) Then
N('Lost Walk [4] in Bank')
Else
FFlag(0);

If Not FindBankers Then
N('Lost In Finding, in FindBankers')
Else
If OpenBankFast('feb') Then
If PinScreen Then
//InPin();
If BankScreen Then
Begin
ll :
MMouseItem(1 + Random(20));
Wait(80 + Random(80));
If Not IsUpText('ide') Then GoTo ll Else
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
Wait(80 + Random(80));
If ChooseOption('ll') Then
Wait(800 + Random(800));
End;
If CloseBank Then
Inc(Banked);
End;
End;
End;
End;


begin
SetupSRL;
MakeCompass('S');
//WalkToCows;
//GetCowHides;
Bank;
end.

marpis

2009-05-22 20:20:46

ehh wierd :P is some of your variables coincidently a premade const in srl or scar?

Cazax

2009-05-22 20:25:57

Banked is already in SRL. And btw I'm also making a cow killer :p

Naum

2009-05-23 00:03:36

I know but that isn't the problem, @ Cazax good luck :)

Dynamite

2009-05-23 00:08:05

LOL so is ~RM!!! :p
I think

T~M

Naum

2009-05-23 00:10:26

Well may the best man/woman win :D.

Any light on the problem, recent threads suggest its because im using a variable as a const in a procedure but this only came up once I added in FindSymbols and DoorProfiles :)

Sir R. M8gic1an

2009-05-23 00:47:24

From: The Man
LOL so is ~RM!!! :p
I think

T~M


indeed I am… but unfortunately I do not have the time to finish it. But so far it slaughters cows quite well.

~RM

Da 0wner

2009-05-23 00:48:22

Noob don't use labels :p.

Edit: Narrowed it down to your bank procedure. That causes the problem.

Shuttleu

2009-05-23 03:04:11

i got this erro rbefore but i cant remember how i got rid of it :/
i will think about it and if i remember i shall let you know

~shut

Naum

2009-05-23 10:26:00

@Da0wner, Once I know that procedure works I'll add a few failsafes to my Labels :).
Thanks shut :). Hope you find out soon

nielsie95

2009-05-23 11:28:07

You're missing two params:

FindColorsSpiralTolerance(MMCX, MMCY, TPA, 238, MMCX - 80, MMCY, 731, 165, 15);

Da 0wner

2009-05-23 11:33:10

Procedure Bank;
Label ll;
Label Ben;
Var TPA, TPA2 : TPointArray;
ATPA : Array Of Array Of TPoint;
Box : TBox;
Begin
Ben :
FindColorsSpiralTolerance(MMCX, MMCY, TPA, 238, MMCX - 80, MMCY, 731, 165, 15);
Begin
FilterDropDots(TPA);
SortCircleWise(TPA, MMCX, MMCY, 10, False, False);
ATPA := TPAToATPAEx(TPA, 3, 1);
{}InvertATPA(ATPA);{} //TPA's Bloody Awesome!
If MiddleTPAEx(ATPA[0], x, y) Then
MouseFlag(x - 3, y + 4, 5, 2, 2);

FindSymbols(TPA2, 'tree')
If Not Length(TPA2) = 2 Then
Begin
Mouse(560, 92, 10, 10, True);
FFlag(0);
GoTo Ben;
End;
End;

If Not OpenGate Then N('Couldnt Open Gate in Bank');
If Not FindSymbolIn(x, y, 'tree', 627, 1, 714, 169) Then
N('Lost Walk [1] in Bank')
Else
Begin
Mouse(x + 20, y, 5, 5, True);
Wait(5000 + Random(3000));
FFlag(0);
End;
Begin
If FindColorsTolerance(TPA, FindFallyRoadColor, MMX1, MMY1, MMX2, MMY2, 0) Then
Begin
RAaSTPA(TPA, 90); //Points Clashed, so I went for higher density
Box := GetTPABounds(TPA);
MouseBox(Box.x1 + (7 + Random(3)), Box.y1 + (7 - Random(3)), Box.x2 - 2, Box.y2 - 3, 1);
End Else
If Not LinearWalk(FindFallyRoadColor, 130, 70, -2, 3) Then
N('Lost Walk [2] in Bank')
Else
FFlag(0);

Begin
If Not CountColor(FindWaterColor, MMX1, MMY1, MMX2, MMY2) > 10 Then
N('Lost in Bank')
Else
Begin
If Not LinearWalk(FindFallyRoadColor, 160, 70, 0, 0) Then
If Not LinearWalk(FindWaterColor, 165, 72, 0, 0) Then
N('Lost Walk [3] in Bank')
Else
FFlag(0);

If Not LinearWalk(FindFallyRoadColor, 180, 73, 0, 0) Then
If Not LinearWalk(FindFallyRoadColor, 176, 72, 0, 0) Then
N('Lost Walk [4] in Bank')
Else
FFlag(0);

If Not FindBankers Then
N('Lost In Finding, in FindBankers')
Else
If OpenBankFast('feb') Then
If PinScreen Then
//InPin();
If BankScreen Then
Begin
ll :
MMouseItem(1 + Random(20));
Wait(80 + Random(80));
If Not IsUpText('ide') Then GoTo ll Else
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
Wait(80 + Random(80));
If ChooseOption('ll') Then
Wait(800 + Random(800));
End;
If CloseBank Then
Inc(Banked);
End;
End;
End;
End;

:o, how could I not find that? I didn't even look at the procedure though, was just commenting out each one until the error appeared.

Naum

2009-05-23 13:29:23

Yeah, should have known :)

Works good, thx niels!