Ejjman
2007-01-20 19:19:00
Ok, I know other people have done this, but I once didn't know them, and the tutorials didn't help me. So, I went into detail on this subject as I like standardizing scripts now.
This below is the Un-Standardized Script we will be using. It is a simple program to write something in the debug.
Ok, so here's our basic script. All it does is says Hi every second until we say it 10 times, or until we say it howmanytimes we have set to. Let's start at the beginning.
This is not neccesarily standardizing your script, but it can make it look a lot fancier. What you want to do is put the vars and consts in a second line, making it easier to read. Like this.
You do not need a second const or var when having another one, just keep it under the const/var word. :)
Now, lets do the Procedure.
Let's move down the line. First, the standards are two spaces, not a tab, just two spaces. The beginning line is always on the same row as the procedure, but after that, is when you put the spaces. Then, you put two spaces after the repeat also, because this is as if we are using another begin, but we are going to repeat what is in the repeat..until things multiple times. So, now that you have two-spaced all your stuff inside of the repeat. So, your code should look like this.
Let's move right on down.
This last part, you should be able to do. Try it on your own!….Ok, so if you know scripting, then this would be called the 'main loop' of the script. It is not a procedure. But anyway, all you need to do is put two spaces before the stuff in the begin..end commands. And it should be…
Yay! You have standardized your first script! Good job, and I hope you can use this method to make your scripts more clear, and be able to contribute to the community. Thanks, and goodnight.
This below is the Un-Standardized Script we will be using. It is a simple program to write something in the debug.
program WriteInLine;
var writtenxtimes : integer;
const message1 = 'Hi';
const howmanytimes = 10;
procedure WriteIt;
begin
repeat
writeln(message1 + ' ' + inttostr(writtenxtimes + 1));
wait(1000);
writtenxtimes:= writtenxtimes + 1;
until(writtenxtimes >= howmanytimes)
writeln('Awesome, no?');
end;
begin
WriteIt;
writeln('Now we are done, finally!');
end.Ok, so here's our basic script. All it does is says Hi every second until we say it 10 times, or until we say it howmanytimes we have set to. Let's start at the beginning.
program WriteInLine;
var writtenxtimes : integer;
const message1 = 'Hi';
const howmanytimes = 10;This is not neccesarily standardizing your script, but it can make it look a lot fancier. What you want to do is put the vars and consts in a second line, making it easier to read. Like this.
program WriteInLine;
var
writtenxtimes : integer;
const
message1 = 'Hi';
howmanytimes = 10;You do not need a second const or var when having another one, just keep it under the const/var word. :)
Now, lets do the Procedure.
procedure WriteIt;
begin
repeat
writeln(message1 + ' ' + inttostr(writtenxtimes + 1));
wait(1000);
writtenxtimes:= writtenxtimes + 1;
until(writtenxtimes >= howmanytimes)
writeln('Awesome, no?');
end;Let's move down the line. First, the standards are two spaces, not a tab, just two spaces. The beginning line is always on the same row as the procedure, but after that, is when you put the spaces. Then, you put two spaces after the repeat also, because this is as if we are using another begin, but we are going to repeat what is in the repeat..until things multiple times. So, now that you have two-spaced all your stuff inside of the repeat. So, your code should look like this.
procedure WriteIt;
begin
repeat
writeln(message1 + ' ' + inttostr(writtenxtimes + 1));
wait(1000);
writtenxtimes:= writtenxtimes + 1;
until(writtenxtimes >= howmanytimes)
writeln('Awesome, no?');
end;Let's move right on down.
begin
WriteIt;
writeln('Now we are done, finally!');
end.This last part, you should be able to do. Try it on your own!….Ok, so if you know scripting, then this would be called the 'main loop' of the script. It is not a procedure. But anyway, all you need to do is put two spaces before the stuff in the begin..end commands. And it should be…
begin
WriteIt;
writeln('Now we are done, finally!');
end.Yay! You have standardized your first script! Good job, and I hope you can use this method to make your scripts more clear, and be able to contribute to the community. Thanks, and goodnight.
program WriteInLine;
var
writtenxtimes : integer;
const
message1 = 'Hi';
howmanytimes = 10;
procedure WriteIt;
begin
repeat
writeln(message1 + ' ' + inttostr(writtenxtimes + 1));
wait(1000);
writtenxtimes:= writtenxtimes + 1;
until(writtenxtimes >= howmanytimes)
writeln('Awesome, no?');
end;
begin
WriteIt;
writeln('Now we are done, finally!');
end.