Page 1 of 3 123 LastLast
Results 1 to 25 of 63

Thread: SCAR Script Official Standards

  1. #1
    Join Date
    Mar 2006
    Location
    USA
    Posts
    948
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default SCAR Script Official Standards

    • Indenting will be two spaces per level. You can indent by selecting text in SCAR and pressing Ctrl+Shift+U and Ctrl+Shift+I.
    • Margins will be set to 80 characters. Try not to make too long lines.
    • The begin statement appears on its own line. The end statement always
      matches the begin statement by columns.
      Example:

    • Do not combine two or more statements on a single line. Write each on its own line.
    • Use semicolons at the end of the lines where appropriate. SCAR allows lines without semicolons but you should use them everywhere, except after var, begin, then, else repeat, do and before else.
    • Use spaces after commas and arithmetical signs.
      Example:

    • There shall never be white space between an open parenthesis and the next character.
      Example:

    • Object Pascal language reserved words and key words shall always be completely lowercase. Never capitalize words that SCAR displays in bold. It's completely unnecessary and looks ugly!
    • Routine names shall always begin with a capital letter and be camel-capped for readability.
      Example:

    • Routines shall be given names meaningful to their content. Routine name DoStuffWithSyAndSy is not meaningful, but name OutputProgressReport is.
    • Where possible, procedure and function formal parameters of the same type shall be combined into one statement
      Example:

    • All formal procedure and function parameter names will be meaningful to their purpose.
    • All functions should always return some value. Do not rely on SCAR initializing procedure return value automatically!
    • Variables will be given names meaningful to their purpose. That includes local and loop control variables, although in this case single character names are acceptable.
    • Boolean variable names must be descriptive enough so that their meanings of True and False values will be clear.
    • Variable declarations start in next line after var statement and are indented.
      Example:

    • Use of global variables is discouraged. However, they may be used when necessary. Global variable naming rules are as follow:
      Forms and controls are prefixed with their individual prefixes. Examples: frmMainForm, lblUser, txtPassword, imgPreview etc.
      DTMs will be marked with dtm prefix as in dtmFishingSpot.
      Character sets will be marked with chr prefix as in chrChatChars.
      Bitmaps will be marked with bmp prefix as in bmpFishingNet.
      Include global variables will be marked with g prefix then include initials as in gOsiStartTime.
      Normal global variables will be marked with g prefix as in gNumFishCaught.
    • Type names that are reserved words shall be completely lowercase as in string. For other variable names, the first letter shall be uppercase, and the rest shall be camel-capped for clarity as in Integer.
    • The most likely case to execute in an if/then/else statement shall be placed in the then clause, with less likely cases residing in the else clause(s). This improves performance as well as readability.
    • If multiple conditions are being tested in an if statement, conditions should be arrange from left to right in order of least to most computation intensive. If condition statement is complex, replace it with function or Boolean variable with a meaningful name. This improves readability and makes code self-documenting.
    • Use of informational file header is encouraged for all script and include files.
      Use Script > Script Properties from SCAR menu to enter script information.

    These standards ensures readability of your code and enables easier maintaining of scripts written by other people.

    [Source = http://kaitnieks.com/scar/scriptingsta/ ]

  2. #2
    Join Date
    Oct 2006
    Location
    I'm a figment of your imagination
    Posts
    422
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Wow. Finally I can bring my scripts up to standards . Thanks for the tut, there's just so much disputes over Standards out there I realize that sometimes it may be hard finding valid info .

    Nice tut

    It's been a while... but I'm BACK!!!

  3. #3
    Join Date
    Mar 2006
    Location
    USA
    Posts
    948
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by botmaster View Post
    Wow. Finally I can bring my scripts up to standards . Thanks for the tut, there's just so much disputes over Standards out there I realize that sometimes it may be hard finding valid info .

    Nice tut
    This isn't just a Tut these are THE original standards (if you look at citation)

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

    Default

    WONDERFULL
    everyone always talks about "standards" and people know what most of them are but ther isnt like one guide saying what "THE standsards" are. good job!

  5. #5
    Join Date
    Aug 2006
    Location
    London
    Posts
    2,021
    Mentioned
    2 Post(s)
    Quoted
    0 Post(s)

    Default

    iv read the site a while ago, the only standard i picked up is the use of the prefix dtm and bmp for the handles.
    you might have noticed iv got dtmBankers or dtmWater in a few scripts

    theres also some small useful ones like putting the conditons of if statements in their most likely order

    but this was useful to look at when i was writing stuff that would go into SRL
    Join the Official SRL IRC channel. Learn how to Here.

  6. #6
    Join Date
    Feb 2006
    Location
    Pennsylvania
    Posts
    1,524
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Been following these since a month into my SCAR scripting "career"

  7. #7
    Join Date
    Mar 2006
    Location
    USA
    Posts
    948
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    I posted a download for the post source anyone who wants to feel free to redistribute this...

  8. #8
    Join Date
    Sep 2006
    Posts
    916
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok, most of that makes sense to me (i think ), but there's one thing i don't understand:

    Type names that are reserved words shall be completely lowercase as in string. For other variable names, the first letter shall be uppercase, and the rest shall be camel-capped for clarity as in Integer.

    What does camel-capped mean?

  9. #9
    Join Date
    Sep 2006
    Posts
    916
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok, most of that makes sense to me (i think ), but there's one thing i don't understand:

    Type names that are reserved words shall be completely lowercase as in string. For other variable names, the first letter shall be uppercase, and the rest shall be camel-capped for clarity as in Integer.

    What does camel-capped mean?

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

    Default

    ok dang i not been doin some of that stuff better hop to it =p

  11. #11
    Join Date
    Dec 2006
    Location
    .̿̂̔͋͗̎̆ͥ̍̒ͤ͂̾̌̀̅
    Posts
    3,012
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Aren't these from kaitnieks.com..? Maybe you should credit kait for making the standards, if they are from kaitnieks.com

  12. #12
    Join Date
    Feb 2006
    Posts
    433
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by GoF View Post
    Aren't these from kaitnieks.com..? Maybe you should credit kait for making the standards, if they are from kaitnieks.com
    Quote Originally Posted by Bam Bam View Post
    Everyone adapts their own standards anyway. Mine are like:

    SCAR Code:
    procedure DoSomething(Param : Integer);
    var
      I : Integer;
    begin
     I:= Param * (Param * 100) / 100;
     if(Something)then
       begin
        DoSomething;
        Etc;
       end
     else
       DoSomethingElse;
    end;

  13. #13
    Join Date
    Feb 2007
    Location
    Het ademt zwaar en moedeloos vannacht.
    Posts
    7,211
    Mentioned
    26 Post(s)
    Quoted
    72 Post(s)

    Default

    Quote Originally Posted by Bam Bam View Post

    edit: beaten by Spky, only one minute!!!1!11!!!
    I made a new script, check it out!.

  14. #14
    Join Date
    Sep 2006
    Location
    New Jersey, USA
    Posts
    5,347
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Awesome tut for beginners; maybe this should get stickied?
    Interested in C# and Electrical Engineering? This might interest you.

  15. #15
    Join Date
    Nov 2006
    Location
    NSW, Australia
    Posts
    3,487
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Nice bump Smartz
    [CENTER][img]http://signatures.mylivesignature.com/54486/113/4539C8FAAF3EAB109A3CC1811EF0941B.png[/img][/CENTER]
    [CENTER][BANANA]TSN ~ Vacation! ~ says :I Love Santy[/BANANA][/CENTER]

    [CENTER][BANANA]Raymond - Oh rilie? says :Your smart[/BANANA][/CENTER]

  16. #16
    Join Date
    Apr 2007
    Location
    Texas
    Posts
    1,668
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i think this si worth a bump, I havnt found a place to be as detailed and definative as this. I wil have to change a few things.

    yes!! smei colons!!!!!

    no!! no caps lol
    [IMG]http://farm3.static.flickr.com/2120/2052732965_348f3629d0_o.jpg[/IMG]

  17. #17
    Join Date
    Mar 2006
    Location
    USA
    Posts
    948
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    If this got stickyfied it would be my first sticky

    Edit:

    Thanks Wizzup

  18. #18
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,691
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    First Sticky.



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

  19. #19
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    A little late, but thanks for these Bam Bam. They make scripts look very neat, which is a necessity for running any type of script.

  20. #20
    Join Date
    Jun 2007
    Posts
    56
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Useful for organizing the scripts!

  21. #21
    Join Date
    Sep 2007
    Posts
    24
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i wish someone could learn me scripting step by step send me mail if u want to

  22. #22
    Join Date
    Sep 2006
    Posts
    457
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    kk great you don't need to post ur URL on my script. You script your way i'll script mine. So don't be a narb and just post ur URL and nothing else.
    Finished my curser ---> it's in mage section.

  23. #23
    Join Date
    Sep 2007
    Posts
    50
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks for helping me!

  24. #24
    Join Date
    Jul 2007
    Posts
    33
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks Nice tut! Really Helped.

  25. #25
    Join Date
    Oct 2007
    Posts
    15
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks for this dude, I am VERY new to scripting. I will make all my scripts to these standerds. Thanks!

Page 1 of 3 123 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Script standards
    By Zezi in forum OSR Help
    Replies: 2
    Last Post: 04-03-2008, 07:47 PM
  2. Scar Scripting Standards
    By Ejjman in forum Outdated Tutorials
    Replies: 9
    Last Post: 11-18-2007, 12:23 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
  •