home *** CD-ROM | disk | FTP | other *** search
- /* $VER: GreedMaint 2.0.2 (5/2/95) by Spike Dethman
- */
- /******************************/
- /* auto-maint module for */
- /* Greed2.0 P-file. */
- /* Set-up to run once per */
- /* week to reset game and */
- /* award bonus to winners. */
- /******************************/
-
- options results ; signal on SYNTAX ; signal on ERROR ; signal on IOERR
- tr = transmit ; gu = getuser
-
- bonuscred=100000 ; /* <<< byte creds awarded to week's winners */
- bonusfiles=2 ; /* <<< file credits awarded to winners */
-
- call GetPaths
-
- INIT:
- tr 'MAINT RUNNING: Updating GREED winners...'
- logentry ('Greed 2.0 reset to new game.')
- gu 12 ; enddate=left(result,15)
-
- tr ' Creating new '||NewsFile||'...'
- call open(f1,NewsFile,'w')
- call writeln(f1,'caGREED Winners----------cc')
- call writeln(f1,'For the week ending '||enddate||':')
- call writeln(f1,'')
-
- fn='GreedFive' ; call GETWIN
- tr ' Full Game Winner='||winner
- if winner~=0 then do ;
- call WINBONUS ; call MAILWIN ;
- end
-
- tr ' Clearing hi-scores.'
- call CLEARHI
- call writeln(f1,'cfTop Full Game Winner: '||winhandle)
- call writeln(f1,'Score='||winscore)
- call writeln(f1,'')
-
- fn='GreedFive-sh' ; call GETWIN
- tr ' Single Hand Winner='||winner
- if winner~=0 then do ;
- call WINBONUS ; call MAILWIN ;
- end
-
- tr 'Clearing sh-scores.'
- call CLEARHI
- call writeln(f1,'cbTop Single Hand Winner: '||winhandle)
- call writeln(f1,'Score='||winscore)
- call writeln(f1,'')
-
- if bonuscred>0 then do
- call writeln(f1,'ccThey Got '||bonuscred||' Credits for Being the GREEDIEST!')
- call writeln(f1,'')
- end
-
- call writeln(f1,'cfCongrats!')
- call writeln(f1,'')
- call writeln(f1,'c9A New Game Has Been Started!')
- call writeln(f1,'Will you be caGREEDYc9 this week, v1}?')
- call close(f1)
- tr 'News created.'
-
- /* Write new news date for login mod */
- f4='date' ; call open(f4,GreedPath||'GreedNewsDate','w')
- gu 12 ; date=result
- call writeln(f4,date)
- call close(f4)
- tr 'Updated News date - GreedMaint successful!'
- exit
- /* All Done!! */
-
-
- GETWIN:
- f2=score
- call open(f2,GreedPath||fn,'r')
- winhandle=readln(f2)
- winscore=readln(f2)
- winner=readln(f2)
- if winner=0 then winhandle='r1 Nobody this time! r0'
- call close(f2)
-
- return
-
-
- WINBONUS:
- winname=''
- loadscratch (winner) ; if result=0 then return
- getscratch (3) ; winname=result
-
- if bonuscred=0 then return
-
- getscratch (35) ; cred=result
- cred=cred+bonuscred ; setobject cred
- putscratch (35)
- getscratch (34) ; cred=result
- cred=cred+bonusfiles ; setobject cred
- putscratch (34)
- savescratch (winner)
-
- tr ' Awarded '||bonuscred||' credits, '||bonusfiles||' files.'
- logentry (winname||' awarded '||bonuscred||' credits.')
-
- return
-
-
- MAILWIN:
- call open(f3,GreedPath||'Greed Mail','w')
- call writeln(f3,'ccYou Were the TOP caGREEDcc Player This Week!')
- call writeln(f3,'With a score of: '||winscore||'!')
-
- if bonuscred>0 then do
- call writeln(f3,'')
- call writeln(f3,'cbYou WON '||bonuscred||' Credits!')
- end
-
- call writeln(f3,'')
- call writeln(f3,'cfCongrats, '||winname||', you GREEDY thing!')
- call close(f3)
-
- loadeditor (GreedPath||'Greed Mail')
- setmailsubj ('Congratulations!')
- writemail (winner)
-
- tr ' Sent congratulatory mail.'
- return
-
-
- CLEARHI:
- call open(f2,GreedPath||fn,'w')
- do x=1 to 5
- call writeln(f2,"Nobody Yet!") ; call writeln(f2,"0") ; call writeln(f2,"0")
- end x ; call close(f2)
- return
-
- SYNTAX:
- ERROR:
- IOERR:
- tr 'Error encountered at line '||sigl||' of GreedMaint.'
- logentry ('Error at line '||sigl||' of GreedMaint.')
- bufferflush ; exit
-
- GetPaths:
-