SRL Archive - Research & Development Lounge

WriteProggy(Scriptname, authour, version:String; Lines:TStringArray);


MylesMadness

2008-11-19 21:17:42

Procedure WriteProggy(Scriptname, authour, version:String; Lines:TStringArray);
var
I, II:integer;
begin
For II:=1 to high(Lines)do
If Max(I, Length(Lines[I])) = Length(Lines[I])then
I:=Length(Lines[I]);
If I < Length(Scriptname) then
I:=Length(Scriptname);
Writeln('/'+Replicate('-', I)+'\');
Writeln('|'+Padr(ScriptName, I)+'|');
Writeln('|'+Padr('By:'+authour, I)+'|');
Writeln('|'+Padr('Version:'+version, I)+'|');
Writeln('|'+Replicate('-', I)+'|');
For II:=0 to high(Lines)do
Writeln('|'+Padr(Lines[II], I)+'|');
Writeln('\'+Replicate('-', I)+'/');
end;

Outputs a really nice proggy like this:

WriteProggy('Ess miner', 'wizzup', '1.0', ['Ess mined:235', 'Banked:23']);

Makes this:
/-------------\
|Ess miner |
|By:wizzup |
|Version:1.0 |
|-------------|
|Ess mined:235|
|Banked:23 |
\-------------/

Sandstorm

2008-11-19 21:36:08

Quite good.

Is there a way you can center the name of the script? I think it'd look better that way :P. Beyond that, no suggestions here.

Magiic

2008-11-20 15:07:45

you just add spaces when you enter it :p and it's cool

HarryJames

2008-11-20 16:05:23

If we use this Procedure, do we need to credit you?

MylesMadness

2008-11-20 17:41:10

Yes

HarryJames

2008-11-22 18:30:07

:D, kind of a stupid question, was tired.

Wizzup?

2008-11-22 18:54:09

Why not use
function Replicate(c: Char; I: LongInt): string;
instead of PadK?

TViYH

2008-11-22 19:14:29

Add this to Misc please. Or Globals, Setup, or wherever it needs to be added.

MylesMadness

2008-11-26 09:49:32

From: Wizzup?
Why not use
function Replicate(c: Char; I: LongInt): string;
instead of PadK?
Did not know that function existed. Updated