Sign in to follow this  
Followers 0
Matu

Help Help...

3 posts in this topic

#1 ·  Posted (edited)

Hey guys Im still in a rut. gafrost and creepy posted some random array generators for me

but I havent a clue how to implement them into my game.

As you can see, Ive posted the script so you's can get some idea, of what I want to achieve

so please!!!!! I need all the help anyone can give

#include <guiconstants.au3>
Global $button_1, $counter = 0, $data1, $number, $label_1
GUICreate("WHAKAARO", 700, 530)
$label_1 = GUICtrlCreateLabel("", 400, 200, 260, 150)
GUICtrlSetFont(-1, 15, 400, 0, "ms sans serif")
$button1 = GUICtrlCreateButton("OK", 450, 400, 100)
GUISetBkColor(0xE0FFFF)
GUISetState(@SW_SHOW)


$data1 = "CLICK OK, TO DISPLAY 3 ROWS OF 7 CARDS "   ; begin
GUICtrlSetData($label_1, $data1)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $button1
            PlayFunction()
    EndSelect
WEnd

;--------------------------------------------------------------------------------------------------start

Func PlayFunction()
    GUICtrlSetState($button1, $GUI_DISABLE)
    Switch $counter
        Case 0
            $data1 = "NOW MENTALY SELECT 1 CARD, FROM ANY OF THE 3 ROWS OF 7 DISPLAYED THEN MEMORISE IT AND CLICK OK"
            Call("Test1")                                                   ;call random generator
;---------------------------------------------------------------------------------------------------------------------------


            GUICtrlCreatePic("" & $number, 50, 5, 50, 70) ; places bitmap into grid
            Call("Test1")
            GUICtrlCreatePic("" & $number, 180, 5, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 300, 5, 50, 70)

            Call("Test1")
            GUICtrlCreatePic("" & $number, 50, 76, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 180, 76, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 300, 76, 50, 70)

            Call("Test1")
            GUICtrlCreatePic("" & $number, 50, 147, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 180, 147, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 300, 147, 50, 70)

            Call("Test1")
            GUICtrlCreatePic("" & $number, 50, 218, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 180, 218, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 300, 218, 50, 70)

            Call("Test1")
            GUICtrlCreatePic("" & $number, 50, 289, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 180, 289, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 300, 289, 50, 70)

            Call("Test1")
            GUICtrlCreatePic("" & $number, 50, 360, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 180, 360, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 300, 360, 50, 70)

            Call("Test1")
            GUICtrlCreatePic("" & $number, 50, 431, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 180, 431, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 300, 431, 50, 70)

;--------------------------------------------------------------------------------------------------------------------------
; re-calls random generator, then re- displays cards in their grids
        Case 1
            $data1 = "NOW CHECK THE ROW THAT YOUR CARD IS IN, AND PRESS OK"
            Call("Test1")
            GUICtrlCreatePic("" & $number, 50, 5, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 180, 5, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 300, 5, 50, 70)

            Call("Test1")
            GUICtrlCreatePic("" & $number, 50, 76, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 180, 76, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 300, 76, 50, 70)

            Call("Test1")
            GUICtrlCreatePic("" & $number, 50, 147, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 180, 147, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 300, 147, 50, 70)

            Call("Test1")
            GUICtrlCreatePic("" & $number, 50, 218, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 180, 218, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 300, 218, 50, 70)

            Call("Test1")
            GUICtrlCreatePic("" & $number, 50, 289, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 180, 289, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 300, 289, 50, 70)

            Call("Test1")
            GUICtrlCreatePic("" & $number, 50, 360, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 180, 360, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 300, 360, 50, 70)

            Call("Test1")
            GUICtrlCreatePic("" & $number, 50, 431, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 180, 431, 50, 70)
            Call("Test1")
            GUICtrlCreatePic("" & $number, 300, 431, 50, 70)
            $counter = 0
            GUICtrlSetData($label_1, $data1)
            GUICtrlSetState($button1, $GUI_ENABLE)
            Return
    EndSwitch

    $counter += 1
    GUICtrlSetData($label_1, $data1)
    GUICtrlSetState($button1, $GUI_ENABLE)
EndFunc   ;==>PlayFunction

;---------------------------------------------------------------------------------------------------------------------------

assign $range variable + number to bitmap picture

Func Test1()
    $range = (Random(54))
    $number = (Round($range))
    If $number = 1 Then $number = "$a1.bmp"
    If $number = 2 Then $number = "$a2.bmp"
    If $number = 3 Then $number = "$a3.bmp"
    If $number = 4 Then $number = "$a4.bmp"
    If $number = 5 Then $number = "$a5.bmp"
    If $number = 6 Then $number = "$a6.bmp"
    If $number = 7 Then $number = "$a7.bmp"
    If $number = 8 Then $number = "$a8.bmp"
    If $number = 9 Then $number = "$a9.bmp"
    If $number = 10 Then $number = "$a10.bmp"
    If $number = 11 Then $number = "$a11.bmp"
    If $number = 12 Then $number = "$a12.bmp"
    If $number = 13 Then $number = "$a13.bmp"
    If $number = 14 Then $number = "$a14.bmp"
    If $number = 15 Then $number = "$a15.bmp"
    If $number = 16 Then $number = "$a16.bmp"
    If $number = 17 Then $number = "$a17.bmp"
    If $number = 18 Then $number = "$a18.bmp"
    If $number = 19 Then $number = "$a19.bmp"
    If $number = 20 Then $number = "$a20.bmp"
    If $number = 21 Then $number = "$a21.bmp"
    If $number = 22 Then $number = "$a22.bmp"
    If $number = 23 Then $number = "$a23.bmp"
    If $number = 24 Then $number = "$a24.bmp"
    If $number = 25 Then $number = "$a25.bmp"
    If $number = 26 Then $number = "$a26.bmp"
    If $number = 27 Then $number = "$a27.bmp"
    If $number = 28 Then $number = "$a28.bmp"
    If $number = 29 Then $number = "$a29.bmp"
    If $number = 30 Then $number = "$a30.bmp"
    If $number = 31 Then $number = "$a31.bmp"
    If $number = 32 Then $number = "$a32.bmp"
    If $number = 33 Then $number = "$a33.bmp"
    If $number = 34 Then $number = "$a34.bmp"
    If $number = 35 Then $number = "$a35.bmp"
    If $number = 36 Then $number = "$a36.bmp"
    If $number = 37 Then $number = "$a37.bmp"
    If $number = 38 Then $number = "$a38.bmp"
    If $number = 39 Then $number = "$a39.bmp"
    If $number = 40 Then $number = "$a40.bmp"
    If $number = 41 Then $number = "$a41.bmp"
    If $number = 42 Then $number = "$a42.bmp"
    If $number = 43 Then $number = "$a43.bmp"
    If $number = 44 Then $number = "$a44.bmp"
    If $number = 45 Then $number = "$a45.bmp"
    If $number = 46 Then $number = "$a46.bmp"
    If $number = 47 Then $number = "$a47.bmp"
    If $number = 48 Then $number = "$a48.bmp"
    If $number = 49 Then $number = "$a49.bmp"
    If $number = 50 Then $number = "$a50.bmp"
    If $number = 51 Then $number = "$a51.bmp"
    If $number = 52 Then $number = "$a52.bmp"
    If $number = 53 Then $number = "$a53.bmp"
    If $number = 54 Then $number = "$a54.bmp"
EndFunc   ;==>Test1

;--------------------------------------------END---------------------------------------------------------------------

;Random generator supplied by gafrost

Opt("MustDeclareVars", 1)
_Main()
Func _Main()
    Local $deck = _InitDeck()
    Local $a_cards = _Deal(21, 52)
    Local $s_text = "", $i
    For $i = 1 To $a_cards[0]
        $s_text = $s_text & "card #" & $i & ": " & $deck[$a_cards[$i]] & @LF
    Next
    MsgBox(0, "Dealt", $s_text)
EndFunc   ;==>_Main
Func _Deal($i_howmany = 1, $i_cards = 52)
    Local $i, $x, $used, $card
    Local $a_cards[$i_howmany + 2], $i
    $a_cards[0] = $i_howmany
    For $i = 1 To $a_cards[0]
        $card = Random(1, $i_cards, 1)
        $used = 0
        For $x = 1 To $a_cards[0]
            If $a_cards[$x] = $card Then
                $used = 1
                ExitLoop
            EndIf
        Next
        If Not $used Then
            $a_cards[$i] = $card
        Else
            $i -= 1
        EndIf
    Next
    Return $a_cards
EndFunc   ;==>_Deal

Func _InitDeck()
    Return StringSplit("Ace Spades,2 Spades,3 Spades,4 Spades,5 Spades,6 Spades,7 Spades,8 Spades," & _
            "9 Spades,10 Spades,Jack Spades,Queen Spades,King Spades," & _
            "Ace Hearts,2 Hearts,3 Hearts,4 Hearts,5 Hearts,6 Hearts,7 Hearts,8 Hearts," & _
            "9 Hearts,10 Hearts,Jack Hearts,Queen Hearts,King Hearts," & _
            "Ace Clubs,2 Clubs,3 Clubs,4 Clubs,5 Clubs,6 Clubs,7 Clubs,8 Clubs," & _
            "9 Clubs,10 Clubs,Jack Clubs,Queen Clubs,King Clubs," & _
            "Ace Diamonds,2 Diamonds,3 Diamonds,4 Diamonds,5 Diamonds,6 Diamonds,7 Diamonds,8 Diamonds," & _
            "9 Diamonds,10 Diamonds,Jack Diamonds,Queen Diamonds,King Diamonds", ",")
EndFunc   ;==>_InitDeck
Edited by Matu

Share this post


Link to post
Share on other sites



Can you use the [autoit] tags? I cant read that :lmao:


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

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