Page 1 of 11 123 ... LastLast
Results 1 to 25 of 258

Thread: A brief lesson on fixing annoying errors :P

  1. #1
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default A brief lesson on fixing annoying errors :P

    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:
    SCAR Code:
    LoadsNum=LoadsNum+1;
    that would be in correct and you would get an error. you need to add a ":" like so:
    SCAR Code:
    LoadsNum:=LoadsNum+1;

    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..

  2. #2
    Join Date
    Feb 2007
    Posts
    849
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    thats is actually very handy, cheers Jad
    ________________________________________
    14:19 < cycrosism> I wonder what she would have done without it
    14:19 < cycrosism> without me*
    Cycrosism is now an it.
    Quote Originally Posted by Dervish View Post
    /Facedesk.

  3. #3
    Join Date
    Feb 2007
    Posts
    19
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yeah nice work JAD
    Trying to become a good scripter and an srl member
    http://www.fenjer.com/adnan/SRL/20/5...Powerminer.png

  4. #4
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    thank you guys

  5. #5
    Join Date
    Jan 2007
    Location
    USA
    Posts
    1,782
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Isnt this like your 3rd tut nice work bro.(You did have the day off tho )

    Join the fastest growing merchanting clan on the the net!

  6. #6
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    if I get an idea for a tutorial, I just go for it, because I have all the time in the world I usually do spread them out though, this one was like 1 day off my things the beginner tuts dont teach you, then I made one after this one currently thinking of more ideas, then I'll write some more

  7. #7
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    Do you know how to get rid of Syntax errors?

  8. #8
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    423
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    nice tut, i amagine this will be very helpful, i hate annoying errors. also, you could add something about not having enough ends at the end of procuedures

  9. #9
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by meanage View Post
    nice tut, i amagine this will be very helpful, i hate annoying errors. also, you could add something about not having enough ends at the end of procuedures

    Error 6: Identifier expected in script. that just says count your begins and ends.

    @garret, thanks for the suggestion. I'll be sure to add that!

  10. #10
    Join Date
    Feb 2007
    Posts
    125
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    here's another one that u dont have up thier....

    I need help with this....editing someones script

    SCAR Code:
    Line 937: [Error] (20638:47): Invalid number of parameters in script

    Heres the line

    SCAR Code:
    if(GetChatMessage(Players[CurrentPlayer].Name)) or (GetChatMessage(Players[CurrentPlayer].Nick))then

    JAD add me on msn. CLick the colorful butterfly Next to longetivy. or below where i live i dont know where its at lol

  11. #11
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    I believe the procedure is now called
    SCAR Code:
    GetChatMsg

    you may also use:
    SCAR Code:
    function IsChatMessage(s: String): Boolean;
    function GetNewChatMsg: String;
    function GetLastChatText(var  chat: String): Boolean;
    function ClickNpcChatText(txt: String): Boolean;
    function FindNpcChatText(txt: String): Boolean;

    =)

  12. #12
    Join Date
    Jun 2006
    Location
    N Wales
    Posts
    558
    Mentioned
    2 Post(s)
    Quoted
    56 Post(s)

    Default

    do you know how to sort this out?
    Line 84: [Error] (17745:1): Type mismatch in script C:\Program Files\SCAR 2.03\Scripts\******.scar
    (i edited name because its not released yet.

    line 84 is :
    writeln('buried a full inv of bones')

  13. #13
    Join Date
    Mar 2007
    Posts
    19
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    it in the line above it usually
    so look and see if theres anything wrong in line 83

  14. #14
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Actually the line below it, 85. You didn't have ; on 84, so SCAR thinks that the line after it (and all lines until it hits a ; ) is 84.

  15. #15
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    WOW! thats amazing this tutorial got stickied over my other tuts which I think were better but I'm not going to complain thanks whoever stickied this

  16. #16
    Join Date
    Mar 2007
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    thanks for this JAD

    good job you know what your doing

  17. #17
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ty :d

  18. #18
    Join Date
    Mar 2007
    Posts
    478
    Mentioned
    4 Post(s)
    Quoted
    4 Post(s)

    Default

    I keep getting this message

    Line 871: [Error] (6737:12): Unknown identifier 'FindColorCircleD' in script C:\Program Files\SCAR 2.03\includes\srl\srl\core\Color.scar

    here is what line 871 looks like in color.scar

    Result := (FindColorCircleD(x, y, color, radius, MidPointx, MidPointy, 0));

  19. #19
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You need to copy the plug ins from your SRL folder to your scar plugins folder I'm 99.9% sure

  20. #20
    Join Date
    Mar 2007
    Posts
    478
    Mentioned
    4 Post(s)
    Quoted
    4 Post(s)

    Default

    which SRL folder? Im so confused

  21. #21
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    the plug ins folder

  22. #22
    Join Date
    Oct 2006
    Location
    Ireland
    Posts
    855
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Any help on an Access violation?

  23. #23
    Join Date
    Oct 2006
    Posts
    334
    Mentioned
    0 Post(s)
    Quoted
    18 Post(s)

    Default comma

    thanks so much! That helped but theres another one i get now

    comma ',' expected

    (it expects it to be M,Mouse)
    wtf?

  24. #24
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    @nate, Could you give me the line above where it says the error, the line it says the error on and the line below it? I could help you then

    @alex, Thanks, I'll add that. forgot about that one. read updated version.

  25. #25
    Join Date
    Dec 2006
    Posts
    281
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    ok JAD This Is Bothering Me

    Line 61: [Error] (18102:1): comma (',') expected in script

    60-wait(10+random(3)
    61-FindTalk;
    62-if(FindFight) then

    the numbers are just the lines 60, 61, 62

Page 1 of 11 123 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. A brief lesson on RadialWalk
    By WT-Fakawi in forum OSR Intermediate Scripting Tutorials
    Replies: 80
    Last Post: 05-02-2012, 12:18 PM
  2. College Homework Lesson
    By Moloch in forum OSR Help
    Replies: 2
    Last Post: 11-05-2008, 02:04 PM
  3. 4 errors Need Help Fixing
    By NiCbaZ in forum OSR Help
    Replies: 1
    Last Post: 04-11-2008, 06:10 AM
  4. Fixing Errors [Video]
    By JuKKa in forum Outdated Tutorials
    Replies: 0
    Last Post: 06-09-2007, 02:27 PM
  5. Fixing This Simple Errors.
    By kooldude in forum OSR Help
    Replies: 2
    Last Post: 05-16-2007, 07:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •