PDA

View Full Version : Awriteln



jhildy
08-15-2007, 11:44 PM
yea i was bored and decided to write this its kinda fun for sigs in the beginning of scripts or whatever but yea
program New;

//this writes into the debug box in a progressive order by letters
//with a wait time between letters of wait
Procedure AWriteLn(Text: string; wait: integer);
var i: integer;
begin
for i:=1 to length(text) do
begin
cleardebug;
writeln(copy(text,0,i));
sleep(wait);
end;
end;

begin
Awriteln('Im jhild and im sweet',200);
end.

bullzeye95
08-15-2007, 11:52 PM
Simple little thing :p

But to make it better, you could do Procedure AWriteLn(Text: string; wait: integer);
var i: integer;
begin
for i:=1 to length(text) do
begin
DeleteDebugLine(GetDebugLineCount);
writeln(copy(text,0,i));
sleep(wait);
end;
end;
It will get just delete the last line, not the whole debug box.

jhildy
08-16-2007, 01:04 AM
yea but it doesn't matter that much.

R0b0t1
08-16-2007, 01:50 AM
Yes it does Jhildy. Unless you cleared it before though.

jhildy
08-16-2007, 02:16 AM
i clear it every time

dvdcrayola
08-16-2007, 06:52 AM
just curious, what is the use of this? or was it just for fun.

ZephyrsFury
08-16-2007, 08:38 AM
Just for fun and making your script look a little better.

Killerdou
08-16-2007, 08:50 AM
strings start with 1 right not with 0(the first character is character # 1)

ZephyrsFury
08-16-2007, 09:03 AM
I thought it was 0. Thats why in his procedure it starts and 0 and finishes with i.

R0b0t1
08-16-2007, 08:33 PM
Arrays in SCAR start with 0, therefore, having a string start with 0 is very logical.

dvdcrayola
08-17-2007, 05:57 AM
they start with 1, not 0.

i neeeded to know this so i ran a couple of tests to find out.

TOB
08-17-2007, 09:47 AM
they start with 1, not 0.

i neeeded to know this so i ran a couple of tests to find out.

Wrong, arrays in every language start with 0. SCAR is no exception.


Simple little thing :p

But to make it better, you could do Procedure AWriteLn(Text: string; wait: integer);
var i: integer;
begin
for i:=1 to length(text) do
begin
DeleteDebugLine(GetDebugLineCount);
writeln(copy(text,0,i));
sleep(wait);
end;
end;
It will get just delete the last line, not the whole debug box.

Needs to be flopped so it's as such to properly work:

procedure AWriteLn(Text: string; wait: Integer);
var i: Integer;
begin
for i:=1 to Length(text) do
begin
Writeln(copy(text,0,i));
DeleteDebugLine(GetDebugLineCount);
Sleep(wait);
end;
end;

Hugolord
08-17-2007, 09:49 AM
edit your post! :google: lol jk jk :p nice idea jhildy

TOB
08-17-2007, 09:50 AM
edit your post! :google: lol jk jk :p nice idea jhildy

Already did ;)

dvdcrayola
08-17-2007, 04:15 PM
[QUOTE=TOB;187662]Wrong, arrays in every language start with 0. SCAR is no exception.
QUOTE]

i was talking about strings..


program New;
{.include SRL\SRL.Scar}


const
VersionNumber = ('1.0');
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;

procedure Proggie;
begin
WriteProgln('WPL surround /\ Boreass PowerChopper',50,'|','|')
WriteProgln('WPL easter egg +-+',50,'|','|');
WriteProgln('DvdCrayolas And Dr.Newhearts Varrock Oak Owner',50,'|','|');
WriteProgln('WPL easter egg +-+',50,'|','|');

end;

begin
SetupSRL;
Proggie;
end.

try that.. and then change line 17 to: delete(TheStr, 0, 16);

it wont work right