SRL Archive - Outdated Tutorials

Making Standards.


Sumilion

2006-09-21 12:08:32

As a iny tiny intro, standards are a sort of rules that you set up yourself, to make your script look better. As an example you could have :
If ( LoggedIn ) Then;
Begin
Procedure;
Procedure;
Repeat;
Procedure;
Until Not ( LoggedIn );
End;

First i would like to say, that Standards is something personal. Not personal as in a diary :p but it's most likely that only you script like that.

Spaces like this allows you and others who read the script to read it faster and with more understanding. The same If without standards would look like :
if(loggedin)then
begin
procedure;
procedure;
repeat;
procedure;
until not(loggedin)
end;
Which, in my opinion, looks way worse :). When i 'made' my standards ( it actually just popped out of nowhere ;)), i thought of a couple of things. One of those things would be capitals. I always use capitals in an If or a Repeat or End. I just think it makes it look better.

Then there are the spaces, those are the hart of standards. Without any spaces it would look like… shit :) a good example of well space use would probably be Wizzups and Fawki's standards. They use spaces like a mad man :p, but it actually doesnt look that bad :)

Function ThereIsFire(var WhereX,WhereY:integer):boolean;
var
acc,ref : Extended;
var
XT, YT,times,tol : Integer;
begin
ref:=0.8; tol:=1;
for times:=1 to 4 do
begin
FindDeformedBitmapToleranceIn(Fire, XT, YT, MSCX-(25*times),MSCY-(25*times),MSCX+(25*times),MSCY+(25*times), tol, 2, True, acc);
if (acc >= ref) then
begin
WhereX:=XT;
WhereY:=YT;
Result := True;
if FawkiDebug then writeln('Found Fire');
Exit;
end;
ref := ref - 0.1;
tol:=tol+10;
wait(1);
end;
Result:=False;
if FawkiDebug then writeln('Couldnt Find Fire');
end;
( borrowed from Ratz! :))

See how the space gives a sort of character to the script. Tho, as you can see, they aren't keen on the capital thing :).

Final word : Design your own standards, not that you have to look at all of the scripts and don't do those standards :), if it works for you, then it's ok. These were just examples, but doesnt standards make life much easier :D.

[Lol] It doesnt affect the way the script works :spot: [/Lol]

Yakman

2006-09-21 12:29:46

nice tutoral, to the point, it didnt drone on and on like mine does,

standards eh?
maybe i should start using them

oh im sorry

//Standards Eh ?
//Maybe I should Start using Them

also id like to point out that semicolons ; can be left out of places, they dont affect the script and i don think they dont look particlarly nice,

//spot the difference
mouse(x,y,4,4,true);
mouse(x,y,4,4,true)

Sumilion

2006-09-21 13:16:04

True, true, didn't drone on ? Please explain :duh: :p.

About the semicolon, i would prefer to use it. Not because it looks so sexy ^^, it just simply ends the Procedure/Function. A nasty side effect of not using the ; is that when your debugging, and you never placed a ; in your script, then it will most like say Error in line 1, or at least the line you have the first ; in, going op from the error. So let's make an example error :

(line 1) Mouse(X, Y, 5, 5, true)
(line 2) Mouse(X, Y, ^, 6, true)

this will give an error, obviously, because of the ^ instead of a number :duh: . But it won't say Error in line 2, but it will say Error in line 1. You see, when we do an enter, it means to us it ends the line, but to Scar, a ; means it ends the line. so this example counts as 1 line to scar.

That is, among other small reasons, the reason i use a semicolon, thnx for your reply tho :wink:

Yakman

2006-09-21 13:38:21

what i meant by droneing on is that your to the point, i drone on because i write for pages and pages

Sumilion

2006-09-21 13:41:53

Ahhh, yes, i like to be to the point ^^

mikev

2006-09-21 18:58:12

hehe cool TUT, now you won't have to explain it to noobs like me again :P

WhiteShadow

2006-09-21 19:13:42

Ew don't capitilize the bold. It's UGLY! My standards are just like Kaitnieks.

  • Don't capitilize the bold it's unneeded and ugly
  • Use the CamelBackStyle

Don't remember anymore of Kait's sayings.. :confused:

But, hells, yes, your own kind of standards is good. But make sure it's not tooo shitty. I would complain then. capitilizing stuff I don't care about. Lmao :D

procedure shit; 
var i : integer;
begin
i:=i+1
repeat
lalala
until(false)
if Isay then
begin
eeee
eeee;
end
end

stevenadrien

2006-09-21 19:52:41

Wait
So you are saying Standards is so that like if someone ever examines your script, it will be alot easier to understand. Is that it?

Bob Mrly

2006-09-21 21:27:06

I used to 'guess' on standards when I was begenning scar. I do standards like white shadow.

Yakman

2006-09-22 02:44:47

i have the same standards as the first scar script i saw : EvilEssenceMiner By Joker

well i have rubbish handwritting in real life too ;)

Wizzup?

2006-09-22 04:20:08

Yes, it really is something personal, because I do capitalize. :stirthepot:

Sumilion

2006-09-22 08:43:19

I do to,
@White Shadow, oops ^^, when kait was still up, i knew nothing of scar ^^, then i had a 'break' and once i came back to scar (around march) i found out that kait had a kid and quit his site. So no, i don't know any of his sayings ^^, care to share? :p

@StevenAdrien, yes, just look at the examples and judge them yourself ;)

bullzeye95

2006-09-22 19:36:20

From: WhiteShadow

  • Use the CamelBackStyle


What exactly is the CamelBackStyle?

WhiteShadow

2006-09-22 23:37:27

From: bullzeye95
What exactly is the CamelBackStyle?


Like this:

procedure choptree; 
begin
end;

Change to:

procedure ChopTree; 
begin
end;

Like at every word capitilize it. Now you get why it's called CamelBackStyle? ;]
It's neat like that.

So yea..

findcolortolerance use FindColorTolerance. isuptext use IsUpText.

Cheesehunk

2006-09-23 01:52:16

Nice tutoriol.. My standards are like Fakawi's for the most part. I would say Dankness has very good standards compared to the other scripts though.

inferno

2006-09-23 07:59:14

Everyone has their own standards, personally, I like capitalization. You won't change my mind on that. I don't really mind what some-ones standards look like as long as it's legible.

Sumilion

2006-09-23 10:48:52

You can't change my mind on the capitalizations aswell :p, well there are some things that would make me change :rolleyes: But that's why i said that standards is something personal, but it would be nice to have them. Cause most starters obviously start with no standards what so ever, that's why i made this tut…

EDIT : by the way, there are lots of responses to this thread, wouldnt thought that would happen :)

Killerdou

2006-12-31 08:53:47

its not only for others, but for yourself too… if you are ever to update your script… and it just looks cool:)

Sumilion

2006-12-31 17:17:20

Yea, though lots of people disagree with custom standards…

Lots of peeps follow these standards.

http://kaitnieks.com/scar/scriptingsta/