*****************************************************
*          *
* STORY.CMD    Display story of * person and  *
* version 1.0  allow editing or appending.    *
*****************************************************

*** DISPLAY SCREEN HEADER ***

FIND &CURPER
ERASE

@ 1,18 SAY "S T O R Y   O F "
@ 2,15 SAY TRIM(FIRST:NAME)+" "+ TRIM(MID:NAME)+' '+TRIM(LAST:NAME)+'   ('+REF:NO+')'
@ 3,18 SAY "Born:"
@ 3,24 SAY BIRTH:DATE USING "#### ##/##"
IF DEATH:DATE
 @ 3,36 SAY "Died:"
 @ 3,42 SAY DEATH:DATE USING "#### ##/##"
ENDIF
@ 4,0 SAY "__________________________________________________"

*** SEE IF THERE'S A STORY ON FILE ***

USE STORIES INDEX STORYREF
FIND &CURPER
IF #=0
 @ 22,0 SAY "No story on file for this person. TYPE ANY KEY"
 WAIT
ELSE

*** DISPLAY THE STORY ON THE SCREEN

 STORE 6 TO MAX
 @ 6,0
 DO WHILE MAX
  ? TEXT
  SKIP
  IF CURPER<>REF:CODE .OR. EOF
   STORE 0 TO MAX
  ELSE
   IF MAX=19
    @ 22,0 SAY "TYPE ANY KEY TO CONTINUE"
    WAIT
    STORE 6 TO MAX
    DO WHILE MAX<22
     STORE STR(MAX,2) TO LINE
     @ &LINE,0
     STORE MAX+1 TO MAX
    ENDDO
    @ 6,0
   ELSE
    STORE MAX+1 TO MAX
   ENDIF
  ENDIF
 ENDDO
ENDIF

*** OFFER TO LET HIM QUIT EDIT OR APPEND ***

STORE "Q" TO COMMAND
@ 22,0 SAY "(Q)uit, (E)dit story, or (A)ppend to story? " get command picture '!'
READ
IF COMMAND="E"
 IF #
  FIND &CURPER
  BROWSE
 ELSE
  @ 22,0
  @ 22,0 SAY "SORRY I CAN'T EDIT A STORY THAT DOESN'T EXIST. Type any key."
  WAIT
 ENDIF
ELSE
 IF COMMAND="A"
  ERASE
  SET INTENSITY OFF
  @ 11,10 SAY "Remember. When appending for this person,"
  @ 13,20 SAY " REF:CODE = "+CURPER
  SET INTENSITY ON
  @ 22,0 SAY "TYPE ANY KEY TO CONTINUE"
  WAIT
  SET CARRY ON
  APPEND
 ENDIF
ENDIF

*** FINISH UP BY OPENING UP FILES AND REDISPLAYING OLD FAMILY ***

STORE M1 TO CURPER
USE PERSONS INDEX REF,FATHER,MOTHER,NAME
DO EXPLORE1

RETURNSTORE 0 TO MAX
		ELSE
			IF MAX=19
				@ 22,0 SAY "TYPE ANY KEY TO CONTINUE"
				WAIT 
				STORE 6 TO 