AT2k Design BBS Message Area
Casually read the BBS message area using an easy to use interface. Messages are categorized exactly like they are on the BBS. You may post new messages or reply to existing messages!

You are not logged in. Login here for full access privileges.

Previous Message | Next Message | Back to Computer Support/Help/Discussion...  <--  <--- Return to Home Page
   Networked Database  Computer Support/Help/Discussion...   [123 / 1628] RSS
 From   To   Subject   Date/Time 
Message   Nelgin    Sean Dennis   Re: Some programming help   July 20, 2019
 2:50 PM *  

Sean wrote:
S> Hello All,
S> 
S> I am trying to write a procedure in TP that will display a text string in 
S> random colors except that the color selection is only run once.  I know it's
a 
S> logic error but I can't seem to see it with my own eyes.  This is for my 
S> doorkit so there's some proprietary commands in here but this is what I have 
S> so far:

Oh, it looks like Randomize, in FreePascal, is based on the system clock,
and TurboPascal may be the same.

Consider this small program

Program Color;

Uses Crt;

procedure pausekey;
begin
  while (not keypressed) do
  begin
  end;
end;

var
  I, X : Integer;

begin
  for X := 1 to 20 do
  begin
    Randomize;
    I := Random(15);
    WriteLn('Number: ', X, ' is ', I);
    { Delay(1000); }
  end;
  pausekey;
end.

If yo run it without the delay, you get the same number or maybe you get two
numbers if it advances a second. Now include a 1 second delay by
uncommenting the delay command and you'll get different numbers.

If you need something faster, you'll probably have to come up with your own
solution.
--- SBBSecho 3.07-Linux
 * Origin: End Of The Line BBS - endofthelinebbs.com (618:250/19)
  Show ANSI Codes | Hide BBCodes | Show Color Codes | Hide Encoding | Hide HTML Tags | Show Routing
Previous Message | Next Message | Back to Computer Support/Help/Discussion...  <--  <--- Return to Home Page

VADV-PHP
Execution Time: 0.0159 seconds

If you experience any problems with this website or need help, contact the webmaster.
VADV-PHP Copyright © 2002-2024 Steve Winn, Aspect Technologies. All Rights Reserved.
Virtual Advanced Copyright © 1995-1997 Roland De Graaf.
v2.1.241108