Sign in to follow this  
Followers 0
Davides

Need help with a blackjack script

18 posts in this topic

Ok im trying to make a blackjack script and I decided to do the ace with a gui, and when i click on whether I want an one or an eleven it buggs up and doesnnt do anything... Heres the script for the one

If $TotalCard2 = 1 Then
    Local $Button_1, $Button_2
    GUICreate("Whats your ace going to be?",100,350,-1)
    $Button_1 = GUICtrlCreateButton("One",-1,5,100)
    $Button_2 = GUICtrlCreateButton("Eleven",-1,10,100)
    GUISetState()
    While 1
        $msg = GUIGetmsg()
        Select
            Case $msg = $Button_1
                $FirstSum = 1
            Case $msg = $Button_2
                $FirstSum = 11
        EndSelect
    WEnd

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Well all this script does is assign 1 or 11 to $FirstSum, and then never gets out of the While loop once done with the Select, and there's no EndIf.

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

How would I fix it? I added endloop and it didnt work, I'm trying now with endif but idk if that will work...

Share this post


Link to post
Share on other sites

Well, its still not working, if you have any other ideas for how to get the ace to work...

Share this post


Link to post
Share on other sites

If $TotalCard2 = 1 Then
    Local $Button_1, $Button_2
    GUICreate("Whats your ace going to be?",100,350)
    $Button_1 = GUICtrlCreateButton("One",-1,5,100)
    $Button_2 = GUICtrlCreateButton("Eleven",-1,100,100)
    GUISetState()
    While 1
        $msg = GUIGetmsg()
        Select
            Case $msg = $Button_1
                $FirstSum = 1
                MsgBox(0, "", "The Ace is " & $FirstSum, 3)
                Exit
            Case $msg = $Button_2
                $FirstSum = 11
                MsgBox(0, "", "The Ace is " & $FirstSum, 3)
                Exit
            Case $msg = $GUI_EVENT_CLOSE
                Exit
        EndSelect
    WEnd
EndIf


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Ok, I modded that a little bit and now it works individually, So i put it into my program and it wont continue after it gets the ace and I select what I want it to be... Heres the script as of right now...

The aces are the only GUI's so they should be easy to find...

This also does not have the dealers total in it either, it wasn't adding correctly so I took it out and am going to work on it in a little bit...

Run("Notepad.exe")
Sleep(500)
MouseClick("left",700,700)
$StartingOff = 0
$CardDrawn = Random(1, 13,1)
$TotalCard = $StartingOff + $CardDrawn
If $TotalCard = 1 Then
    Send("You got an ace and a")
ElseIf $TotalCard = 2 Then
    Send("You got a two and a")
ElseIf $TotalCard = 3 Then
    Send("You got a three and a")
ElseIf $TotalCard = 4 Then
    Send("You got a four and a")
ElseIf $TotalCard = 5 Then
    Send("You got a five and a")
ElseIf $TotalCard = 6 Then
    Send("You got a six and a")
ElseIf $TotalCard = 7 Then
    Send("You got a seven and a")
ElseIf $TotalCard = 8 Then
    Send("You got an eight and a")
ElseIf $TotalCard = 9 Then
    Send("You got a nine and a")
ElseIf $TotalCard = 10 Then
    Send("You got a ten and a")
ElseIf $TotalCard = 11 Then
    Send("You got a jack and a")
ElseIf $TotalCard = 12 Then
    Send("You got a queen and a")
ElseIf $TotalCard = 13 Then
    Send("You got a king and a")
EndIf




$2ndCardDrawn = Random(1,13,1)
$TotalCard2 = $StartingOff + $2ndCardDrawn
If $TotalCard2 = 1 Then
    Send("n ace.")
ElseIf $TotalCard2 = 2 Then
    Send(" two.")
ElseIf $TotalCard2 = 3 Then
    Send(" three.")
ElseIf $TotalCard2 = 4 Then
    Send(" four.")
ElseIf $TotalCard2 = 5 Then
    Send(" five.")
ElseIf $TotalCard2 = 6 Then
    Send(" six.")
ElseIf $TotalCard2 = 7 Then
    Send(" seven.")
ElseIf $TotalCard2 = 8 Then
    Send("n eight.")
ElseIf $TotalCard2 = 9 Then
    Send(" nine.")
ElseIf $TotalCard2 = 10 Then
    Send(" ten.")
ElseIf $TotalCard2 = 11 Then
    Send(" jack.")
ElseIf $TotalCard2 = 12 Then
    Send(" queen.")
ElseIf $TotalCard2 = 13 Then
    Send(" king.")
EndIf   

If $TotalCard = 1 Then
    Local $Button_1, $Button_2
    GUICreate("Whats your ace going to be?",100,350)
    $Button_1 = GUICtrlCreateButton("One",-1,5,100)
    $Button_2 = GUICtrlCreateButton("Eleven",-1,100,100)
    GUISetState()
    While 1
        $msg = GUIGetmsg()
        Select
            Case $msg = $Button_1
                $FirstSum = 1
                MsgBox(0, "", "The Ace is " & $FirstSum, 3)
                Exit
            Case $msg = $Button_2
                $FirstSum = 11
                MsgBox(0, "", "The Ace is " & $FirstSum, 3)
                Exit
            EndSelect
    WEnd
 
    ElseIf $TotalCard = 2 Then
    $FirstSum = 2
ElseIf $TotalCard = 3 Then
    $FirstSum = 3
ElseIf $TotalCard = 4 Then
    $FirstSum = 4
ElseIf $TotalCard = 5 Then
    $FirstSum = 5
ElseIf $TotalCard = 6 Then
    $FirstSum = 6
Elseif $TotalCard = 7 Then
    $FirstSum = 7
Elseif $TotalCard = 8 Then
    $FirstSum = 8
ElseIf $TotalCard = 9 Then
    $FirstSum = 9
ElseIf $TotalCard = 10 Then
    $FirstSum = 10
ElseIf $TotalCard = 11 Then
    $FirstSum = 10
ElseIf $TotalCard = 12 Then
    $FirstSum = 10
ElseIf $TotalCard = 13 Then
    $FirstSum = 10
EndIf

If $TotalCard2 = 1 Then
    Local $Button_1, $Button_2
    GUICreate("Whats your ace going to be?",100,350)
    $Button_1 = GUICtrlCreateButton("One",-1,5,100)
    $Button_2 = GUICtrlCreateButton("Eleven",-1,100,100)
    GUISetState()
    While 1
        $msg = GUIGetmsg()
        Select
            Case $msg = $Button_1
                $FirstSum = 1
                MsgBox(0, "", "The Ace is " & $FirstSum, 3)
                Exit
            Case $msg = $Button_2
                $FirstSum = 11
                MsgBox(0, "", "The Ace is " & $FirstSum, 3)
                Exit
        EndSelect
    WEnd
 
    
ElseIf $TotalCard2 = 2 Then
    $SecondSum = 2
ElseIf $TotalCard2 = 3 Then
    $SecondSum = 3
ElseIf $TotalCard2 = 4 Then
    $SecondSum = 4
ElseIf $TotalCard2 = 5 Then
    $SecondSum = 5
ElseIf $TotalCard2 = 6 Then
    $SecondSum = 6
Elseif $TotalCard2 = 7 Then
    $SecondSum = 7
Elseif $TotalCard2 = 8 Then
    $SecondSum = 8
ElseIf $TotalCard2 = 9 Then
    $SecondSum = 9
ElseIf $TotalCard2 = 10 Then
    $SecondSum = 10
ElseIf $TotalCard2 = 11 Then
    $SecondSum = 10
ElseIf $TotalCard2 = 12 Then
    $SecondSum = 10
ElseIf $TotalCard2 = 13 Then
    $SecondSum = 10
EndIf
$Total = 0
$Total = $FirstSum + $SecondSum
If $Total = 2 THen
    Send("{enter} You got 2")
ElseIf $Total = 3 THen
    Send("{enter} You got 3")
ElseIf $Total = 4 THen
    Send("{enter} You got 4")
ElseIf $Total = 5 THen
    Send("{enter} You got 5")
ElseIf $Total = 6 THen
    Send("{enter} You got 6")
ElseIf $Total = 7 THen
    Send("{enter} You got 7")
ElseIf $Total = 8 THen
    Send("{enter} You got 8")
ElseIf $Total = 9 THen
    Send("{enter} You got 9")
ElseIf $Total = 10 THen
    Send("{enter} You got 10")
ElseIf $Total = 11 Then
    Send("{enter} You got 11")
ElseIf $Total = 12 Then
    Send("{enter} You got 12")
ElseIf $Total = 13 Then
    Send("{enter} You got 13")
ElseIf $Total = 14 Then
    Send("{enter} You got 14")
ElseIf $Total = 15 Then
    Send("{enter} You got 15")
ElseIf $Total = 16 Then
    Send("{enter} You got 16")
ElseIf $Total = 17 Then
    Send("{enter} You got 17")
ElseIf $Total = 18 Then
    Send("{enter} You got 18")
ElseIf $Total = 19 THen
    Send("{enter} You got 19")
ElseIf $Total = 20 THen
    Send("{enter} You got 20")
ElseIf $Total = 21 Then
    Send("{enter} Congratulations. You got blackjack!")
EndIf


$CardDrawn = Random(1, 13, 1)
$TotalCard = $StartingOff+$Carddrawn
If $TotalCard = 1 Then
    Send("{enter}Dealer got an ace and a")
ElseIf $TotalCard = 2 Then
    Send("{enter}Dealer got a two and a")
ElseIf $TotalCard = 3 Then
    Send("{enter}Dealer got a three and a")
ElseIf $TotalCard = 4 Then
    Send("{enter}Dealer got a four and a")
ElseIf $TotalCard = 5 Then
    Send("{enter}Dealer got a five and a")
ElseIf $TotalCard = 6 Then
    Send("{enter}Dealer got a six and a")
ElseIf $TotalCard = 7 Then
    Send("{enter}Dealer got a seven and a")
ElseIf $TotalCard = 8 Then
    Send("{enter}Dealer got an eight and a")
ElseIf $TotalCard = 9 Then
    Send("{enter}Dealer got a nine and a")
ElseIf $TotalCard = 10 Then
    Send("{enter}Dealer got a ten and a")
ElseIf $TotalCard = 11 Then
    Send("{enter}Dealer got a jack and a")
ElseIf $TotalCard = 12 Then
    Send("{enter}Dealer got a queen and a")
ElseIf $TotalCard = 13 Then
    Send("{enter}Dealer got a king and a")
EndIf

$2ndCardDrawn = Random(1,13,1) 
$TotalCard2 = $StartingOff + $2ndCardDrawn
If $TotalCard2 = 1 Then
    Send("n ace.")
ElseIf $TotalCard2 = 2 Then
    Send(" two.")
ElseIf $TotalCard2 = 3 Then
    Send(" three.")
ElseIf $TotalCard2 = 4 Then
    Send(" four.")
ElseIf $TotalCard2 = 5 Then
    Send(" five.")
ElseIf $TotalCard2 = 6 Then
    Send(" six.")
ElseIf $TotalCard2 = 7 Then
    Send(" seven.")
ElseIf $TotalCard2 = 8 Then
    Send("n eight.")
ElseIf $TotalCard2 = 9 Then
    Send(" nine.")
ElseIf $TotalCard2 = 10 Then
    Send(" ten.")
ElseIf $TotalCard2 = 11 Then
    Send(" jack.")
ElseIf $TotalCard2 = 12 Then
    Send(" queen.")
ElseIf $TotalCard2 = 13 Then
    Send(" king.")
EndIf

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Ok, I rewrote the entire thing, well, not all of it, just the player's hand. Basically I just got rid of a bunch of If's. You can add the Run and MouseClick back in, and use SciTE's search & replace to change the ConsoleWrite's to Send's. You can dupe the player code for the dealer hand, once you see how I did what I did (which is probably not good code, but it works..)

Local $Button_1, $Button_2
$StartingOff = 0
$CardDrawn = Random(1, 13,1)
$TotalCard = $StartingOff + $CardDrawn

Switch $TotalCard
    Case 1
        GUICreate("Whats your Ace going to be?", 100, 350)
        $Button_1 = GUICtrlCreateButton("One", -1, 5, 100)
        $Button_2 = GUICtrlCreateButton("Eleven", -1, 100, 100)
        GUISetState()
        While 1
            $msg = GUIGetmsg()
            Select
                Case $msg = $Button_1
                    $FirstSum = 1
                    ExitLoop
                Case $msg = $Button_2
                    $FirstSum = 11
                    ExitLoop
                EndSelect
            WEnd
        ConsoleWrite("You got an Ace(" & $FirstSum & ") and a")
    Case 2 To 10
        $FirstSum = $TotalCard
        ConsoleWrite("You got a " & $TotalCard & " and a ")
    Case 11
        $FirstSum = 10
        ConsoleWrite("You got a Jack and a ")
    Case 12
        $FirstSum = 10
        ConsoleWrite("You got a Queen and a ")
    Case 13
        $FirstSum = 10
        ConsoleWrite("You got a King and a ")
EndSwitch

$2ndCardDrawn = Random(1,13,1)
$TotalCard2 = $StartingOff + $2ndCardDrawn
Switch $TotalCard2
    Case 1
        GUICreate("Whats your ace going to be?", 100, 350)
        $Button_1 = GUICtrlCreateButton("One", -1, 5, 100)
        $Button_2 = GUICtrlCreateButton("Eleven", -1, 100, 100)
        GUISetState()
        While 1
            $msg = GUIGetmsg()
            Select
                Case $msg = $Button_1
                    $SecondSum = 1
                    ExitLoop
                Case $msg = $Button_2
                    $SecondSum = 11
                    ExitLoop
            EndSelect
        WEnd
        ConsoleWrite("n Ace(" & $SecondSum & "). Total -> " & $FirstSum + $SecondSum & @LF)
    Case 2 To 10
        $SecondSum = $TotalCard2
        ConsoleWrite($TotalCard2 & ", Total -> " & $FirstSum + $SecondSum & @LF)
    Case 11
        $SecondSum = 10
        ConsoleWrite("Jack, Total -> " & $FirstSum + $SecondSum & @LF)
    Case 12
        $SecondSum = 10
        ConsoleWrite("Queen, Total -> " & $FirstSum + $SecondSum & @LF)
    Case 13
        $SecondSum = 10
        ConsoleWrite("King, Total -> " & $FirstSum + $SecondSum & @LF)
EndSwitch
If $FirstSum + $SecondSum = 21 Then ConsoleWrite(@LF & "Congratulations!!" & @LF & @LF)
Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Wow, that completely helped, I had to edit it a little bit, change the "ConsoleWrite" parts to send and add the Notepad and stuff and it worked great, thanks again.

Share this post


Link to post
Share on other sites

Ok so I finished it with adding the dealer and such, and the dealer doesnt add right heres the script...

Local $Button_1, $Button_2
$StartingOff = 0
$CardDrawn = Random(1, 13,1)
$TotalCard = $StartingOff + $CardDrawn

Run("Notepad.exe")
WinWaitActive("Untitled - Notepad")
Switch $TotalCard
    Case 1
        GUICreate("Whats your Ace going to be?", 100, 350)
        $Button_1 = GUICtrlCreateButton("One", -1, 5, 100)
        $Button_2 = GUICtrlCreateButton("Eleven", -1, 100, 100)
        GUISetState()
        While 1
            $msg = GUIGetmsg()
            Select
            Case $msg = $Button_1
                    MouseClick("left",700,700)
                    Sleep(500)
                    $FirstSum = 1
                    ExitLoop
                Case $msg = $Button_2
                    MouseClick("left",700,700)
                    Sleep(500)
                    $FirstSum = 11
                    ExitLoop
                EndSelect
            WEnd
        Send("You got an Ace(" & $FirstSum & ") and a")
    Case 2 To 10
        $FirstSum = $TotalCard
        Send("You got a " & $TotalCard & " and a ")
    Case 11
        $FirstSum = 10
        Send("You got a Jack and a ")
    Case 12
        $FirstSum = 10
        Send("You got a Queen and a ")
    Case 13
        $FirstSum = 10
        Send("You got a King and a ")
EndSwitch

$2ndCardDrawn = Random(1,13,1)
$TotalCard2 = $StartingOff + $2ndCardDrawn
Switch $TotalCard2
    Case 1
        GUICreate("Whats your ace going to be?", 100, 350)
        $Button_1 = GUICtrlCreateButton("One", -1, 5, 100)
        $Button_2 = GUICtrlCreateButton("Eleven", -1, 100, 100)
        GUISetState()
        While 1
            $msg = GUIGetmsg()
            Select
                Case $msg = $Button_1
                    MouseClick("left",700,700)
                    $SecondSum = 1
                    ExitLoop
                Case $msg = $Button_2
                    MouseClick("left",700,700)
                    $SecondSum = 11
                    ExitLoop
            EndSelect
        WEnd
        Send("n Ace(" & $SecondSum & "). Total -> " & $FirstSum + $SecondSum & @LF)
    Case 2 To 10
        $SecondSum = $TotalCard2
        Send($TotalCard2 & ", Total -> " & $FirstSum + $SecondSum & @LF)
    Case 11
        $SecondSum = 10
        Send("Jack, Total -> " & $FirstSum + $SecondSum & @LF)
    Case 12
        $SecondSum = 10
        Send("Queen, Total -> " & $FirstSum + $SecondSum & @LF)
    Case 13
        $SecondSum = 10
        Send("King, Total -> " & $FirstSum + $SecondSum & @LF)
EndSwitch
If $FirstSum + $SecondSum = 21 Then ConsoleWrite(@LF & "Congratulations!!" & @LF & @LF)

$StartingOff = 0
$ThirdCardDrawn = Random(1, 13,1)
$TotalCard3 = $StartingOff + $ThirdCardDrawn

Switch $TotalCard3
    Case 1
        $ThirdSum = 11
        Send("{Enter}Dealer got an Ace(11) and a ")
    Case 2 To 10
        $ThirdSum = $TotalCard3
        Send("{Enter}Dealer got a " & $TotalCard3 & " and a ")
    Case 11
        $ThirdSum = 10
        Send("{Enter}Dealer got a Jack and a ")
    Case 12
        $ThirdSum = 10
        Send("{Enter}Dealer got a Queen and a ")
    Case 13
        $ThirdSum = 10
        Send("{Enter}Dealer got a King and a ")
EndSwitch

$FourthCardDrawn = Random(1,13,1)
$TotalCard4 = $StartingOff + $FourthCardDrawn
Switch $TotalCard4
    Case 1
        If $ThirdSum = 11 Then
            $FourthSum = 1
        ElseIf $ThirdSum > 11 Then
            $FourthSum = 11
        EndIf
        Send("n Ace(" & $SecondSum & "). Total -> " & $ThirdSum + $FourthSum & @LF)
    Case 2 To 10
        $FourthSum = $TotalCard2
        Send($TotalCard4 & ", Total -> " & $ThirdSum + $FourthSum & @LF)
    Case 11
        $FourthSum = 10
        Send("Jack, Total -> " & $ThirdSum + $FourthSum & @LF)
    Case 12
        $FourthSum = 10
        Send("Queen, Total -> " & $ThirdSum + $FourthSum & @LF)
    Case 13
        $FourthSum = 10
        Send("King, Total -> " & $ThirdSum + $FourthSum & @LF)
EndSwitch

$Complete2 = $ThirdSum + $FourthSum
$Complete1 = $FirstSum + $SecondSum

If $Complete1 > 21 Then
    Send("{Enter}Bust!")
EndIf

If $Complete1 > $Complete2 Then
    Send("{Enter}You Win!")
EndIf

If $Complete2 > $Complete1 Then
    Send("{Enter}HaHa You lost.")
EndIf

If $Complete2 = $Complete1 Then
    Send("{Enter}Wow you tied!")
EndIf

Share this post


Link to post
Share on other sites

Is anyone able to help?

Share this post


Link to post
Share on other sites

I just ran your script six or seven times. Neither player nor dealer got an ace in any hand, and the count was right. What exactly is 'doesn't add right'?


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

I just did it once and this is the score it gave me...

You got a King and a 7, Total -> 17

Dealer got a King and a 3, Total -> 17

Wow you tied

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Ok, I just tried it again. The dealer was dealt an Ace, and the script did generate a 'variable undefined' error. Do this, replace the first line (local button1, button2) with this

Opt("MustDeclareVars", 1)
Local $Button_1, $Button_2, $StartingOff, $CardDrawn, $TotalCard, $msg, $FirstSum, $2ndCardDrawn, $TotalCard2, $SecondSum, $ThirdCardDrawn, $TotalCard3, $ThirdSum, $FourthCardDrawn, $TotalCard4, $FourthSum, $Complete2, $Complete1

I ran it several times after that was done, paying closer attention to the 'adding', but didn't get any Aces either to player or dealer, so I'm not sure this is a fix, but it can't hurt.

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Well I see that wasn't a fix, I got this Dealer got a 7 and a 10, Total -> 12.. I'll look thru it again and see what I can..


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

I think this is what's wrong: line 116, for the dealers second card, reads $FourthSum = $TotalCard2. Should be $FourthSum = $TotalCard4.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

If by 116 you meant 115, then yea it works good now :mellow: thanks.

Share this post


Link to post
Share on other sites

Actually, it probably is 115 in your script, because I did add a line to the copy I was running. Glad it's working. :mellow:


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Ok, I was working on the whole hit-me/stay thing, and it wont keep typing, also if you have any idea of anything else rather than using notepade(not very good looking and hard to work with). Also here's the script...

Also sorry about asking for so much help, this is my most complicated script yet, I usually make things like fake-hacks(makes your computer make noises, load random stuff and shut down) and other simple scripts...

Opt("MustDeclareVars", 1)
Local $Button_1, $Button_2, $StartingOff, $CardDrawn, $TotalCard, $msg, $FirstSum, $2ndCardDrawn, $TotalCard2, $SecondSum, $ThirdCardDrawn, $TotalCard3, $ThirdSum, $FourthCardDrawn, $TotalCard4, $FourthSum, $Complete2, $Complete1, $Bonus1, $Bonus2, $Bonus3, $Bonus4, $Hit, $Stay, $DBonus1, $DBonus2, $DBonus3, $DBonus4
$StartingOff = 0
$CardDrawn = Random(1, 13,1)
$TotalCard = $StartingOff + $CardDrawn

Run("Notepad.exe")
WinWaitActive("Untitled - Notepad")
Switch $TotalCard
    Case 1
        GUICreate("Whats your Ace going to be?", 100, 350)
        $Button_1 = GUICtrlCreateButton("One", -1, 5, 100)
        $Button_2 = GUICtrlCreateButton("Eleven", -1, 100, 100)
        GUISetState()
        While 1
            $msg = GUIGetmsg()
            Select
            Case $msg = $Button_1
                    MouseClick("left",700,700)
                    Sleep(500)
                    $FirstSum = 1
                    ExitLoop
                Case $msg = $Button_2
                    MouseClick("left",700,700)
                    Sleep(500)
                    $FirstSum = 11
                    ExitLoop
                EndSelect
            WEnd
        Send("You got an Ace(" & $FirstSum & ") and a")
    Case 2 To 10
        $FirstSum = $TotalCard
        Send("You got a " & $TotalCard & " and a ")
    Case 11
        $FirstSum = 10
        Send("You got a Jack and a ")
    Case 12
        $FirstSum = 10
        Send("You got a Queen and a ")
    Case 13
        $FirstSum = 10
        Send("You got a King and a ")
EndSwitch

$2ndCardDrawn = Random(1,13,1)
$TotalCard2 = $StartingOff + $2ndCardDrawn
Switch $TotalCard2
    Case 1
        GUICreate("Whats your ace going to be?", 100, 350)
        $Button_1 = GUICtrlCreateButton("One", -1, 5, 100)
        $Button_2 = GUICtrlCreateButton("Eleven", -1, 100, 100)
        GUISetState()
        While 1
            $msg = GUIGetmsg()
            Select
                Case $msg = $Button_1
                    MouseClick("left",700,700)
                    $SecondSum = 1
                    ExitLoop
                Case $msg = $Button_2
                    MouseClick("left",700,700)
                    $SecondSum = 11
                    ExitLoop
            EndSelect
        WEnd
        Send("n Ace(" & $SecondSum & "). Total -> " & $FirstSum + $SecondSum & @LF)
    Case 2 To 10
        $SecondSum = $TotalCard2
        Send($TotalCard2 & ", Total -> " & $FirstSum + $SecondSum & @LF)
    Case 11
        $SecondSum = 10
        Send("Jack, Total -> " & $FirstSum + $SecondSum & @LF)
    Case 12
        $SecondSum = 10
        Send("Queen, Total -> " & $FirstSum + $SecondSum & @LF)
    Case 13
        $SecondSum = 10
        Send("King, Total -> " & $FirstSum + $SecondSum & @LF)
EndSwitch

$Bonus1 = 0
GUICreate("Hit or Stay?",100,350)
$Hit = GUICtrlCreateButton("Hit",-1,5,100)
$Stay = GUICtrlCreateButton("Stay",-1,100,100)
GUISetState()
While 1
    $msg = GUIGetmsg()
    Select
    Case $msg = $Hit
        $Bonus1 = Random(1,13,1)
        Switch $Bonus1
    Case 1
        GUICreate("Whats your ace going to be?", 100, 350)
        $Button_1 = GUICtrlCreateButton("One", -1, 5, 100)
        $Button_2 = GUICtrlCreateButton("Eleven", -1, 100, 100)
        GUISetState()
        While 1
            $msg = GUIGetmsg()
            Select
                Case $msg = $Button_1
                    MouseClick("left",700,700)
                    $Bonus1 = 1
                    ExitLoop
                Case $msg = $Button_2
                    MouseClick("left",700,700)
                    $Bonus1 = 11
                    ExitLoop
            EndSelect
        WEnd
        Send("{enter}You got an Ace(" & $Bonus1 & ") and your new total is -> " & $FirstSum + $SecondSum + $Bonus1 & @LF)
    Case 2 To 10
        MouseClick("left",800,800)
        $Bonus1 = $Bonus1
        Send("{enter}You got" & $Bonus1 & "and your new Total is -> " & $FirstSum + $SecondSum + $Bonus1 & @LF)
    Case 11
        MouseClick("left",800,800)
        $Bonus1 = 10
        Send("{enter}You got a Jack and your new total is -> " & $FirstSum + $SecondSum + $Bonus1 & @LF)
    Case 12
        MouseClick("left",800,800)
        $Bonus1 = 10
        Send("{enter}You got a Queen and your new total is -> " & $FirstSum + $SecondSum + $Bonus & @LF)
    Case 13
        MouseClick("left",800,800)
        $Bonus1 = 10
        Send("{enter}You got a King and your new total is -> " & $FirstSum + $SecondSum + $Bonus & @LF)
    EndSwitch
    ExitLoop
Case $msg = $Stay
    $Bonus1 = 0
    ExitLoop
EndSelect
Wend
        


$StartingOff = 0
$ThirdCardDrawn = Random(1, 13,1)
$TotalCard3 = $StartingOff + $ThirdCardDrawn

Switch $TotalCard3
    Case 1
        $ThirdSum = 11
        Send("{Enter}Dealer got an Ace(11) and a ")
    Case 2 To 10
        $ThirdSum = $TotalCard3
        Send("{Enter}Dealer got a " & $TotalCard3 & " and a ")
    Case 11
        $ThirdSum = 10
        Send("{Enter}Dealer got a Jack and a ")
    Case 12
        $ThirdSum = 10
        Send("{Enter}Dealer got a Queen and a ")
    Case 13
        $ThirdSum = 10
        Send("{Enter}Dealer got a King and a ")
EndSwitch

$FourthCardDrawn = Random(1,13,1)
$TotalCard4 = $StartingOff + $FourthCardDrawn
Switch $TotalCard4
    Case 1
        If $ThirdSum = 11 Then
            $FourthSum = 1
        ElseIf $ThirdSum > 11 Then
            $FourthSum = 11
        EndIf
        Send("n Ace(" & $SecondSum & "). Total -> " & $ThirdSum + $FourthSum & @LF)
    Case 2 To 10
        $FourthSum = $TotalCard4
        Send($TotalCard4 & ", Total -> " & $ThirdSum + $FourthSum & @LF)
    Case 11
        $FourthSum = 10
        Send("Jack, Total -> " & $ThirdSum + $FourthSum & @LF)
    Case 12
        $FourthSum = 10
        Send("Queen, Total -> " & $ThirdSum + $FourthSum & @LF)
    Case 13
        $FourthSum = 10
        Send("King, Total -> " & $ThirdSum + $FourthSum & @LF)
EndSwitch

$Complete2 = $ThirdSum + $FourthSum + $Bonus1 + $Bonus2 + $Bonus3 + $Bonus4
$Complete1 = $FirstSum + $SecondSum + $DBonus1 + $DBonus2 + $DBonus3 + $DBonus4

If $Complete1 > 21 Then
    Send("{Enter}Bust!")
EndIf

If $Complete1 > $Complete2 Then
    Send("{Enter}You Win!")
EndIf

If $Complete2 > $Complete1 Then
    Send("{Enter}HaHa You lost.")
EndIf

If $Complete2 = $Complete1 Then
    Send("{Enter}Wow you tied!")
EndIf

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0