Results 1 to 5 of 5

Thread: Text Centering Tool

  1. #1
    Join Date
    Feb 2006
    Location
    Myrtle Beach, SC USA!
    Posts
    841
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default Text Centering Tool

    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.

    Code:
    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.

  2. #2
    Join Date
    Feb 2006
    Location
    Aussie
    Posts
    937
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    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?

  3. #3
    Join Date
    Feb 2006
    Location
    Myrtle Beach, SC USA!
    Posts
    841
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

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

  4. #4
    Join Date
    Feb 2006
    Location
    Australia, NSW.
    Posts
    1,461
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Good Job

    You could add in there:
    Code:
    if(length(Text1) < length(Text2))then
      exit;
    Just if it's used accidently or wrong. D:

  5. #5
    Join Date
    Feb 2006
    Location
    Myrtle Beach, SC USA!
    Posts
    841
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by XxKanexX
    Good Job

    You could add in there:
    Code:
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Grabbing or reading Text from a game text box
    By British in forum OSR Help
    Replies: 16
    Last Post: 02-27-2009, 08:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •