SRL Archive - Help and Support

3rd script - what did i do wrong now....


krunkjuice

2006-04-01 11:57:25

Ok the error i get when compiling says: Line 2: [Error] (2:24): 'BEGIN' expected in script
I can't get past that one so theres probably more if you find any just tell me.
He whole script is:

program natthiever;
{.include SRL/SRL.scar};
//start with map facing north on the highest view.
procedure thieve;
movemouse(252, 137,true);
clickmouse(252, 137, false);
popup('Search for traps');
end;
begin
loadinclude('internet explorer',true);
writeln('nature rune chest thiever started!)
repeat
thieve;
until(false)
logout;
end.

krunkjuice

2006-04-01 12:47:50

Lol simple mistake, forgot a begin after a procedure. Now im getting this:Line 6:
[Error] (6:1): Identifier expected in script C:\Documents\SCAR 2.03\Scripts\natchestthiever-byme.scar


Here's the script i fixed it up a little.

program natthiever;
begin
{.include SRL/SRL.scar};
//start with map facing north on the highest view.

procedure getnats;
begin
movemouse(252, 137,true);
clickmouse(252, 137, false);
popup('Search for traps');
end;
begin
loadinclude('internet explorer',true);
writeln('nature rune chest thiever started!)
repeat
getnats;
until(false)
logout;
end.

ReFLeX

2006-04-01 12:57:43

program natthiever;
{.include SRL/SRL.scar};
//start with map facing north on the highest view.

procedure getnats;
begin
movemouse(252, 137,true);
clickmouse(252, 137, false);
popup('Search for traps');
end;

begin;
loadinclude('internet explorer',true);
writeln('nature rune chest thiever started!)
repeat
getnats;
until(false)
logout;
end.

krunkjuice

2006-04-01 13:03:09

now its back to this error: Line 2: [Error] (2:24): 'BEGIN' expected in script

ReFLeX

2006-04-01 17:48:08

try this
program natthiever;
{.include SRL/SRL.scar}

var i : integer;

procedure getnats;
begin
movemouse(252, 137);
clickmouse(252, 137, false);
popup('Search for traps');
end;

begin;
i:= 0;
PerfectNorth;
writeln('nature rune chest thiever started!')
repeat
getnats;
i:= i + 1;
addtoreport(IntToStr(i));
wait(5000)// try to thieve every 5 secs.
until(i > 200)//change 200 to the times you wanna try to thieve
logout;
end.

krunkjuice

2006-04-01 18:06:05

Succesfully compiled, ty! Hopefully it will work.

XxKanexX

2006-04-01 19:48:43

Sorry i hate scripts without standards. Very hard to understand.


program natthiever;
{.include SRL/SRL.scar}

var i : integer;

procedure getnats;
begin
movemouse(252, 137);
clickmouse(252, 137, false);
popup('Search for traps');
end;

begin;
i:= 0;
PerfectNorth;
writeln('nature rune chest thiever started!')
repeat
getnats;
i:= i + 1;
addtoreport(IntToStr(i));
wait(5000)// try to thieve every 5 secs.
until(i > 200)//change 200 to the times you wanna try to thieve
logout;
end.

krunkjuice

2006-04-01 19:51:45

how do you know where to indent?

phantombmx

2006-04-01 22:48:06

my standards are like this

for procedures and functions–
procedure Blah;
begin
end;
that has no spaces.. then when you are adding something, space twice, like this–
procedure Blah;
begin
stuff;
end;
if-then statements are done by spacing twice after the if-then to write the begin-end; and all the stuff within an if-then is spaced twice from the begin-end; like so–
procedure Blah;
begin
if(blahblah=blah)then
begin
stuff;
end;
end;

i hope that helps a little bit.. if not just pm me asking questions

krunkjuice

2006-04-02 00:07:24

Tyvm. Helped a lot. Hopefully my next script will look nicer.:o

XxKanexX

2006-04-02 00:12:18

I'm not sure if mines different, but heres what i do:

Main Loops:
anything that has a bold word at the start, variables are one space.
Other things are to spaces.

begin
i:= 2;
WriteLn('Hello');
end.
See how i did to spaces for WriteLn? Same with procedures and functions. Everytime you add a new begin it upgrades an extra 2 spaces and if its an if statement it goes 1 infront of the begin.

begin
if (1 = 1) then
begin
Writeln('2 spaces from begin');
end;
end.
once that begin has ended it goes down 2 spaces. :)

Not a very good tutorial, but just a base. And i declare variables like so:

var
i: Integer;
begin
end.
2 spaces from "var". :)

phantombmx

2006-04-02 01:24:10

yeah i just do it my way as its easier for me to keep track of begin-end; s.. like just this

procedure Blah;
begin
if(blahblah=blah)then
begin
stuff;
repeat
morestuff;
until(blah)
end;
end;
i would never be able to keep track of that easily by your way.. its just easier for me to understand a script

as for variables.. 2 spaces and i seperate them by what they go to kinda..

var
x,y,x1,y1,a,b,c,d:integer; //basic variables
bitmap1, bitmap2:integer; //bitmaps or dtms
fcounter, oobercounter, gerrantcount:integer; //counters and stuff like that
time, username, password:string; //strings of all sorts..

get it a lil bit?

Pwnd

2006-04-02 04:01:32

I had no idea variables were one space, kane. Oh well, it looks cleaner than your girlfriends ass crack either way, so it's all good.

Plus, make sure you space out operators, commas, ect.:

var
Pen0r, An0r, ToightAn0r: integer;

Writeln(IntToStr(10 + 1 * 5 + (18 / 3))

XxKanexX

2006-04-02 04:11:14

From: Pwnd
I had no idea variables were one space, kane. Oh well, it looks cleaner than your girlfriends ass crack either way, so it's all good.

Plus, make sure you space out operators, commas, ect.:

var
Pen0r, An0r, ToightAn0r: integer;

Writeln(IntToStr(10 + 1 * 5 + (18 / 3))

O rly? Are you sure you werent sniffing my dogs at the time when you judged it?