Jump to content

Just Dice (UPDATE)


eynstyne
 Share

Recommended Posts

Thanks to RazerM for fixing my problem.. :whistle:

Just dice is one of my personal favorites since it is so damn simplistic to use. Drag the dice to move them around the screen and click to roll. Click the x to quit and roll to roll all dice.

Finally Here it is! -

Enjoy!

:) Eynstyne

F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent]
Link to comment
Share on other sites

  • Moderators

Cool script, but I had to optimize it a little.

#include <GUIConstants.au3>

Opt("GuiOnEventMode", True)

Global _
        $GUI[9], _
        $PIC[9]

Global Enum Step + 36 _
        $CTRL_POS_1 = 29, _
        $CTRL_POS_2, _
        $CTRL_POS_3, _
        $CTRL_POS_4, _
        $CTRL_POS_5, _
        $CTRL_POS_6

For $i = 1 To 6
    $GUI[$i] = GUICreate("Dice Numbers", 34, 32, Eval("CTRL_POS_" & $i), 4, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_LAYERED + $WS_EX_TOPMOST)
    $PIC[$i] = GUICtrlCreatePic(@ScriptDir & "\DICE\Dice" & $i & ".bmp", 0, 0, 34, 32, -1, $GUI_WS_EX_PARENTDRAG)
    GUICtrlSetOnEvent(-1, "Roll")
    GUISetState()
Next

$GUI[7] = GUICreate("Dice Numbers", 34, 32, 118, 53, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_LAYERED + $WS_EX_TOPMOST)
$PIC[7] = GUICtrlCreatePic(@ScriptDir & "\DICE\diceclose.bmp", 0, 0, 34, 32, -1, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetOnEvent(-1, "Bye")
GUISetState()

$GUI[8] = GUICreate("Dice Numbers", 82, 32, 176, 53, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_LAYERED + $WS_EX_TOPMOST)
$PIC[8] = GUICtrlCreatePic(@ScriptDir & "\DICE\Roll.bmp", 0, 0, 82, 32, -1, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetOnEvent(-1, "Rollall")
GUISetState()

While 1
    Sleep(50)
WEnd

Func Roll()
    $CtrlID = @GUI_CtrlId
    For $i = 1 To 6
        GUICtrlSetImage($CtrlID, @ScriptDir & "\DICE\Dice" & Random(1, 6, 1) & ".bmp")
        Sleep(100)
    Next
EndFunc   ;==>Roll

Func RollAll()
    For $i = 1 To 6
        For $y = 1 To 6
            GUICtrlSetImage($PIC[Random(1, 6, 1)], @ScriptDir & "\DICE\Dice" & Random(1, 6, 1) & ".bmp")
            Sleep(50)
        Next
    Next
EndFunc   ;==>RollAll

Func Bye()
    For $i = 1 To 9
        GUIDelete($GUI[Random(1, 6, 1)])
        Sleep(200)
    Next
    Exit
EndFunc   ;==>Bye
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...