SRL Archive - Other Scripts

Text Centering Tool


Dankness

2006-03-11 17:04:44

I wrote this to help center by text in info boxes on my scripts and stuff but i find it useful maybe someone else will to. :cool:


program TextCenterToolbyDankness;
// This Program will center text enter the longest string as Text1 then enter the shorter strings as text2


var Text1,Text2,Temp : String;
O , C, D: Integer;
begin
Text1 := Readln('Enter The Longest String Here');
Text2 := Readln('Enter The Shorter String Here');
C := Length ( Text1 ) - Length ( Text2 );
D := C / 2;
Writeln (' The Difference is : ' + IntToStr ( Length ( Text1 ) - Length ( Text2 ) ) );
Writeln (' Center Point is : ' + IntToStr (D ) );
Temp := '';
for O := 1 to d do Temp := Temp + Chr(32);
Temp := Temp + Text2;
for O:=1 to d do Temp := Temp + Chr(32);
Writeln ( Text1 );
Writeln ( Temp );
end.

Jagex_Fagex

2006-03-11 18:00:59

really nice work man, if we put this in an include or procedure, we could use it to make neater progress reports… try get it in srl?

Dankness

2006-03-11 18:43:39

lol thank you im glad someone appreceated its usage, i actually wrote it for Progress Reports and for my forum posts :P

XxKanexX

2006-03-11 20:20:32

Good Job :)

You could add in there:

if(length(Text1) < length(Text2))then
exit;
Just if it's used accidently or wrong. D:

Dankness

2006-03-11 22:19:14

From: XxKanexX
Good Job :)

You could add in there:

if(length(Text1) < length(Text2))then
exit;
Just if it's used accidently or wrong. D:


Lol i will add it when i figure out a better use for this, i only wrote it to center my version numbers under my ascii fonts on my script intros lol.