home *** CD-ROM | disk | FTP | other *** search
- Script
- ;=========================
- ; BlackJack Script Game
- ; File Name : BJ.SCR
- ;Last Changed : 03/27/1988
- ; Written By : Chris King
- ; Version 1.32
- ;=========================
- ;
- ;7/18/88
- ;I have done some changes to the BJ script file, you only need this file to
- ;run BJ and now it also saves the users money for the next time they play.
- ;Change string varibles [Pathname] to the drive and folder for BJ files and
- ;[Users] to the number of users on your BBS. The users score is saved in
- ;BJPLAYER.DAT, when a users score is 0 their money will reset back to 100.
- ;To restart all users money back to 100 just delete file BJPLAYER.DAT.
- ;If you have problems or questions with the STuff I have added send your
- ;message to Eric Crofut - GEnie E.CROFUT.
-
- Abort Off
-
- DefineVars:
- String Counter ; Counter for FOR/NEXT
- String WV1 ; Temp Work Variable
- String WV2 ; Temp Work Variable
- String WV3 ; Temp Work Variable
- String UInput ; User Input Variable
- String Top = ' ____ ' ; User Input Variable
- String Blank = '|____|' ; User Input Variable
- String UHand = ' ' ; Users hand - up to 7 cards
- String DHand = ' ' ; Dealers hand - up to 7 cards
- String THand = ' ' ; Holds hand to display
- String TNo = '0' ; Number of cards in hand
- String Cards ; Cards are shuffled into here
- String Suits ; Suits are shuffled into here - not used
- String CDLeft = '52' ; Number of cards left in the playing deck
- String UNo = '0' ; number of cards in users hand
- String DNo = '0' ; number of cards in dealers hand
- String Lit1 = '___ \rPlayers Hand \b___'
- String Lit2 = '___ \rDealers Hand \b___'
- String UTot = '0' ; Total value of users hand
- String DTot = '0' ; Total value of dealers hand
- String Turn ; Flag for finished dealing
- String Money ;* = '100' ; User starts out with $100
- String Bet = '0' ; Users Bet this hand
- String BJ ; Flag - if player or dealer has BJ
- String DSec ; temp hold dealers second card
- String PBJ = 'Player Has \rBlackJack!\b' ; Player BJ Msg
- String PWin = 'Player \rWins!\b' ; Player Won Msg
- String PBust = 'Player Busted...' ; Player Busted Msg
- String DBJ = 'Dealer Has \rBlackJack!\b' ; Dealer BJ Msg
- String DWin ; Dealer Won Msg
- String PMsg ; Player Msg Line
- String DMsg ; Dealer Msg Line
- String Pathname = 'g:\' ; Drive and Folder name for BJ Files
- String Users = '300' ; Number of users on your BBS
- String PId ;* Player ID number
-
- String Var10
- String Var11
- String Var12
- String Var13
- String Var14
- String Var15
- String Var16
- String Var17
- String Var18
- String Var19
- String Var20
- String Var30
- String Var31
- String Var32
- String Var51
- String Var52
-
- String Var0
- String Var1
-
- Load_Player: ;* added to Load Player's Money
- PId = '&31'
- PId = PId * 8
- Decrease PId 8
-
- If File_Exists '[Pathname]bjplayer.dat'
- Open '[Pathname]bjplayer.dat', Input
- Point PId
- Finput Money
- Close
- else
- Printe 'Please Wait, Creating User Log Data...'
- Open '[Pathname]bjplayer.dat',output
- For Var0 = 1 to Users do
- Fprint '100 '
- Endfor
- Close
- Money = '100'
- Endif
-
- If Money = '0'
- Money = '100'
- endif
-
-
- Start_Msg:
-
- BJ_Play:
- Goto Get_Bet
-
- ShowHand:
- For [Counter] = 1 to [Tno]
- Print ' ____ '
- EndFor
- PrintE
- For [Counter] = 1 to [Tno]
- WV1 = Copy (THand, Counter, 1)
- Print ' |[WV1] |'
- EndFor
- PrintE
- For [Counter] = 1 to [Tno]
- Print ' | |'
- EndFor
- PrintE
- For [Counter] = 1 to [Tno]
- WV1 = Copy (THand, Counter, 1)
- Print ' |___[WV1]|'
- EndFor
- PrintE
- Return
-
- Header:
- Clear Screen
- PrintE
-
- If [Bet] # 0
- PrintE '\bCurrent Winnings: \r$[Money]\b Bet: \r$[Bet]\b'
- Else
- PrintE 'BlackJack',center
- PrintE '-----------------------',center
- PrintE '\bCurrent Winnings: \r$[Money]\b',center
- Endif
- Return
-
- CK_Face:
- If [WV1] < 10
- Return
- Ef [WV1] = A
- Set [WV1] = 11
- Else
- Set [WV1] = 10
- Return
- Endif
- Set [WV2] = [WV2] + [WV1]
- If [WV2] > 21 ; An Ace and Tot would be over 21, so set Ace to 1
- Set [WV1] = 1
- Endif
- Return
-
- Shuff:
- Shuffle [Cards] [Suits]
- Set [CDLeft] = 52
- Return
-
- Get_Bet:
- Set [Bet] = 0
- Gosub Header
- PrintE
- Print 'Place Your \rBet\b (Q=Quit)==> ',center
- Input [Bet] 4 NoReturn
- If [Bet] = 0
- Goto Get_Bet ;* fixed bug - wrong name - was just (Bet)
- Ef [Bet] = 'Q'
- Goto Save_Score
- Ef [Bet] > [Money]
- Set [Bet] = [Money]
- Endif
-
- Start:
- Set [UHand] = ''
- Set [DHand] = ''
- Set [UNo] = '0'
- Set [DNo] = '0'
- Set [Utot] = '0'
- Set [Dtot] = '0'
- Set [Turn] = ''
- GoSub Shuff
-
- Deal1:
- If [CdLeft] < 11
- GoSub Shuff
- Endif
-
- WV1 = Copy (Cards, CdLeft, 1) ;Users 1st card
- Set [UHand] = '[Uhand][WV1]'
- Set [WV2] = [UTot]
- Gosub CK_Face
- Set [Utot] = [UTot] + [WV1]
- Set [Uno] = [UNo] + 1
- Set [CDLeft] = [CdLeft] - 1
-
- WV1 = Copy (Cards, CdLeft, 1) ;Users 1st card
- Set [DHand] = '[Dhand][WV1]'
- Set [WV2] = [DTot]
- Gosub CK_Face
- Set [DTot] = [DTot] + [WV1]
- Set [DNo] = [DNo] + 1
- Set [CDLeft] = [CdLeft] - 1
-
- WV1 = Copy (Cards, CdLeft, 1) ;Users 1st card
- Set [UHand] = '[Uhand][WV1]'
- Set [WV2] = [UTot]
- Gosub CK_Face
- Set [Utot] = [UTot] + [WV1]
- Set [UNo] = [UNo] + 1
- Set [CDLeft] = [CdLeft] - 1
-
- WV1 = Copy (Cards, CdLeft, 1) ;Users 1st card
- Set [DSec] = [WV1]
- Set [DHand] = '[Dhand]*'
- Set [WV2] = [DTot]
- Gosub CK_Face
- Set [DTot] = [DTot] + [WV1]
- Set [DNo] = [DNo] + 1
- Set [CDLeft] = [CdLeft] - 1
-
- Display:
- If [UHand] = AK
- Set [BJ] = P
- Ef [UHand] = KA
- Set [BJ] = P
- Ef [UHand] = AQ
- Set [BJ] = P
- Ef [UHand] = QA
- Set [BJ] = P
- Ef [UHand] = AJ
- Set [BJ] = P
- Ef [UHand] = JA
- Set [BJ] = P
- Ef [DHand] = AK
- Set [BJ] = D
- Ef [DHand] = KA
- Set [BJ] = D
- Ef [DHand] = AQ
- Set [BJ] = D
- Ef [DHand] = QA
- Set [BJ] = D
- Ef [DHand] = AJ
- Set [BJ] = D
- Ef [DHand] = JA
- Set [BJ] = D
- Else
- Set [BJ] = ''
- Endif
-
- Set [PMsg] = ''
- Set [DMsg] = ''
- If [BJ] = P
- Set [PMsg] = [PBJ] ; Player has BJ
- Ef [BJ] = D
- Set [DMsg] = [DBJ] ; Player has BJ
- Endif
-
- Gosub Header
- PrintE '\rYour Hand Totals: \b[UTot]'
- Set [TNo] = [UNo]
- Set [THand] = [UHand]
- Gosub ShowHand ; Show Players Hand
- PrintE
- PrintE '[Lit1] [PMsg]'
- PrintE
- ;PrintE ' Dealers Hand Totals: [DTot]'
- Set [TNo] = [DNo]
- Set [THand] = [DHand]
- Gosub ShowHand ; Show Dealers Hand
- PrintE
- PrintE '[Lit2] [DMsg]'
-
- If [BJ] = P
- Set [Money] = [Money] + [Bet]
- Goto PlayAgain
- Ef [BJ] = D
- Set [Money] = [Money] - [Bet]
- Goto PlayAgain
- Endif
-
- Status:
- If [UTot] > 21 ;Player busted
- Goto Busted
- Ef [DTot] > 21
- PrintE '[PWin] \r$[Bet]\b' Center ;Dealer Busted
- Set [Money] = [Money] + [Bet]
- Goto PlayAgain
- Ef [UNo] = 5
- PrintE '[PWin] \r$[Bet]\b' Center ;Player has 5 cards
- Set [money] = [Money] + [Bet]
- Goto PlayAgain
- Ef [DNo] = 5
- Set DWin = 'Dealer Has 5 Cards - Dealer \rWins\b'
- PrintE [DWin] Center ;Dealer Wins
- Set [Money] = [Money] - [Bet]
- Goto PlayAgain
- Ef [Turn] = F
- Goto Done
- Else
- Goto Hit
- Endif
-
- Done:
- If [UTot] = [DTot]
- PrintE '\rDraw\b... No Winner' Center ;Draw - No Winner
- Goto PlayAgain
- Ef [DTot] > [UTot]
- Set [Money] = [Money] - [Bet]
- Set DWin = 'Dealer Has \r[DTot]\b - Dealer \rWins\b'; Dealer Won Msg
- PrintE [DWin] Center ;Dealer Wins
- Goto PlayAgain
- Ef [UTot] > [DTot]
- Set [Money] = [Money] + [Bet]
- PrintE '[PWin] \r$[Bet]\b' Center ;Player Wins
- Goto PlayAgain
- Endif
-
- Hit:
- PrintE
- Print ' \{\rH\b\}it Me Or Any Key To \rStay\b ==> ' ;* Changed command
- Get_Key [UInput] ;* Changed to Get_Key
- If [UInput] = 'H' ;* Look for H not RETURN now
- PrintE 'Hit' ;* Print Hit
- Goto NextCard
- Else
- PrintE 'Stay' ;* Print Stay
- Goto DealCont
- Endif
-
- NextCard:
- If [UInput] = 'H' ;* Hit me
- WV1 = Copy (Cards, CdLeft, 1) ;Users Next card
- Set [UHand] = '[Uhand][WV1]'
- Set [WV2] = [UTot]
- Gosub CK_Face
- Set [UTot] = [UTot] + [WV1]
- Set [Uno] = [UNo] + 1
- Set [CDLeft] = [CdLeft] - 1
- Goto Display
- Endif
-
- DealCont:
- WV1 = Copy (DHand, 1, 1) ;Turn dealers 2nd card up
- Set [DHand] = [WV1]
- Set [DHand] = '[DHand][DSec]'
- Goto CKDeal
-
- DealNext:
- WV1 = Copy (Cards, CdLeft, 1) ;Dealers Next card
- Set [DHand] = '[Dhand][WV1]'
- Set [WV2] = [DTot]
- Gosub CK_Face
- Set [DTot] = [DTot] + [WV1]
- Set [DNo] = [DNo] + 1
- Set [CDLeft] = [CdLeft] - 1
-
- CKDeal:
- If [DTot] > 21
- Set [Turn] = F
- Goto Display
- Endif
- If [DNo] = 5
- Set [Turn] = F
- Goto Display
- Endif
- If [DTot] < 19
- Goto DealNext
- Endif
- Set [Turn] = F
- Goto Display
-
- Busted:
- PrintE [PBust] Center ;Player Busted
- Set [Money] = [Money] - [Bet]
- ; If [Money] = 0
- ; Print 'Press <\rRETURN\b> ' Center
- ; Input [UInput] 2
- ; Endif
-
- PlayAgain:
- If [Money] = 0
- PrintE
- PrintE
- PrintE '\bYour \rF\bl\ra\bt \rB\br\ro\bk\re\b!' Center
- PrintE
- PrintE 'Stay Away From Atlantic City...' Center
- PrintE
- PrintE '\rBetter Luck\b Next Time.' Center
- PrintE
- Foreground Black
- Print 'Press <\rRETURN\b> ' Center
- Input [UInput] 2
- Goto Save_Score
- Endif
- PrintE
- Print 'Press <\rRETURN\b> To Continue ' Center
- Get_Key [UInput] ;* Changed to Get_Key
-
- If [UInput] = Q
- PrintE 'Quit' ;* added print Quit
- Goto Save_Score
- Ef Time_Exceeded
- PrintE 'Sorry Your Out Of Time!' ;* added print out
- Goto Save_Score
- Else
- Goto Get_Bet
- Endif
-
-
- Save_Score:
- PrintE
- PrintE
- Print 'Recording Your Score of \r$[Money]\b' Center
-
- Record:
- if file_exists '[pathname]bjscore.txt' * added
- Open '[Pathname]BjScore.Txt' Input
- Finput [Var51] ; High Score Player
- Finput [Var52] ; High Score Wins
- Finput [Var11] ; Player1
- Finput [Var12] ; Player2
- Finput [Var13] ; Player3
- Finput [Var14] ; Player4
- Finput [Var15] ; Player5
- Finput [Var16] ; Player6
- Finput [Var17] ; Player7
- Finput [Var18] ; Player8
- Finput [Var19] ; Player9
- Finput [Var20] ; Player10
- Close
- endif
-
- Set [Var30] = &1 ; Users Handle
- Set [Var31] = &24 ; Todays Date
- Set [Var32] = [Money] ; Winnings
-
- Open '[Pathname]BjScore.Txt' Output
- If [Var32] > [Var52] ; See if this guy is High Scorer
- Set [Var51] = '[Var30][Var31] $[Var32]'
- Set [Var52] = [Var32]
- Endif
- FprintE [Var51]
- FprintE [Var52]
-
- Expand [Var30] 22
- If [Money] > 0
- Set [Var10] = '[Var30][Var31] $[Var32]'
- Else
- Set [Var10] = '[Var30][Var31] Busted'
- Endif
- FprintE [Var10] ; Post Players Score
- FprintE [Var11] ; roll the others
- FprintE [Var12]
- FprintE [Var13]
- FprintE [Var14]
- FprintE [Var15]
- FprintE [Var16]
- FprintE [Var17]
- FprintE [Var18]
- FprintE [Var19]
-
- Close
-
-
- Expand Money 6
-
- Open '[pathname]bjplayer.dat', Append
- point PId
- Fprint Money
- Close
-
- PrintE
- Print 'Your Score Has Been Posted.' Center
-
-
- Display_Scores:
- Clear Screen
- PrintE
- Foreground Red
- PrintE 'BlackJack ScoreBoard' Center
- Foreground Black
- PrintE '------------------------------' Center
-
- Open '[Pathname]BjScore.Txt' Input
- Finput [Var1] ; Read High Score Player
- Finput [Var0] ; Dummy read to position past High Score
-
- PrintE '* * * * * \rHigh Score \b* * * * *' Center
- PrintE
- PrintE [Var1] Center
- PrintE
- Foreground Red
- PrintE 'Last \b10\r Players' Center
- Foreground Black
- PrintE '---------------' Center
- Foreground Red
- PrintE 'Users Name Date Amount' Center
- Foreground Black
- PrintE '--------------------- -------- ------' Center
-
- Read:
- Finput [Var1] ; Player
- if var1 = '' ;* added
- goto read
- endif
-
- Expand [Var1] 38
- PrintE [Var1] Center
- Goto Read
-
- EOF:
- Close
- Print 'Press <\rRETURN\b> To Continue' Center
- Input [Var1] 1
-
- ; execute 'menu.scr' ; run another menu