Added a few more errors to help out all my fellow scripters enjoy.
well in this tutorial i will go over fixing some of the most common errors, and hopefully explain good enough how to fix them :P well here we go:
Note: all errors can be caused on the line it says the error is on or the line of code above (not counting comments, so if you have comments above, it may be caused by
the first line of code above it) Usually they will not occur anywhere else (not counting access violation, include doesn't exist...etc, the ones that don't tell you a line)
Error 1: Close round expected in script
Solution: Count your parenthesis on the line which the error occurs. for
example: if (FindColorSpiralTolerance(x, y, RockColor, 0, 0, 249, 179, Tol) then
see whats wrong with that? you have 2 ( ('s but only 1 ) to close it. you'd need to put 2 at the end of that like this:
if (FindColorSpiralTolerance(x, y, RockColor, 0, 0, 249, 179, Tol)) then
OK so now i hope you got that, Moving on..
Error 2: Include file C:\Program Files\SCAR 2.03\includes\SRL/SRL.scar does not exist. (or something like that)
Solution: this is the biggest error of all time. all you need to do for this is read the tutorial for installing SRL in the Install SRL forum. Moving on..
Error 3: Semicolon (';') expected in script
Solution: this used to happen to me A LOT when i didn't put a ";" after my variables. just remember to do so. You will also get this when you forget to put a ";" after your procedure/function names. Moving on..
Error 4: Unknown identifier 'AntBan' in script (or something like that)
Solution: this means that you did either did not type something write, you called a procedure that does not exist, you called for a variable that does not exist or you did no include an include, and call for it to setup at end of script (example if you needed to setup SRL in the main loop you need SetupSRL; in script and the include after program name)
so if this happens just check what either what variable you used, usually you just spelled it wrong above where you declared it. check spelling of it. check procedure name and check name of procedure you called for. Moving on..
Error 5: Duplicate Identifier i in script (or something like that)
Solution: to fix this i used x for an example. lets say you used i as your variable, then you made a procedure/function called i. this would not work because i is already used as a variable in the script, so you cannot name that as a procedure. So pretty much, you can't name 2 things the same thing, every name for variable/functions/procedures/constants...etc. has to be different.
Now, if there's a variable or a procedure in SRL and you have SRL included in your script, if you try to call a procedure/function something which's name is already used in SRL, you will get a duplicated identifier with that. So you can't make a procedure named this in your script if you're including SRL:
SCAR Code:
procedure Mouse;
begin
if(FindColor(x,y,12345,123,123,123,123))then
ClickMouse(x,y,true);
end;
If you included SRL, that would give you an error because Mouse is already a procedure in SRL. Hope you got that Moving on..
Error 6: Identifier expected in script.
Solution: count your begins and ends in your script, and make sure for each begin, you have an "end;" also make sure for each repeat you have an until. Moving on..
Error 7: 'BEGIN' expected in script.
Solution: make sure you have a begin at the beginning of your procedure.
Error 8: Invalid number of parameters in script.
Solution: this is ussually caused if you put too many numbers, parenthesis and things like that in script. if you put MMouse(x,y,0,0,0,) it would probably say invalid number of parameters. so just check whats needed in the command, and if theres anything extra thats not needed.
Error 9: Access violation.
Solution: Access violation usually always happens when somebody doesn't call for setupSRL; in there main loop of script (if your include is {.include SRL/SRL.scar}..) so heres what would be wrong:
Example:
SCAR Code:
program WhatEver;
{.include SRL/SRL.scar}
procedure Whatever2;
begin
//code here..
end;
begin //main loop.
Whatever2;
end.
See. now that would be wrong because you don't have SetupSRL; in your main loop. remember when using SetupSRL; you need it to be pretty much the first thing in your main loop, before any autoing. Heres a working example:
SCAR Code:
program WhatEver;
{.include SRL/SRL.scar}
procedure Whatever2;
begin
//code here..
end;
begin //main loop.
SetupSRL; //heres why it works now :D
Whatever2;
end.
The other most common way people get this error is calling for a bitmap when you didn't declare it. Lets say your script is something like this:
SCAR Code:
program Whatever;
var TheBitmap, x,y: Integer;
procedure LoadBitmaps;
begin
TheBitmap := BitmapFromString//And then the rest of your bitmap of course...
end;
procedure ClickTheBitmap;
begin
if(FindBitmap(TheBitmap,x,y))then
begin
wait(100+random(100));
Mouse(x,y,0,0,true);
end;
end;
begin
ClickTheBitmap;
end.
Now, that would cause an error! Do you know why? Because you didn't declare the LoadBitmaps procedure in the main loop as many people fail to do. So here is how it would look correctly:
SCAR Code:
program Whatever;
var TheBitmap, x,y: Integer;
procedure LoadBitmaps;
begin
TheBitmap := BitmapFromString//And then the rest of your bitmap of course...
end;
procedure ClickTheBitmap;
begin
if(FindBitmap(TheBitmap,x,y))then
begin
wait(100+random(100));
Mouse(x,y,0,0,true);
end;
end;
begin
LoadBitmaps; //This is what fixed the error!
ClickTheBitmap;
end.
Error 10: Out of range error.
Solution:
This is most commonly caused by not setting your players right in the player arrays. When you set the number of players, you are setting the number of slots that there are players for, ACTIVE OR NOT! so if you have 2 users active, but there are 6 slots, then you still have the how many players as 6.
Error 11: Assignment expected in script.
Solution:
This error happened to me a few days ago when I was scripting and adding the progress report. It happened to me when I had in my banking procedure for my chopper:
Example:
that would be in correct and you would get an error. you need to add a ":" like so:
well thats my tut for now, if i think of any more errors I will edit this. if you have any errors that i didn't post, and you think i should please post below. don't forget to plus rep me if this was helpful thanks for reading this, hoped i helped you some. laterz for now.
Error 12: Close round expected in script
Solution: This just means that you are missing a/some ")"[s] for each "(" you have. So this:
SCAR Code:
procedure Whatever;
begin
if(FindColor(x,y,1321235,MMX1,MMY1,MMX2,MMY2)then
ClickMouse(x,y,true);
end;
wouldn't work because you are missing a ")" in the FindColor. So just count your "(" 's and make sure that for each "(" you have, you have a ")" to close it. Moving on..
Error 13: comma "," expected in script
Solution: This could actually mean that you are missing a parenthesis/close round somewhere, and can be caused by other problems that you could fix above. But something like:
SCAR Code:
if(FindColor(x,y,1234123,MMX1,MMY1,MMX2 MMY2))then
ClickMouse(x,y,true);
wouldn't work. Because the MMX2 MMY2 doesn't have a comma between it. Just make sure you have that, and it could be caused by the line above not having a closed round or something. Moving on..
Error 14: 'THEN' expected in script
Solution: Simply means you don't have a "then" in something that has an if. For example:
SCAR Code:
procedure Whatever;
begin
if(FindColor(x,y,1235123,MMX1,MMY1,MMX2,MMY2))
ClickMouse(x,y,true);
if(InChat('JAD is awesome!'))
Writeln('JAD is awesome was in the chat!');
end;
That wouldn't work because you don't have any then's for lines that have an if. So it's pretty much saying, if it finds the color (or whatever), then it does what? What does it do if it finds the color? Just put a then after it to fix that. Moving on..
Error 15: String error in script
Solution: Means you forgot to close an opening "'" with a closing "'" So this:
SCAR Code:
procedure Whatever;
begin
Writeln('JAD is sooo awesome!);
if(InChat('hi there))then
Writeln('JAD is sooooooo awesome!);
end;
wouldn't work. All 3 of the commands wouldn't work because you didn't close the opening "'" with a closing "'". Moving on..
Error 16: Syntax error in script
Solution: Most-likely means you didn't type something right. Just make sure all the parameters and everything are correct. This would give you a syntax error:
SCAR Code:
procedure Whatever;
var J: Integer;
begin
J := 5;
Writeln(J);
end;
That wouldn't work because J isn't a string, and you didn't use IntToStr in that Writeln. It would also happen when your using something like GetTextAtEx and using an integer where there is supposed to be a string. Moving on..