Gambler Cup Pick

*Created by Taz.*

```
Using "RC_Core.rcm"
; testingrc1 1.26
; Date/Time: 3:33:14 PM on 7/16/2010
; By Naddaz on TAZCO
;Textures
 ;ball center 423
;Ball Left 424
 ;Ball right 425
 ;cup center 426
 ;cup left 427
 ;cup right 428

 Function Main()
 Player = Actor()
 Target = ContextActor()

 PMoney% = Money(Player)
 BetChoice% = 0 ;players bet choice will be gone if/when script ends.

 ChatBox = OpenDialog(Player, Target, "Cup Gambling", 418)

         DialogOutPut(Player, ChatBox, "Can I interest you ", 230, 145, 23) ;Chat
        DialogOutPut(Player, ChatBox, "in a game of chance?", 230, 145, 23) ;Chat
        DialogOutPut(Player, ChatBox, "So what do you say?", 230, 145, 23) ;Chat
        Tosshelp% = DialogInPut(Player, ChatBox, "Lets Play,How do I play?,Close")

        If (Tosshelp = 1) ;start the game
          DialogOutPut(Player, ChatBox, "Your total money is " + PMoney, 230, 145, 23)
          GambleAmount% = Input(Player, "How much to bet? ", "Total", 2) ;get player to add amount to bet

              If (GambleAmount > PMoney) ;if player don`t have enough money for bet end script.
                  DialogOutPut(Player, ChatBox, "You do not have enough money for this bet.", 230, 145, 23)
                  DialogOutPut(Player, ChatBox, "Dont waste my time!!", 255, 255, 255)
                  DOEvents(2300)
                  CloseDialog(Player, ChatBox)
                  Return
              EndIf

            DialogOutPut(Player, ChatBox, "You have bet " + GambleAmount, 230, 145, 23)
 ;------------------------------------------------------------
 ;Show random ball start.
 ;------------------------------------------------------------

             DialogOutPut(Player, ChatBox, "What side would you like to bet on?", 230, 145, 23)
            SidePick% = DialogInput(Player, ChatBox, "Left,Center,Right")   ;left, right, center option player bet option

         CloseDialog(Player, ChatBox)
        BallPlace% = Rnd(1, 3)
                 If (BallPlace = 1) ;ball left
                    ChatBox = OpenDialog(Player, Target, "Cup Gambling", 424) ; Ball left
                    DoEvents(2500)
                    CloseDialog(Player, ChatBox)
                    ChatBox = OpenDialog(Player, Target, "Cup Gambling", 427) ; Cup Left

                  ElseIf (BallPlace = 2) ;ball center
                    ChatBox = OpenDialog(Player, Target, "Cup Gambling", 423) ; Ball Center
                     DoEvents(2500)
                    CloseDialog(Player, ChatBox)
                    ChatBox = OpenDialog(Player, Target, "Cup Gambling", 426) ; Cup Center

                  ElseIf (BallPlace = 3) ;ball right
                     ChatBox = OpenDialog(Player, Target, "Cup Gambling", 425) ; Ball Right
                     DoEvents(2500)
                     CloseDialog(Player, ChatBox)
                     ChatBox = OpenDialog(Player, Target, "Cup Gambling", 428) ; Cup Right

                EndIf
               CloseDialog(Player, ChatBox)
            CupMove% = 10
            StartCup% = Rnd(1, 3)

          Repeat

          ChatBox = OpenDialog(Player, Target, "Cup Gambling", 427) ; Cup Left
         DoEvents(200)
         CloseDialog(Player, ChatBox)

          ChatBox = OpenDialog(Player, Target, "Cup Gambling", 426) ; Cup Center
         DoEvents(200)
         CloseDialog(Player, ChatBox)

          ChatBox = OpenDialog(Player, Target, "Cup Gambling", 428) ; Cup Right
         DoEvents(200)
         CloseDialog(Player, ChatBox)

         CupMove% = CupMove - 1
        Until (CupMove = 0)
            SideRoll% = Rnd(1, 3) ;random chance of side picked

                 ;Change background to winning BG

                If (SideRoll = 1) ;left
                 ChatBox = OpenDialog(Player, Target, "Cup Gambling", 427) ; Cup Left
                 CloseDialog(Player, ChatBox)
                 DoEvents(500)
                 ChatBox = OpenDialog(Player, Target, "Cup Gambling", 424) ; Ball left

                ElseIf (SideRoll = 2) ;center
                 ChatBox = OpenDialog(Player, Target, "Cup Gambling", 426) ; Cup Center
                 CloseDialog(Player, ChatBox)
                 DoEvents(500)
                 ChatBox = OpenDialog(Player, Target, "Cup Gambling", 423) ; Ball Center

                ElseIf (SideRoll = 3) ;right
                  ChatBox = OpenDialog(Player, Target, "Cup Gambling", 428) ; Cup Right
                  CloseDialog(Player, ChatBox)
                  DoEvents(500)
                  ChatBox = OpenDialog(Player, Target, "Cup Gambling", 425) ; Ball Right

                EndIf

             DoEvents(700)

             BetAmount% = GambleAmount * 3

             If (SideRoll = 1) ;left rolled

                If (SidePick = 1)
                    DialogOutPut(Player, ChatBox, "You have won.!!", 230, 145, 23)
                    DialogOutPut(PLayer, ChatBox, "The ball was under the Left Cup.", 230, 145, 23)
                    TotBet% = PMoney + BetAmount
                    SetMoney(Player, TotBet)
                    DialogOutPut(Player, ChatBox, "You have won a total of " + BetAmount, 230, 145, 23)
                    DialogInput(Player, ChatBox, "Close")
                    CloseDialog(Player, ChatBox)
                 Else
                    DialogOutPut(Player, ChatBox, "Sorry you lost that one.", 230, 145, 23)
                    DialogOutPut(PLayer, ChatBox, "The ball was under the left Cup.", 230, 145, 23)
                    TotBet% = PMoney - GambleAmount
                    SetMoney(Player, TotBet)
                    DialogOutPut(Player, ChatBox, "You have lost a total of " + GambleAmount, 230, 145, 23)
                    DialogInput(Player, ChatBox, "Close")
                    CloseDialog(Player, ChatBox)
                EndIf

            ElseIF (SideRoll = 2) ;Center rolled

                 If (SidePick = 2)
                    DialogOutPut(Player, ChatBox, "You have won.!!", 230, 145, 23)
                    DialogOutPut(PLayer, ChatBox, "The ball was under the Center Cup.", 230, 145, 23)
                    TotBet% = PMoney + BetAmount
                    SetMoney(Player, TotBet)
                    DialogOutPut(Player, ChatBox, "You have won a total of " + BetAmount, 230, 145, 23)
                    DialogInput(Player, ChatBox, "Close")
                    CloseDialog(Player, ChatBox)
                 Else
                    DialogOutPut(Player, ChatBox, "Sorry you lost that one.", 230, 145, 23)
                    DialogOutPut(PLayer, ChatBox, "The ball was under the Center Cup.", 230, 145, 23)
                    TotBet% = PMoney - GambleAmount
                    SetMoney(Player, TotBet)
                    DialogOutPut(Player, ChatBox, "You have lost a total of " + GambleAmount, 230, 145, 23)
                    DialogInput(Player, ChatBox, "Close")
                    CloseDialog(Player, ChatBox)
                 EndIf

            ElseIf (SideRoll = 3) ;Right rolled

                 If (SidePick = 2)
                    DialogOutPut(Player, ChatBox, "You have won.!!", 230, 145, 23)
                    DialogOutPut(PLayer, ChatBox, "The ball was under the Right Cup.", 230, 145, 23)
                    TotBet% = PMoney + BetAmount
                    SetMoney(Player, TotBet)
                    DialogOutPut(Player, ChatBox, "You have won a total of " + BetAmount, 230, 145, 23)
                    DialogInput(Player, ChatBox, "Close")
                    CloseDialog(Player, ChatBox)
                 Else
                    DialogOutPut(Player, ChatBox, "Sorry you lost that one.", 230, 145, 23)
                    DialogOutPut(PLayer, ChatBox, "The ball was under the Right Cup.", 230, 145, 23)
                    TotBet% = PMoney - GambleAmount
                    SetMoney(Player, TotBet)
                    DialogOutPut(Player, ChatBox, "You have lost a total of " + GambleAmount, 230, 145, 23)
                    DialogInput(Player, ChatBox, "Close")
                    CloseDialog(Player, ChatBox)
                 EndIf

            EndIf

        ElseIf (Tosshelp = 2)
        DialogOutPut(Player, Chatbox, "Fill in instructions when finished writing script.", 230, 145, 23)
        DialogInput(Player, ChatBox, "Close")
        CloseDialog(Player, ChatBox)

        ElseIf (Tosshelp = 3)
        DialogOutPut(player, ChatBox, "Come back anytime", 230, 145, 23)
        DialogInPut(Player, ChatBox, "Close")
        CloseDialog(Player, ChatBox)

        EndIf

 End Function

```