PDA

View Full Version : Common Scripting Errors



Abu
05-20-2012, 01:20 PM
This is a tutorial for those who get errors while trying to compile your own script not run someone elses. For errors when trying to run another script go to: So, you get an error huh? (http://villavu.com/forum/showthread.php?t=71645), the FAQ (http://villavu.com/forum/showthread.php?p=851555) or the script related thread.

Without further adieu:


Operator expected at line xx, column xx or Invalid evaluation at line xx, column xx
This means on the above line, you forgot to put a semicolon ; at the end of it
---

Expression expected at line xx, column xx
It's cause by not having enough end; meaning you the number of begins and ends in your procedure/function do match up - there needs to be an equal number. Also note that a case needs and end; too.
---

Unknown declaration '' at line xx, column xx
There are various reasons why this are caused.
Firstly, it may be because you have an undeclared variable. By this I mean you want a word to represent a value and you use it, such as:
procedure logs();
begin
Logs := 2;
end;
You need to tell the script what 'Logs' represent, to do this you have to declare it as a variables, so:
procedure logs();
var
Logs: Integer; // declared here as an integer, which a whole number
begin
Logs := 2;
end;


Another reason it because you may have misspelled a function, such as spelling writeLn as writeIn <- with an 'i', which means that Simba has no idea what the function is supposed to mean

The final reason you may have got this error is because you forgot to include Simba, make sure you have this after you define smart:
{$i srl-6/srl.simba}

And this in your mainloop:
setupSRL(); // put before your functions

---
Invalid label at line xx, cloumn xx
This means, when writing the equals sign in simba, you put the colon but forgot to put the actual equals sign. It should:
i := 2; //look like this
i :2; // not this
---
Duplicate declaration '' at line xx, column xx
There are a few reason why this may occur.

The first is because you have made two procedures/functions with the same name, this can be used by utilising the overload and override options shown here (http://villavu.com/forum/showthread.php?t=106780).

The second is because you have made a procedure/function with a name that already exists in the SRL Include.

The third is because you named a variable the same as a procedure or function that already exists in the SRL Include.
---
No default value for parameter '' found at line xx, column xx
This means, when using a function/procedure you have not put the right (amount of) values within the brackets. This is either because you just haven't, or you missed out a comma/ put an extra one.
---
Closing parenthesis expected at line xx, column xx or Found closing parenthesis without matching opening parenthesis at line xx, column xx
Simple means you have forgotten to put a closing bracket ) at that line, go to the line and put in the bracket or remove the extra bracket if that is the problem.
---
Expected variable of type "", got "" at line xx, column xx at line xx, column xx

The most common reason this error occurs is because you have entered a value wrong within the brackets for a function.

For example you have written an integer (number) when there should be a string (word). Or if you have declared something as a string or integer when it should have been the other way round.
---


So yeh there is a list of the most common errors people seem to be getting when trying to make scripts, hopefully this will help you on your way!

If you want any common errors to be added to this list let me know. Also, be sure to point out any reason I may not have mentioned for errors :)

Like, comment and subscribe *lool*:)

Andres
05-20-2012, 02:52 PM
Very nice! I will definitely be putting this to good work.

I wish you would have posted this yesterday. The semicolon one took a few minutes to figure out ;)

Dgby714
05-20-2012, 02:54 PM
Nice, one thing I noticed, Prob not allowed to name a variable the same name as a method tho.

Abu
05-20-2012, 05:39 PM
Very nice! I will definitely be putting this to good work.

I wish you would have posted this yesterday. The semicolon one took a few minutes to figure out ;)

Thanks, my bad :p


Nice, one thing I noticed, Prob not allowed to name a variable the same name as a method tho.

Thanks and added :)

Justin
05-21-2012, 10:49 AM
Very nice, should help out the new people that are wanting to learn how to script :)

stuartroad
05-21-2012, 10:53 AM
Champion, this is exactly what I was looking for.

Well done young man! Add more for newbies like me :)

Le Jingle
05-21-2012, 11:05 AM
Could you add "warning you passed an invalid finder fuction at line 30/29/28(etc.)"?

Abu
05-21-2012, 02:56 PM
Could you add "warning you passed an invalid finder fuction at line 30/29/28(etc.)"?

As Far As I Know that doesn't stop the script from compiling does it?

Gucci
05-21-2012, 03:21 PM
Nice tutorial although seems like more like a tutorial on how to fix antileechs but I guess it'll help them learn. Great job Abu

Le Jingle
05-21-2012, 04:29 PM
As Far As I Know that doesn't stop the script from compiling does it?

No it doesn't, but I usually pull out my hair trying to figure out why it does that, it'll tell my I set an invalid finding finder function at like -1, -1 and that it set it to 0, 0.

Runaway
05-21-2012, 05:50 PM
Good idea!

I wish there was something like this when I was learning. Getting those errors was so frustrating :p

stuartroad
06-03-2012, 11:13 AM
Gaah this is wracking my brain, how do i fix this one?


Procedure LevelUps;
begin
if (LevelUp) then
Inc (LevelsGained);
WriteIn('Gained a Level!');
end;

[Error] (50:3): Unknown identifier 'WriteIn' at line 49
Compiling failed.

I don't understand why my write in's arent working anymore. Is there anything wrong with this, Do you need more of the script? Everything is declared, I am pretty sure.

CephaXz
06-03-2012, 11:14 AM
WriteLn <--- LINE, not IN. :p

stuartroad
06-03-2012, 11:21 AM
WriteLn <--- LINE, not IN. :p

Fck me dead, thankyou.

I was never using it before some suggest to use them for debug, thankyou so much rofl.

stuartroad
06-03-2012, 12:01 PM
Fck me dead, thankyou.

I was never using it before some suggest to use them for debug, thankyou so much rofl.




Here is an error that I continually got to my stupidness, you might want to include it?

[Error] (119:1): Identifier expected at line ***

It's cause by not having enough "end;" meaning you have a begin but it doesn't end anywhere in the procedure/function.

If I am wrong, slap me and tell me to shutup. Thanks :)

CephaXz
06-03-2012, 12:05 PM
Here is an error that I continually got to my stupidness, you might want to include it?

[Error] (119:1): Identifier expected at line ***

It's cause by not having enough "end;" meaning you have a begin but it doesn't end anywhere in the procedure/function.

If I am wrong, slap me and tell me to shutup. Thanks :)

Yeah, it's a lot of times because of bad standards, making it hard to see when to put begin or end. It's either begin or end missing out before the line stated on the error.

Abu
06-03-2012, 02:53 PM
Here is an error that I continually got to my stupidness, you might want to include it?

[Error] (119:1): Identifier expected at line ***

It's cause by not having enough "end;" meaning you have a begin but it doesn't end anywhere in the procedure/function.

If I am wrong, slap me and tell me to shutup. Thanks :)

Tested, Approved and Added :)

kyleisaboss
06-03-2012, 04:16 PM
"[Error] (1:1): Unexpected end of file at line 0
Compiling failed." please someone help me i have no idea of fixing it thank you!

Abu
06-05-2012, 10:25 PM
"[Error] (1:1): Unexpected end of file at line 0
Compiling failed." please someone help me i have no idea of fixing it thank you!

Oooohhh, I know this one I just can't remember why it's caused!

Check for extra ends I guess.

Also, make sure only you're final end has a period/full stop(.) after it.


EDIT: If anyone else has the correct solution let me know plz so I can add it :)

Syntax
06-05-2012, 11:19 PM
Nicely done tutorial, will look back on in the future.

Thanatos
06-06-2012, 12:24 AM
I lol'ed when i read this. I did alot of these mistakes when i started my own script.

NKN
06-18-2012, 07:50 PM
Oooohhh, I know this one I just can't remember why it's caused!

Check for extra ends I guess.

Also, make sure only you're final end has a period/full stop(.) after it.


EDIT: If anyone else has the correct solution let me know plz so I can add it :)

Pretty sure it's for Program NameHere;
is missing a semi-colon, or the whole line is missing all-together, might be the final end. also

Abu
06-18-2012, 08:44 PM
Pretty sure it's for Program NameHere;
is missing a semi-colon, or the whole line is missing all-together, might be the final end. also

Tried it and it it runs even without program.

Also, without the colon it just gives a semicolon error

NKN
06-18-2012, 11:10 PM
Tried it and it it runs even without program.

Also, without the colon it just gives a semicolon error

Found out how it works.

Delete the final end. and it generates the error.

Abu
06-21-2012, 09:57 PM
Found out how it works.

Delete the final end. and it generates the error.

Tested, approved and added :)

Aqua3
10-25-2012, 01:13 PM
[Error] C:\Simba\Scripts\RimmingtonMiner (2).simba(1136:3): 'BEGIN' expected at line 1135

This one isn't in the tutorial? :(

masterBB
10-25-2012, 01:57 PM
You've got one end; more then you got a begin. Example of code that will create your error:

no begin
program new;

writeln('hello');
end.

should be

program new;

begin
writeln('hello');
end.

one end; more then you got begin
program new;

begin
if 1 > 3 then
writeln('how odd!');
end;
end.

should be

program new;

begin
if 1 > 3 then
begin
writeln('how odd!');
end;
end.

or

program new;

begin
if 1 > 3 then
writeln('how odd!');
end.

Aqua3
10-25-2012, 02:45 PM
You've got one end; more then you got a begin. Example of code that will create your error:

no begin
program new;

writeln('hello');
end.

should be

program new;

begin
writeln('hello');
end.

one end; more then you got begin
program new;

begin
if 1 > 3 then
writeln('how odd!');
end;
end.

should be

program new;

begin
if 1 > 3 then
begin
writeln('how odd!');
end;
end.

or

program new;

begin
if 1 > 3 then
writeln('how odd!');
end.

After adding "Begin", and saved, try to start it.. This message get at my logscreen..

[Error] C:\Simba\Scripts\RimmingtonMiner (2).simba(1137:3): Unknown identifier 'arP' at line 1136
Compiling failed.

nyaks
06-21-2013, 03:54 AM
what is mean?
Compiled successfully in 1422 ms.
Error: Exception: FindDTMs: DTM[] is not consistent. at line 260
The following DTMs were not freed: [0, 1, 2]





This is a tutorial for those who get errors while trying to create a script not run one. For errors when trying to run a script go to: So, you get an error huh? (http://villavu.com/forum/showthread.php?t=71645) and the FAQ (http://villavu.com/forum/showthread.php?p=851555)

Without further adieu:


Semicolon (';') expected at line xx
This means on the above line, you forgot to put a semicolon ; at the end of it
---

Identifier Expected at Line xxx
It's cause by not having enough end; meaning you the number of begins and ends in your procedure/function do match up - there needs to be an equal number. Also note that a case needs and end; too.
---

Unknown identifier '' at line xx
There are various reasons why this are caused.
Firstly, it may be because you have an undeclared variable. By this I mean you want a word to represent a value and you use it, such as:
procedure Logs;
begin
Logs := 2;
end;
You need to tell the script what 'Logs' represnt, to do this you have to decalre it as a variables, so:
procedure Logs;
var
Logs: Integer; // declared here as an integer, which a whole number
begin
Logs := 2;
end;


Another reason it because you may have misspelled a function, such as spelling WriteLn as WriteIn <- with an 'i', which means that Simba has no idea what the function is supposed to mean

The final reason you may have got this error is because you forgot to include Simba, make sure you have this after you define smart:
{$i srl\srl.simba}

And this in your mainloop:
SetUpSRL; // put before your functions

---
Assignment expected at line xx
This means, when writing the equals sign in simba, you put the colon but forgot to put the actual equals sign. It should:
i := 2; //look like this
i :2; // not this
---
Error: Exception: Access violation at line 101
When trying to script - if you get this error it means you have forgotten to put SetUpSRL; at the start of your mainloop
---
Duplicate Identifier '' at Line xx
There are a few reason why this may occur.

The first is because you have made two procedures/functions with the same name.

The second is because you have made a procedure/function with a name that already exists in the SRL Include.

The third is because you named a variable the same as a procedure or function that already exists in the SRL Include.
---
Invalid number of parameters at line xx
This means, when using a function you have not put the right amount of values within the brackets. This is either because you just haven't, or you missed out a comma.
In this case, you may also get the rror:

comma (',') expected at line xx
---
Closing square bracket (']') expected at line xx
When you use a square bracket [, make sure you close it with a closed square bracket ]
---
Closing parenthesis expected at line 21
Simple means you have forgotten to put a closing bracket ) at that line, go to the line and put in the bracket or remove the extra bracket if that is the problem.
---
Colon (':') expected at line xx
Usually occurs when you make a function but forget to write what it returns. For example:
function HeyThere; // will not compile
function HeyThere: Boolean; // tells Simba it returns a boolean, will compile
---
Syntax error at line xx
This means you've messed up somewhere when using signs - usually the equals sign. Make sure they are correct.
---
Type mismatch at line xx
The most common reason this error occurs is because you have entered a value wrong within the brackets for a function.

For example you have written an integer (number) when there should be a string (word). Or if you have declared something as a string or integer when it should've been the other way round.

Another reason may be because when using functions such as FindObjCustom, which allow you to put multiple uptexts and colours, the multiple uptexts and colours must go within square brackets regardless of the amount you use. So:
FindObjCustom(x, y, 'heymama', [234, 567], 20); // will not compile
FindObjCustom(x, y, ['heymama'], [234, 567], 20); //this will because it has square brackets around the uptext 'heymama'

Having said the above point, you will also get a mismatch error if you use normal brackets where square brackets are needed.
---

Unexpected end of file at line 0
This error occurs when you are missing your final end. Put it in and remember that it needs a period(.) after it as it is the last one.
---


So yeh there is a list of the most common errors people seem to be getting when trying to make scripts, hopefully this will help you on your way!

If you want any common errors to be added to this list let me know. Also, be sure to point out any reason I may not have mentioned for errors :)

Like, comment and subscribe *lool*:)

what is mean this error.

nyaks
06-26-2013, 05:13 AM
you forgot to mention out of range dudes



This is a tutorial for those who get errors while trying to create a script not run one. For errors when trying to run a script go to: So, you get an error huh? (http://villavu.com/forum/showthread.php?t=71645) and the FAQ (http://villavu.com/forum/showthread.php?p=851555)

Without further adieu:


Semicolon (';') expected at line xx
This means on the above line, you forgot to put a semicolon ; at the end of it
---

Identifier Expected at Line xxx
It's cause by not having enough end; meaning you the number of begins and ends in your procedure/function do match up - there needs to be an equal number. Also note that a case needs and end; too.
---

Unknown identifier '' at line xx
There are various reasons why this are caused.
Firstly, it may be because you have an undeclared variable. By this I mean you want a word to represent a value and you use it, such as:
procedure Logs;
begin
Logs := 2;
end;
You need to tell the script what 'Logs' represnt, to do this you have to decalre it as a variables, so:
procedure Logs;
var
Logs: Integer; // declared here as an integer, which a whole number
begin
Logs := 2;
end;


Another reason it because you may have misspelled a function, such as spelling WriteLn as WriteIn <- with an 'i', which means that Simba has no idea what the function is supposed to mean

The final reason you may have got this error is because you forgot to include Simba, make sure you have this after you define smart:
{$i srl\srl.simba}

And this in your mainloop:
SetUpSRL; // put before your functions

---
Assignment expected at line xx
This means, when writing the equals sign in simba, you put the colon but forgot to put the actual equals sign. It should:
i := 2; //look like this
i :2; // not this
---
Error: Exception: Access violation at line 101
When trying to script - if you get this error it means you have forgotten to put SetUpSRL; at the start of your mainloop
---
Duplicate Identifier '' at Line xx
There are a few reason why this may occur.

The first is because you have made two procedures/functions with the same name.

The second is because you have made a procedure/function with a name that already exists in the SRL Include.

The third is because you named a variable the same as a procedure or function that already exists in the SRL Include.
---
Invalid number of parameters at line xx
This means, when using a function you have not put the right amount of values within the brackets. This is either because you just haven't, or you missed out a comma.
In this case, you may also get the rror:

comma (',') expected at line xx
---
Closing square bracket (']') expected at line xx
When you use a square bracket [, make sure you close it with a closed square bracket ]
---
Closing parenthesis expected at line 21
Simple means you have forgotten to put a closing bracket ) at that line, go to the line and put in the bracket or remove the extra bracket if that is the problem.
---
Colon (':') expected at line xx
Usually occurs when you make a function but forget to write what it returns. For example:
function HeyThere; // will not compile
function HeyThere: Boolean; // tells Simba it returns a boolean, will compile
---
Syntax error at line xx
This means you've messed up somewhere when using signs - usually the equals sign. Make sure they are correct.
---
Type mismatch at line xx
The most common reason this error occurs is because you have entered a value wrong within the brackets for a function.

For example you have written an integer (number) when there should be a string (word). Or if you have declared something as a string or integer when it should've been the other way round.

Another reason may be because when using functions such as FindObjCustom, which allow you to put multiple uptexts and colours, the multiple uptexts and colours must go within square brackets regardless of the amount you use. So:
FindObjCustom(x, y, 'heymama', [234, 567], 20); // will not compile
FindObjCustom(x, y, ['heymama'], [234, 567], 20); //this will because it has square brackets around the uptext 'heymama'

Having said the above point, you will also get a mismatch error if you use normal brackets where square brackets are needed.
---

Unexpected end of file at line 0
This error occurs when you are missing your final end. Put it in and remember that it needs a period(.) after it as it is the last one.
---


So yeh there is a list of the most common errors people seem to be getting when trying to make scripts, hopefully this will help you on your way!

If you want any common errors to be added to this list let me know. Also, be sure to point out any reason I may not have mentioned for errors :)

Like, comment and subscribe *lool*:)

Peanuts
06-26-2013, 05:24 AM
This is a tutorial for those who get errors while trying to create a script not run one.

Handy tut man.

Should that be "compile a script"?

Abu
12-12-2013, 08:43 AM
This little guide has been updated with errors I have been able to reproduce with srl 6. If there are any you want me to add/modify please let me know.

:)

volcon
03-26-2016, 03:45 PM
lots of help thanks

hakishakataki
11-04-2016, 09:18 PM
Could we add the "access violatio" error to this list? I can't figure it out.

RevanScripts
04-26-2017, 11:05 PM
I'm new to scripting with Simba/Lape. I keep getting an error message stated as, "Error: Block expected at line 11"

What did I forget to do to create this error?

senrath
04-26-2017, 11:56 PM
I'm new to scripting with Simba/Lape. I keep getting an error message stated as, "Error: Block expected at line 11"

What did I forget to do to create this error?

You forgot a begin somewhere around line 11. To say more I'd need to see your code.

RevanScripts
04-27-2017, 01:09 AM
I found the issue. The error was that I was using too many begin/ends around my If/Then/Else statements. I thought that you had to do

If xx then
begin
end else

Which seemed to have work before, but in this instance it did not.

Denis
04-25-2020, 03:23 AM
Stucked on trying to walk in OSRS, I can log in, but instead of walking the correct path, the program only clicks on the lower right direction of the bitmap.