SRL Archive - General

Variable Expected at line 0


pigggy

2012-03-25 16:32:14

ive searched this everywhere but still couldnt find a way to fix it. This is my script,
program fallytabs;
{$i srl/srl/misc/smart.simba}
{$i srl/srl.simba}
{$i srl/srl/misc/online.simba}
{$i SRL/SRL/misc/paintsmart.simba}


const
//////////////////////////////////////////////////////////////////////////////
//--------------------------------------------------------------------------//
//NICK IS FOR WINDOW TITLE

USERNAME = '';
PASSWORD = '';
NICK = '';

//--------------------------------------------------------------------------//
//////////////////////////////////////////////////////////////////////////////



var
x, y : Integer;
tabsperhour, TimeGone, XPGain, profitgained, profiteach, tabsmade : Integer;
XPPerHour, CurrentTime, time, CurrentXP, OriginalXP, starttime : Integer;
info1,info2,info3: String;


Const
Version = 2;

procedure DeclarePlayers;
begin
NumberOfPlayers(1);
CurrentPlayer := 0;
Players[0].Name := USERNAME;
Players[0].Pass := PASSWORD;
Players[0].Nick := NICK;
Players[0].Active := True;
end;
procedure SmartProggy;
var
info,info2: String;
begin
info:= 'Script has been running for: ' + TimeRunning;
info2:= 'Total tabs made: ' + IntToStr(tabsmade);
SMART_DrawText(0,20,LoginChars,info,clTeal);
SMART_DrawText(0,40,LoginChars,info2,clFuchsia);


end;


procedure RotateCam;
var
Keys: TIntegerArray;
I: Integer;
Deg: Extended;
begin
if(not(LoggedIn))then exit;
Keys := [VK_RIGHT, VK_LEFT];
I := Random(2);
if (Random(2) = I) then
begin
ActivateClient;
Deg := RS_GetCompassAngleDegrees;
Wait(100 + random(50));
KeyDown(Keys[I]);
Wait(500 + random(1000));
KeyUp(Keys[I]);
Wait(500 + random(1000));
end else
if (Random(3) = 0) then
SleepAndMoveMouse(1000 + random(200));
end;



Procedure Antiban;
Begin

Case Random(100) Of
1: HoverSkill('magic', False);
2: HoverSkill('random', False);
3: Boredhuman;
4: Wait(2500 + random(4500));
5: HoverSkill('construction', False);
6: PickUpMouse;
7: RandomMovement;
8: RandomRClick;
end;
end;

Procedure MiniBreaker;
Begin

Case Random (160) Of
1: Wait(40000 + random(7400));
2: Wait(25500 + random(8550));
3: Wait(60040 + random(6759));
4: Wait(20400 + random(2549));
end;
end;





function FindLectern(var fx, fy: Integer): Boolean;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
X, Y, Z: Extended;
begin
TimeGone := (GetTimeRunning/1000);
OriginalXP := GetXPBar(1);
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.42, 0.24);

if not(FindColorsTolerance(arP, 11186354, MSX1, MSY1, MSX2, MSY2, 5)) then
begin
//Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

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

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

if (X >= 35.42) and (X <= 47.33) and (Y >= 37.50) and (Y <= 50.14) and (Z >= 38.15) and (Z <= 50.91) then
begin
for j := 0 to arL2 do
begin
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;
end;
end;

SortTPAFrom(arAP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arAP, 3, 3);
arL := High(ararP);

for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
Wait(100 + Random(100));
if (IsUpText('Study')) then
begin;
Result := True;
Break;
end;
end;

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

if (i = arL + 1) then
begin
//Writeln('FindObject could not find object.');
Exit;
end;

GetMousePos(fx, fy);
end;



function FindDemon(var fx, fy: Integer): Boolean;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.22, 1.40);

if not(FindColorsTolerance(arP, 1317937, MSX1, MSY1, MSX2, MSY2, 10)) then
begin
//Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

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

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

if (X >= 0.33) and (X <= 4.30) and (Y >= 0.28) and (Y <= 3.63) and (Z >= 0.16) and (Z <= 2.59) then
begin
for j := 0 to arL2 do
begin
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;
end;
end;

SortTPAFrom(arAP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arAP, 2, 2);
arL := High(ararP);

for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
Wait(100 + Random(100));
if (IsUpText('Talk')) then
begin;
Result := True;
Break;
end;
end;

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

if (i = arL + 1) then
begin
//Writeln('FindObject could not find object.');
Exit;
end;

GetMousePos(fx, fy);
end;



function TalkToDemon : Boolean;
var
nextBMP: Integer;
label
Start;
begin
Result:=True;

Start:
MarkTime(time);
repeat
if (TimeFromMark(time)>300000) then
begin
Result:=False;
Exit;
end;
RotateCam;
Wait(RandomRange(1000,1500));
until FindDemon(x,y)
Writeln(' Found your Demon Butler.' );
MarkTime(time);
repeat
Mouse(x,y,0,0,mouse_right);
Writeln(' Right clicking on Demon Butler.');
Wait(RandomRange(2000,1000));
if (TimeFromMark(time)>20000) then
begin
Result:=False;
Writeln(' Cant talk to Demon .');
Exit;
end;
until ChooseOption('Fe')
Writeln( ' Chose option: "Fetch-from-bank".');
Wait(RandomRange(2000,3000));

nextBMP := BitmapFromString(19, 12, 'meJyzaI43a4qxaI4Do3gIAooYlIZIO+pxq4gASSAbKGLZlmDdkQRHkoVuQCSR6wxEELZUqSeQzWOhXFRb8fb9exNnG04daZFka4iUdIU3EEHUiGU7QRBcL1CZiqE2UNfff/+AKDkvE6hXKMQIqACiF0gC1QjHWQJJ0Ux7ZMRjpgjUe/HiJYjepUuXMSuL8LppQQwHkoJRJnAE1C6UbAokgQjI5TCQFlGS3rx5C0Tv/sOHRJSlIcqAiC9YB44EIgygKFQPyGXRFBOUk+js79m1a/fp02dWrVoN5PL5aUFs4fFRQ0a8AepABGQAdcmoK86eM2fylCmzZ8+pbW5gkeYBugEoBbGF00kGE3HYSUmrygMtAiKgU31DA0C6TEWB4kBZbg95iBoICWHAEYsib2RCNFAjMIhYpHg4rMQhauDK0NQjLLUSB+pl4GMEkpi64HZh2giVQtKCpozNRJQ8BABBW6fQ');
if FindBitmapToleranceIn(nextBMP, x, y, MCX1, MCY1, MCX2, MCY2, 30) then
begin
Writeln(' Demon wants his payment :( ');
MouseBox(225,463,293,472,mouse_left); Wait(RandomRange(1000,2000));
MouseBox(118,387,400,394,mouse_left); Wait(RandomRange(1000,2000));
profitgained:=profitgained-10000;
Writeln(' Paying 10k from money pouch :/.');
FreeBitmap(nextBMP);
goto Start;
end;
FreeBitmap(nextBMP);

MarkTime(time);
repeat
if (TimeFromMark(time)>15000) then
begin
Result:=False;
Writeln(' Cant uncert the soft clays.');
Exit;
end;
until FindNPCChatText('Un',ClickLeft)
Writeln(' Chose option: "Un-cert another 24 pieces of soft clay".');
Wait(1000);
Writeln(' Waiting for them soft clays');


end;



function MakeTabs : Boolean;
var
varTabBMP : Integer;
begin
varTabBMP := BitmapFromString(45, 49, 'meJzN2GFKAzEQBeDD+MuTldJaS1jbriIe0JvoGQSDA8OSTF7eTKII80Mwm/n6drK6Tema0nVZVq3L5UXrdnvV+rq/I0vW6yaybfppdD4/5To9LrmOD+lwOO/3p93uuDV4AevzmxTjMTEqGQRsK4BRiRrI/E1AGKMSYUwBBDAiyQwxgAu9AAaTa8vIgQgjAAiv1FhEIozWvYh9Rv4qZUggtSEGCOwgEpPBd++uIRkSiHdzb1x4jckYAfDXmoF0V7oA5FECjNYOAYC5FZ4QHMWgAexmMn4pCoYhErCg2PDz4z1Xt2+9rHsMhUFGwTDMNeRhZOQjDCYQfiqkBZZ0Gcyn7k4mZuDf4kD+G4M5pPi+dG8ZkLgYoBczwNMZdUfyqdLt8gcMVxqB+zISReCktAIZjCL2R20iI/AUbUlcBrJjIJDxKKYEwj+1Wr3w/xvhw+uNYpAhksGpyD9v35WYWxYoc6siCpNRS2IYcgLrl2jAcGHwtbUBvMC2JBjDXFUz8gsCnkkeE1imUdSM1ocFHldigOGaySmAwgAY3jHwDozJCM9k4MgUw1kw5mJw9yKKZVnD524QUHypHttzEOBlkJgwQL+4njJvZPcCEGPw808C1JDrG9H2SiE=');
Result:=True;
MarkTime(time);
repeat
if FindLectern(x,y) then
begin
Writeln(' Clicking on your lectern.');
Mouse(x,y,0,0,mouse_left);
Wait(RandomRange(4000,4500));
end;
if (TimeFromMark(time)>30000) then
begin
Result:=False;
Writeln(' Cant find lectern or failed to click on it.');
FreeBitmap(VarTabBMP);
Exit;
end;
until FindBitmapToleranceIn(varTabBMP, x, y, MSX1, MSY1, MSX2, MSY2, 30)
FreeBitmap(VarTabBMP);
MarkTime(time);
repeat
MouseBox(223, 145, 276, 196, mouse_Right);
Writeln(' Right clicking on Falador Teleport.');
if (TimeFromMark(time)>15000) then
begin
Result:=False;
Writeln(' Cant find option: "Make-All"');
Exit;
end;
until WaitOption('e-All',100)
Writeln(' Chose option: "Make-All".');
Wait(1000);
Writeln(' Making 24 tabs, this is gonna take a while :(');

end;



function WhileTabbing : Boolean;
begin
Result:=True;
MarkTime(time);
repeat
Wait(100);
Antiban;
FindNormalRandoms;
if (TimeFromMark(time)>180000) then
begin
Result:=False;
Writeln(' Took too long to make 24 tabs.');
Exit;
end;
until (InvCount=4)
SmartProggy;
Inc(tabsmade+24);
CurrentXP := GetXPBar(1);
Writeln(' Done.');
Wait(RandomRange(3000,7000));
end;







procedure Main;
begin

ToggleXPBar(True);
ToggleMoneyPouch(False);
SetAngle(SRL_ANGLE_HIGH);

if (InvCount>4) then
begin
Writeln('Waiting till the first 24 tabs are done');
MarkTime(time);
repeat
Wait(2000);
if (TimeFromMark(time)>180000) then
begin
Writeln('Setup failure. Try again.');
Exit;
end;
until (InvCount=4)
end;
MarkTime(starttime);
Writeln(' Lets make them fally tabs ')


while LoggedIn do
begin
if not TalkToDemon then Exit;
MarkTime(time);
repeat
FindNormalRandoms;
if (TimeFromMark(time)>30000) then
begin
Writeln(' Demon didnt bring us any soft clays.')
Exit;
end;
until (InvCount>4);
if (InvCount<28) then
begin
Writeln(' Out of stuff.');
Exit;
end;
Writeln(' WE GOT CLAYSSSSSSSSS :D ');
Wait(RandomRange(500,3000));
if not MakeTabs then Exit;
if not WhileTabbing then Exit;
end;
Writeln(' We got logged out .');
end;



begin
Smart_Server := 20;
Smart_Members := False;
Smart_Signed := False;
Smart_SuperDetail := False;
SetupSRL;
ActivateClient;
DeclarePlayers;
SmartProggy;
Disguise('fallytabs_v'+IntToStr(Version)+' ['+Players[0].Nick+']');

if not LoggedIn then
begin
//LoginPlayerToLob;
//OpenWorldScreen;
//SelectWorld(RandomWorld(true,false));
LoginPlayer;
Writeln('Logged in successfully.');
Writeln('make sure demon is following you');
Writeln('uncert 24 soft clays');
Writeln(' make 24 Falador tabs');
Writeln('start the script again.');

Exit;
end;

Main;
Logout;
Writeln(' Script stopped.');

end.



I always get this : Variable Expected at line 0
Compiling failed.
can someone please help me? :(

eska

2012-03-25 17:06:01

The error is in this function:

function WhileTabbing : Boolean;
begin
Result:=True;
MarkTime(time);
repeat
Wait(100);
Antiban;
FindNormalRandoms;
if (TimeFromMark(time)>180000) then
begin
Result:=False;
Writeln(' Took too long to make 24 tabs.');
Exit;
end;
until (InvCount=4)
SmartProggy;
Inc(tabsmade+24);
CurrentXP := GetXPBar(1);
Writeln(' Done.');
Wait(RandomRange(3000,7000));
end;

When you increment the variable tabsmade. The function Inc increment by one and takes one parameters. You can't just put a variable and put + 24 to increment it by 24. If you want to increment by more than 1, you need to use the function IncEx, which take 2 parameters: The variable you want to increment and by how many you want to increment.

Also watch out when you say that something is *your* script. I see stuff (useless variables amongs other things) that shouldn't be there if it was only your script. For example I know that you took the SmartProggy function from someone else and removed some stuff from it. I understand that you were only experimenting and were probably not going to release this script and take all the credit for it, but it's good to take the habbit of commenting a function that you took from somebody else as soon as you copy it. That's to avoid being branded as a leecher.

pigggy

2012-03-25 18:55:30

From: sir eska eau
The error is in this function:

function WhileTabbing : Boolean;
begin
Result:=True;
MarkTime(time);
repeat
Wait(100);
Antiban;
FindNormalRandoms;
if (TimeFromMark(time)>180000) then
begin
Result:=False;
Writeln(' Took too long to make 24 tabs.');
Exit;
end;
until (InvCount=4)
SmartProggy;
Inc(tabsmade+24);
CurrentXP := GetXPBar(1);
Writeln(' Done.');
Wait(RandomRange(3000,7000));
end;

When you increment the variable tabsmade. The function Inc increment by one and takes one parameters. You can't just put a variable and put + 24 to increment it by 24. If you want to increment by more than 1, you need to use the function IncEx, which take 2 parameters: The variable you want to increment and by how many you want to increment.

Also watch out when you say that something is *your* script. I see stuff (useless variables amongs other things) that shouldn't be there if it was only your script. For example I know that you took the SmartProggy function from someone else and removed some stuff from it. I understand that you were only experimenting and were probably not going to release this script and take all the credit for it, but it's good to take the habbit of commenting a function that you took from somebody else as soon as you copy it. That's to avoid being branded as a leecher.




Thank you so much, and ill start crediting everything i get off a tutorial.
thanks again :D


reppped :P