WriteProgln
Alright, well.. this procedure is for making your progress reports look nice.. I had the basic idea and motions, but it didnt work, so i asked boreas to help and he changed it(quite a bit) and added the easter egg, then i added the surround.
The Procedure
SCAR Code:
procedure WriteProgln (TheStr:string; Width:integer;LeftEdge,RightEdge:string);
var
lstr,rstr,middle,lch,rch : string;
Left,right,iter,space,sur : integer;
begin
sur:=Pos('WPL surround',TheStr);
if sur<>0 then
begin
lch:= copy(TheStr,sur+13,1);
rch:= copy(TheStr,sur+14,1);
delete(TheStr, 1, 16);
space:=Width-length(TheStr);
if space<0 then space:=0;
if (space mod 2)=0 then
begin
Left:=space/2;
Right:=Left;
end;
if (space mod 2)<>0 then
begin
Left:=round((space/2)-0.5);
Right:=Left+1;
end;
for iter:=0 to left do
lstr:=lstr+lch;
for iter:=0 to right do
rstr:=rstr+rch;
writeln(LeftEdge+lstr+TheStr+rstr+RightEdge);
Exit;
end;
space:=Pos('WPL easter egg',TheStr);
if space<>0 then
begin
for iter:=0 to Width+1 do
middle:=middle+copy(TheStr,space+16,1);
writeln(copy(TheStr,space+15,1)+middle+copy(TheStr,space+17,1));
exit;
end;
space:=Width-length(TheStr);
if space<0 then space:=0;
if (space mod 2)=0 then
begin
Left:=space/2;
Right:=Left;
end;
if (space mod 2)<>0 then
begin
Left:=round((space/2)-0.5);
Right:=Left+1;
end;
for iter:=0 to left do
lstr:=lstr+' ';
for iter:=0 to right do
rstr:=rstr+' ';
writeln(LeftEdge+lstr+TheStr+rstr+RightEdge);
end;
How To Use
TheStr : what you want it to say
Width : how many charicters wide you want your proggy
LeftEdge : the char you want the left side to be... ONE CHARICTER
RightEdge : the char you want on the right side to be.. ONE CHARICTER
Special Features
Easter Egg: in 'TheStr' start it out with 'WPL easter egg{space}' and then the left edge you want, the fill you want, and the right edge you want
Does not use the left and right edge Parameters.
Surround: in 'TheStr' start it out with 'WPL Surround{space}' and then the left fill and the right fill...
Still uses the left edge and right edge Parameters.
Examples
WriteProgln('WPL easter egg +-+',55,'|','|');
Code:
+---------------------------------------------------------+
WriteProgln('The Restless Ghost Quest Runner',55,'|','|');
Code:
| The Restless Ghost Quest Runner |
WriteProgln('WPL surround <> hi',55,'|','|');
Code:
|<<<<<<<<<<<<<<<<<<<<<<<<<<<hi>>>>>>>>>>>>>>>>>>>>>>>>>>>>|
Please post ideas of other Hidden Features i could add. And if you use, please give credit to me, DVDcrayola, and Boreas.