Script
abort off
;========================================================================
;= Birthday v1.0           -  Feb 15, 1992 -                  By Big D  =
;= Rubber City Atari BBS   - 300/1200/2400 -               216/376-0885 =
;=                                                                      =
;= Thanks to Outrider from the Rebel BBS                   702/435-0786 =
;= for his Audit program which I modified to make this program.         =
;=                                                                      =
;= And thanks to Chuck Grimsby for his Todays program ver 1.95.         =
;= The program, that gives this script a reason to be written.          =
;= It will write and/or use a birthday dat file that is compatable with =
;= Todays v1.95.. So as the evens for the day are displayed so will the =
;= birthdays of your BBS's users... Read the read me file...            =
;========================================================================
;  
;             =======   IMPORTANT INFO  PLEASE READ ========    
;   Because of the script commands Copy and Expand do not want to work
;   properly with out being compiled!!!!
;             =======  YOU MUST COMPILE THIS SCRIPT =======
;             =======       BEFORE YOU RUN IT       =======
;   Edit the User-Definable Variables below, save it then compile it.
;   before you run it.. Other wise it will screw the data file.......

;~~~~~~~~~~~~~~~~~~~~~~~~ USER-DEFINABLE VARIABLES ~~~~~~~~~~~~~~~~~~~~~~

;                 Change these to match your BBS

string BBS  = 'Rubber City Atari'       ; Name of your BBS
string Log  = 'F:\RCACALL.LOG'          ; Your CALL LOG
string Path = 'F:\BIRTHDAY\'            ; PATH for your Data files

integer Total_Users = '300'             ; Maximum your Userlog is set for

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ OTHER VARIABLES ~~~~~~~~~~~~~~~~~~~~~~~~~~~

;                        Please do not change

var Key
var Line
var Temp
var Temp2
var BirthDay
var Birthday2

define Call = &27
string Date = &24
string Name = &1
string Name2

integer Np
integer Age
integer Count
integer Birth_Date
integer Birth_Year
integer Current_Day
integer Current_Date
integer Current_Year
integer Current_Month
integer Call_Num = &22
integer User_Num = &31
integer Screen_W = &11

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CHECK USER INFO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If file_exists '[Path]BirthDay.Dat'     ; Is this a first time run?
else
  gosub CREATE_DAT                      ; If so create dat file.
endif

if command_level 1                      ; Skip VISITORS
else
  goto EXIT_WELCOME
endif

Expand Name 30                          ; Set name to proper format
Np = User_Num * 42                      ; Set file pointer Much faster
Np = Np - 42                            ; then reading/writing whole file

if Call_Num = '1'                       ; Get info on their 1st call, if
  goto GET_INFO                         ;   not a Visitor.
endif

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ READ USER INFO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

READ_INFO:

open '[Path]BirthDay.Dat' input         ; Get their Birthday.
  point Np
  finput BirthDay 
close

if BirthDay = '*00000000 ------------------------------'; They haven't entered it yet.
  goto GET_INFO
endif

Name2 = copy (BirthDay, 11,30)
expand name2 30

if Name # Name2           ; Is the name the same? If not correct it.
  open Log append
  fprinte '           ***Name did not match Birthday.dat name***'
  fprinte '              User name : [Name]'
  fprinte '           Dat file name: [Name2]'
  close
  goto Get_Info 
Endif

Current_Year  = copy (Date, 7, 2)       ; Routine for parsering current
Current_Month = copy (Date, 1, 2)       ;   date.
Current_Day   = copy (Date, 4, 2)
Current_Date  = '[Current_Month][Current_Day]'

Birth_Year    = copy (Birthday, 8, 2)   ; Routine for parsering user's
Birth_Date    = copy (Birthday, 2, 2)   ; Date of birth.
Temp          = copy (Birthday, 4, 2)
Birthday2='[Birth_Date]/'
Birthday2='[Birthday2][Temp]/'
Birthday2='[Birthday2][Birth_Year]'
Birth_Date    = '[Birth_Date][Temp]'

if Birth_Date > Current_Date            ; See if they've had their birthday
  Birth_Year = Birth_Year + 1           ;   this year yet.
endif

Age = Current_Year - Birth_Year         ; Get the caller's age.


;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SAVE USER INFO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

WRITE_INFO:

open Log append
  fprinte '           Birth Date: [Birthday2]  Age: [Age] (&9)'
close

goto CHECK_FOR_BIRTHDAY

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GET INFO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GET_INFO:

clear screen
printe '\n\n'
printe '\n'
bell
printe '\g***\r You are being audited by  \g***' center
Printe '[BBS]\r' center
bell
Printe
printe 'We need this information for our files!' center
printe 'Please answer TRUTHFULLY.              ' center
Printe 'You will later be asked to verify this ' center
Printer'information, so it is imperative you   ' center
Printe 'enter the correct information.         ' center
printe '\n\n\b'

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GET BIRTHDAY ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
ENTER_BIRTHDAY:

Count    = '0'
BirthDay = ''

print  'Please enter your real \rBIRTHDAY\b (\gMM\b/\gDD\b/\gYYYY\b):\r '

GET_BIRTHDAY:

get_key Key

if Key = numeric
  print Key
else
  goto GET_BIRTHDAY                     ; If not numeric, ignore keypress.
endif

if Count > 0                            ; We need to convert the first
  goto GET_BIRTHDAY2                    ; digit from 0 to a space, if
endif                                   ; necessary, to match format of
                                        ; Express!.
if Key = '0'
  Key = ' '
endif

GET_BIRTHDAY2:

BirthDay = '[BirthDay][Key]'            ; Add keypress to BirthDay string.
increase Count

if Count = '2'
  print '\g/\r'                         ; Date separator.

ef Count = '4'
  print '\g/\r'

ef Count = '8'
   goto EXIT_BIRTHDAY
endif

goto GET_BIRTHDAY

EXIT_BIRTHDAY:

printe '\n'
print  'Are you absolutely sure that is your correct birthday (y/N)?\b '
get_key Key

if Key # 'Y'
  printe 'No\n'
  goto ENTER_BIRTHDAY
endif

printe 'Yes\n\n'

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SAVE DATA ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SAVE_DATA:

printe '\gPlease wait while I save your data'

Temp2 = 'I[Birthday] [Name]'

open '[Path]BirthDay.Dat' append
  point Np
  Fprinte Temp2
close

goto READ_INFO

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CREATE DATA FILES ~~~~~~~~~~~~~~~~~~~~~~~~~~~

CREATE_DAT:

Printe 'Creating Dat files, Please wait one '

open '[Path]BirthDay.Dat' output        ; Create initial BIRTHDAY.DAT.
  for Key = 1 to Total_Users
    fprinte '*00000000 ------------------------------'
  endfor
close

Printe 'Thank you for waiting'

return

;~~~~~~~~~~~~~~~~~~~~~~~~ CHECK IF CALLER'S BIRTHDAY ~~~~~~~~~~~~~~~~~~~~~~

CHECK_FOR_BIRTHDAY:

if Birth_Date # Current_Date            ; Check if their birthday is today.
  goto EXIT_WELCOME                     ; If not, we goto WELCOME.
endif

clear screen
bell
view '[Path]Birthday.Txt'               ; Show them BIRTHDAY.TXT.

open Log append
  fprinte '           *****  H A P P Y   B I R T H D A Y  *****'
  close
print 'Press <\rAny Key\b> To Continue\g...\b' center
get_key Key
printe '\n\n'

;~~~~~~~~~~~~~~~~~~~~~~~~~~ END OF WELCOME.SCR HERE ~~~~~~~~~~~~~~~~~~~~~~~

EXIT_WELCOME:

exit                                    ; Or whatever else you want to add.


