theguy0000 Posted March 27, 2007 Posted March 27, 2007 I have made a program, and it has two GUIs. It's a game. The first GUI is created, all 5 dice roll through a cycle before stopping in their final positions, then the second GUI is created. The problem: The first GUI uses OnEvent mode, the second uses Msg mode. is there some way to make them both work at once, or will I have to re-write them? because OnEvent Mode is just more ideal for the first gui, and Msg mode is ideal for the second. Because the buttons (the dice) work before the second window pops up, but once it does, I have to turn GUIOnEvent mode off for the second gui to work, so those buttons no longer work. I need them to work the whole time. expandcollapse popup#cs ---------------------------------------------------------------------------- Script Name: YAHTZEE! Script Version: 1.3 Author: Matt Roth (theguy0000) <theguy0000@gmail.com> Release Date: - AutoIt Version: 3.2.3.0 (beta) Notes: - #ce ---------------------------------------------------------------------------- Opt ("GUIOnEventMode", 1) #include <GUIConstants.au3> Global Const $ScoreFont = "Comic Sans MS" Global Const $ScoreFontSize = 12 Global Const $CoordX1[2] = [184,452] Global Const $CoordX2[2] = [197,452] Global Const $CoordX3[2] = [210,452] Global Const $CoordAces[2] = [187,159] Global Const $CoordTwos[2] = [187,175] Global Const $CoordThrees[2] = [187,191] Global Const $CoordFours[2] = [187,207] Global Const $CoordFives[2] = [187,223] Global Const $CoordSixes[2] = [187,239] Global Const $CoordScore[2] = [187,257] Global Const $CoordBonus1[2] = [187,273] Global Const $CoordTotal1[2] = [187,289] Global Const $Coord3kind[2] = [187,319] Global Const $Coord4kind[2] = [187,335] Global Const $CoordFullHouse[2] = [187,351] Global Const $CoordSmStraight[2] = [187,367] Global Const $CoordLgStraight[2] = [187,383] Global Const $CoordYahtzee[2] = [187,399] Global Const $CoordChance[2] = [187,415] Global Const $CoordBonus2[2] = [187,431] Global Const $CoordTotal2[2] = [187,463] Global $dice_res[6] Global $Aces = 0 Global $Twos = 0 Global $Threes = 0 Global $Fours = 0 Global $Fives = 0 Global $Sixes = 0 Global $3kind = 0 Global $4kind = 0 Global $Full = 0 Global $Small = 0 Global $Large = 0 Global $Yahtzee = 0 Global $Chance = 0 Global $AcesScore = 0 Global $TwosScore = 0 Global $ThreesScore = 0 Global $FoursScore = 0 Global $FivesScore = 0 Global $SixesScore = 0 Global $3kindScore = 0 Global $4kindScore = 0 Global $FullScore = 0 Global $SmallScore = 0 Global $LargeScore = 0 Global $YahtzeeScore = 0 Global $Yahtzee1Score = 0 Global $Yahtzee2Score = 0 Global $Yahtzee3Score = 0 Global $ChanceScore = 0 Global $choice = "" #Region ### START Koda GUI section ### $GUI = GUICreate("Yahtzee Au3", 306, 498, 247, 115) GUISetOnEvent ($GUI_EVENT_CLOSE, "_close") ;~$DicePic1 = GUICtrlCreatePic("images\dice1.bmp", 32, 24, 46, 46, BitOR($SS_NOTIFY,$WS_GROUP)) ;~GUICtrlSetCursor ($DicePic1, 2) $DicePic1 = GUICtrlCreateButton ("", 32, 24, 46, 46, $BS_BITMAP) GUICtrlSetImage ($dicePic1, "images\dice1.bmp") GUICtrlSetOnEvent ($dicePic1, "dice1click") ;~$DicePic2 = GUICtrlCreatePic("images\dice2.bmp", 128, 24, 46, 46, BitOR($SS_NOTIFY,$WS_GROUP)) ;~GUICtrlSetCursor ($DicePic2, 2) $DicePic2 = GUICtrlCreateButton ("", 128, 24, 46, 46, $BS_BITMAP) GUICtrlSetImage ($dicePic2, "images\dice2.bmp") GUICtrlSetOnEvent ($dicePic2, "dice1click") ;~$DicePic3 = GUICtrlCreatePic("images\dice3.bmp", 224, 24, 46, 46, BitOR($SS_NOTIFY,$WS_GROUP)) ;~GUICtrlSetCursor ($DicePic3, 2) $DicePic3 = GUICtrlCreateButton ("", 224, 24, 46, 46, $BS_BITMAP) GUICtrlSetImage ($dicePic3, "images\dice3.bmp") GUICtrlSetOnEvent ($dicePic3, "dice1click") ;~$DicePic4 = GUICtrlCreatePic("images\dice4.bmp", 80, 72, 46, 46, BitOR($SS_NOTIFY,$WS_GROUP)) ;~GUICtrlSetCursor ($DicePic4, 2) $DicePic4 = GUICtrlCreateButton ("", 80, 72, 46, 46, $BS_BITMAP) GUICtrlSetImage ($dicePic4, "images\dice4.bmp") GUICtrlSetOnEvent ($dicePic4, "dice1click") ;~$DicePic5 = GUICtrlCreatePic("images\dice5.bmp", 174, 72, 46, 46, BitOR($SS_NOTIFY,$WS_GROUP)) $DicePic5 = GUICtrlCreateButton ("", 174, 72, 46, 46, $BS_BITMAP) GUICtrlSetImage ($dicePic5, "images\dice5.bmp") GUICtrlSetOnEvent ($dicePic5, "dice1click") $Pic1 = GUICtrlCreatePic("images\upper_labels.bmp", 80, 160, 103, 150, BitOR($SS_NOTIFY,$WS_GROUP)) $Pic2 = GUICtrlCreatePic("images\lower_labels.bmp", 80, 320, 103, 164, BitOR($SS_NOTIFY,$WS_GROUP)) $Group1 = GUICtrlCreateGroup("", 16, 8, 273, 123) GUICtrlCreateGroup("", -99, -99, 1, 1) $Pic3 = GUICtrlCreatePic("images\upper_boxes.bmp", 183, 160, 43, 150, BitOR($SS_NOTIFY,$WS_GROUP)) $Pic4 = GUICtrlCreatePic("images\lower_boxes.bmp", 183, 320, 43, 164, BitOR($SS_NOTIFY,$WS_GROUP)) $picX1 = GUICtrlCreatePic("images/X.bmp", $CoordX1[0], $CoordX1[1], 12, 15) GUICtrlSetState ($picX1, $GUI_HIDE) $picX2 = GUICtrlCreatePic("images/X.bmp", $CoordX2[0], $CoordX2[1], 12, 15) GUICtrlSetState ($picX2, $GUI_HIDE) $picX3 = GUICtrlCreatePic("images/X.bmp", $CoordX3[0], $CoordX3[1], 12, 15) GUICtrlSetState ($picX3, $GUI_HIDE) $labelAces = GUICtrlCreateLabel ("", $CoordAces[0], $CoordAces[1], 45) GUICtrlSetBkColor (-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont (-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelTwos = GUICtrlCreateLabel ("", $CoordTwos[0], $CoordTwos[1], 45) GUICtrlSetBkColor (-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont (-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelThrees = GUICtrlCreateLabel ("", $CoordThrees[0], $CoordThrees[1], 45) GUICtrlSetBkColor (-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont (-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelFours = GUICtrlCreateLabel ("", $CoordFours[0], $CoordFours[1], 45) GUICtrlSetBkColor (-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont (-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelFives = GUICtrlCreateLabel ("", $CoordFives[0], $CoordFives[1], 45) GUICtrlSetBkColor (-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont (-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelSixes = GUICtrlCreateLabel ("", $CoordSixes[0], $CoordSixes[1], 45) GUICtrlSetBkColor (-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont (-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelScore = GUICtrlCreateLabel ("", $CoordScore[0], $CoordScore[1], 45) GUICtrlSetBkColor (-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont (-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelBonus1 = GUICtrlCreateLabel ("", $CoordBonus1[0], $CoordBonus1[1], 45) GUICtrlSetBkColor (-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont (-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelTotal1 = GUICtrlCreateLabel ("", $CoordTotal1[0], $CoordTotal1[1], 45) GUICtrlSetBkColor (-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont (-1, $ScoreFontSize, 400, 0, $ScoreFont) $label3kind = GUICtrlCreateLabel ("", $Coord3kind[0], $Coord3kind[1], 45) GUICtrlSetBkColor (-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont (-1, $ScoreFontSize, 400, 0, $ScoreFont) $label4kind = GUICtrlCreateLabel ("", $Coord4kind[0], $Coord4kind[1], 45) GUICtrlSetBkColor (-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont (-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelFull = GUICtrlCreateLabel ("", $CoordFullHouse[0], $CoordFullHouse[1], 45) GUICtrlSetBkColor (-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont (-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelSmall = GUICtrlCreateLabel ("", $CoordSmStraight[0], $CoordSmStraight[1], 45) GUICtrlSetBkColor (-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont (-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelLarge = GUICtrlCreateLabel ("", $CoordLgStraight[0], $CoordLgStraight[1], 45) GUICtrlSetBkColor (-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont (-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelYahtzee = GUICtrlCreateLabel ("", $CoordYahtzee[0], $CoordYahtzee[1], 45) GUICtrlSetBkColor (-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont (-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelChance = GUICtrlCreateLabel ("", $CoordChance[0], $CoordChance[1], 45) GUICtrlSetBkColor (-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont (-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelBonus2 = GUICtrlCreateLabel ("", $CoordBonus2[0], $CoordBonus2[1], 45) GUICtrlSetBkColor (-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont (-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelTotal2 = GUICtrlCreateLabel ("", $CoordTotal2[0], $CoordTotal2[1], 45) GUICtrlSetBkColor (-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont (-1, $ScoreFontSize, 400, 0, $ScoreFont) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $iStart = 1 #region main loop For $i=$iStart To 13 _rollDice () ;~ MsgBox (0, "", "You rolled: "&$dice_res[0]&@CRLF&@CRLF&$dice_res[1]&$dice_res[2]&$dice_res[3]&$dice_res[4]&$dice_res[5]) _findPossScores () If Not $Aces And Not $Twos And Not $Threes And Not $Fours And Not $Fives And Not $Sixes And Not $3kind And Not $4kind And Not $Full And Not $Small And Not $Large And Not $Yahtzee And Not $Chance Then MsgBox (0, "Info - Yahtzee Au3", "Oh no! You have no possible moves. You lose a turn!") Else Opt ("GUIOnEventMode", 0) #Region ### START Koda GUI section ###553, 115 $pos = WinGetPos ("Yahtzee Au3") $GUI2 = GUICreate("GUI2", 250, 490, $pos[0]+$pos[2], $pos[1]) GUISwitch ($GUI2) $buttonAces = GUICtrlCreateButton("Aces", 24, 24, 201, 25, 0) If Not $Aces Then GUICtrlSetState ($buttonAces, $GUI_DISABLE) $buttonTwos = GUICtrlCreateButton("Twos", 24, 56, 201, 25, 0) If Not $Twos Then GUICtrlSetState ($buttonTwos, $GUI_DISABLE) $buttonThrees = GUICtrlCreateButton("Threes", 24, 88, 201, 25, 0) If Not $Threes Then GUICtrlSetState ($buttonThrees, $GUI_DISABLE) $buttonFours = GUICtrlCreateButton("Fours", 24, 120, 201, 25, 0) If Not $Fours Then GUICtrlSetState ($buttonFours, $GUI_DISABLE) $buttonFives = GUICtrlCreateButton("Fives", 24, 152, 201, 25, 0) If Not $Fives Then GUICtrlSetState ($buttonFives, $GUI_DISABLE) $buttonSixes = GUICtrlCreateButton("Sixes", 24, 184, 201, 25, 0) If Not $Sixes Then GUICtrlSetState ($buttonSixes, $GUI_DISABLE) $Group1 = GUICtrlCreateGroup("", 8, 8, 233, 217) GUICtrlCreateGroup("", -99, -99, 1, 1) $button3kind = GUICtrlCreateButton("3 of a kind", 24, 248, 201, 25, 0) If Not $3kind Then GUICtrlSetState ($button3kind, $GUI_DISABLE) $button4kind = GUICtrlCreateButton("4 of a kind", 24, 280, 201, 25, 0) If Not $4kind Then GUICtrlSetState ($button4kind, $GUI_DISABLE) $buttonFull = GUICtrlCreateButton("Full House", 24, 312, 201, 25, 0) If Not $Full Then GUICtrlSetState ($buttonFull, $GUI_DISABLE) $buttonSmall = GUICtrlCreateButton("Small Straight", 24, 344, 201, 25, 0) If Not $Small Then GUICtrlSetState ($buttonSmall, $GUI_DISABLE) $buttonLarge = GUICtrlCreateButton("Large Staight", 24, 376, 201, 25, 0) If Not $Large Then GUICtrlSetState ($buttonLarge, $GUI_DISABLE) $buttonYahtzee = GUICtrlCreateButton("YAHTZEE", 24, 408, 201, 25, 0) If Not $Yahtzee Then GUICtrlSetState ($buttonYahtzee, $GUI_DISABLE) $buttonChance = GUICtrlCreateButton("Chance", 24, 440, 201, 25, 0) If Not $Chance Then GUICtrlSetState ($buttonChance, $GUI_DISABLE) $Group2 = GUICtrlCreateGroup("", 8, 232, 233, 249) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _close () Case $buttonAces $choice = "Aces" ExitLoop Case $buttonTwos $choice = "Twos" ExitLoop Case $buttonThrees $choice = "Threes" ExitLoop Case $buttonFours $choice = "Fours" ExitLoop Case $buttonFives $choice = "Fives" ExitLoop Case $buttonSixes $choice = "Sixes" ExitLoop Case $button3kind $choice = "3kind" ExitLoop Case $button4kind $choice = "4kind" ExitLoop Case $buttonFull $choice = "Full" ExitLoop Case $buttonSmall $choice = "Small" ExitLoop Case $buttonLarge $choice = "Large" ExitLoop Case $buttonYahtzee $choice = "Yahtzee" ExitLoop Case $buttonChance $choice = "Chance" ExitLoop EndSwitch WEnd GUIDelete () Opt ("GUIOnEventMode", 1) GUISwitch ($GUI) ;~ MsgBox (0, "", $dice_res[0]&@CRLF&@CRLF&$choice&" for "&Eval($choice)&" points") ;assign score If $choice <> "Yahtzee" Then Assign ($choice&"Score", Eval($choice)) GUICtrlSetData (Eval("label"&$choice), Eval($choice)) Else If $YahtzeeScore Then If Not $Yahtzee1Score Then $Yahtzee1Score = $Yahtzee GUICtrlSetState ($picX1, $GUI_SHOW) ElseIf Not $Yahtzee2Score Then $Yahtzee2Score = $Yahtzee GUICtrlSetState ($picX2, $GUI_SHOW) ElseIf Not $Yahtzee3Score Then $Yahtzee3Score = $Yahtzee GUICtrlSetState ($picX3, $GUI_SHOW) EndIf Else $YahtzeeScore = $Yahtzee GUICtrlSetData ($labelYahtzee, $Yahtzee) EndIf EndIf EndIf ;reset possible scores _reset () Next #endregion main loop ;check score $UpperScore = $AcesScore + $TwosScore + $ThreesScore + $FoursScore + $FivesScore + $SixesScore Sleep(200) GUICtrlSetData ($labelScore, $UpperScore) If $UpperScore > 62 Then $bonus1 = 35 Else $bonus1 = 0 EndIf Sleep(200) GUICtrlSetData ($labelBonus1, $bonus1) $total1 = $UpperScore + $bonus1 Sleep(200) GUICtrlSetData ($labelTotal1, $total1) $LowerScore = $3kindScore + $4kindScore + $FullScore + $SmallScore + $LargeScore + $YahtzeeScore + $ChanceScore $bonus2 = $Yahtzee1Score + $Yahtzee2Score + $Yahtzee3Score Sleep(200) GUICtrlSetData ($labelBonus2, $bonus2) $total2 = $LowerScore + $bonus2 Sleep(200) GUICtrlSetData ($labelTotal2, $total2) Sleep (1000) MsgBox (0, "Yahtzee Au3", "GRAND TOTAL - "&$total1+$total2) #region Functions Func _rollDice () $dice1 = Random(1,6,1) $dice2 = Random(1,6,1) $dice3 = Random(1,6,1) $dice4 = Random(1,6,1) $dice5 = Random(1,6,1) $dice_res[0] = String($dice1&$dice2&$dice3&$dice4&$dice5) $dice_res[1] = $dice1 $dice_res[2] = $dice2 $dice_res[3] = $dice3 $dice_res[4] = $dice4 $dice_res[5] = $dice5 ;~ MsgBox (0, "", $dice1&$dice2&$dice3&$dice4&$dice5) For $z = 1 To 2 For $zz = 1 To 6 GUICtrlSetImage ($DicePic1, "images\dice"&$zz&".bmp") GUICtrlSetImage ($DicePic2, "images\dice"&$zz&".bmp") GUICtrlSetImage ($DicePic3, "images\dice"&$zz&".bmp") GUICtrlSetImage ($DicePic4, "images\dice"&$zz&".bmp") GUICtrlSetImage ($DicePic5, "images\dice"&$zz&".bmp") Sleep(50) Next Next GUICtrlSetImage ($DicePic1, "images\dice"&$dice1&".bmp") GUICtrlSetImage ($DicePic2, "images\dice"&$dice2&".bmp") GUICtrlSetImage ($DicePic3, "images\dice"&$dice3&".bmp") GUICtrlSetImage ($DicePic4, "images\dice"&$dice4&".bmp") GUICtrlSetImage ($DicePic5, "images\dice"&$dice5&".bmp") EndFunc Func _reset () Global $Aces = 0 Global $Twos = 0 Global $Threes = 0 Global $Fours = 0 Global $Fives = 0 Global $Sixes = 0 Global $3kind = 0 Global $4kind = 0 Global $Full = 0 Global $Small = 0 Global $Large = 0 Global $Yahtzee = 0 Global $Yahtzee1Score = 0 Global $Yahtzee2Score = 0 Global $Yahtzee3Score = 0 Global $Chance = 0 EndFunc Func _close () $close = MsgBox (4, "Yahtzee", "Are you sure you want to quit?") If $close = 7 Then Return $save = MsgBox (4, "Yahtzee", "Save game first?") If $save = 6 Then MsgBox (64, "Yahtzee", "Save feature to be implemented in a later version.") Exit EndFunc Func _stringNumOccur ($sStr1, $sStr2) For $i = 1 to StringLen($sStr1) If not StringInStr($sStr1, $sStr2, 1, $i) Then ExitLoop Next Return $i - 1 EndFunc Func _findPossScores () ;aces If StringInStr($dice_res[0], "1") And Not $AcesScore then $Aces = _stringNumOccur ($dice_res[0], "1") ;twos If StringInStr($dice_res[0], "2") And Not $TwosScore then $Twos = _stringNumOccur ($dice_res[0], "2") *2 ;threes If StringInStr($dice_res[0], "3") And Not $ThreesScore then $Threes = _stringNumOccur ($dice_res[0], "3") *3 ;fours If StringInStr($dice_res[0], "4") And Not $FoursScore then $Fours = _stringNumOccur ($dice_res[0], "4") *4 ;fives If StringInStr($dice_res[0], "5") And Not $FivesScore then $Fives = _stringNumOccur ($dice_res[0], "5") *5 ;sixes If StringInStr($dice_res[0], "6") And Not $SixesScore then $Sixes = _stringNumOccur ($dice_res[0], "6") *6 ;3 of a kind If _stringNumOccur($dice_res[0], "1") > 2 Or _stringNumOccur($dice_res[0], "2") > 2 Or _stringNumOccur($dice_res[0], "3") > 2 Or _stringNumOccur($dice_res[0], "4") > 2 Or _stringNumOccur($dice_res[0], "5") > 2 Or _stringNumOccur($dice_res[0], "5") > 2 Then If Not $3kindScore Then $3kind = $dice_res[1]+$dice_res[2]+$dice_res[3]+$dice_res[4]+$dice_res[5] EndIf ;4 of a kind If _stringNumOccur($dice_res[0], "1") > 3 Or _stringNumOccur($dice_res[0], "2") > 3 Or _stringNumOccur($dice_res[0], "3") > 3 Or _stringNumOccur($dice_res[0], "4") > 3 Or _stringNumOccur($dice_res[0], "5") > 3 Or _stringNumOccur($dice_res[0], "5") > 3 Then If Not $4kindScore Then $4kind = $dice_res[1]+$dice_res[2]+$dice_res[3]+$dice_res[4]+$dice_res[5] EndIf ;full house If Not $FullScore Then For $x = 1 To 6 For $xx = 1 To 6 If _stringNumOccur($dice_res[0], $x) = 3 And _stringNumOccur($dice_res[0], $xx) = 2 And $x <> $xx Then $Full = 25 ExitLoop 2 EndIf Next Next EndIf ;small straight If StringInStr($dice_res[0],"1") and StringInStr($dice_res[0],"2") and StringInStr($dice_res[0],"3") and StringInStr($dice_res[0],"4") Then If Not $SmallScore Then $Small = 30 ElseIf StringInStr($dice_res[0],"2") and StringInStr($dice_res[0],"3") and StringInStr($dice_res[0],"4") and StringInStr($dice_res[0],"5") Then If Not $SmallScore Then $Small = 30 ElseIf StringInStr($dice_res[0],"3") and StringInStr($dice_res[0],"4") and StringInStr($dice_res[0],"5") and StringInStr($dice_res[0],"6") Then If Not $SmallScore Then $Small = 30 EndIf ;large straight If StringInStr($dice_res[0],"1") and StringInStr($dice_res[0],"2") and StringInStr($dice_res[0],"3") and StringInStr($dice_res[0],"4") And StringInStr($dice_res[0],"5") Then If Not $LargeScore Then $Large = 40 ElseIf StringInStr($dice_res[0],"2") And StringInStr($dice_res[0],"3") and StringInStr($dice_res[0],"4") and StringInStr($dice_res[0],"5") and StringInStr($dice_res[0],"6") Then If Not $LargeScore Then $Large = 40 EndIf ;yahtzee If $dice_res[1]=$dice_res[2] and $dice_res[2]=$dice_res[3] and $dice_res[3]=$dice_res[4] and $dice_res[4]=$dice_res[5] Then If Not $YahtzeeScore Then $Yahtzee = 50 If $YahtzeeScore Then If Not $Yahtzee1Score Or Not $Yahtzee2Score Or Not $Yahtzee3Score Then $Yahtzee = 100 EndIf EndIf ;chance If Not $ChanceScore Then $Chance = $dice_res[1]+$dice_res[2]+$dice_res[3]+$dice_res[4]+$dice_res[5] EndFunc Func dice1click () MsgBox (0, "clicked", "clicked") EndFunc #endregion Functions The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
The Kandie Man Posted March 28, 2007 Posted March 28, 2007 Don't use GUIGetMsg for the second GUI. Use GUICtrlSetOnEvent() for both GUI's. Here, I was nice enough to do it for you. expandcollapse popup#cs ---------------------------------------------------------------------------- Script Name: YAHTZEE! Script Version: 1.3 Author: Matt Roth (theguy0000) <theguy0000@gmail.com> Release Date: - AutoIt Version: 3.2.3.0 (beta) Notes: - #ce ---------------------------------------------------------------------------- Opt("GUIOnEventMode", 1) #include <GUIConstants.au3> Global Const $ScoreFont = "Comic Sans MS" Global Const $ScoreFontSize = 12 Global Const $CoordX1[2] = [184, 452] Global Const $CoordX2[2] = [197, 452] Global Const $CoordX3[2] = [210, 452] Global Const $CoordAces[2] = [187, 159] Global Const $CoordTwos[2] = [187, 175] Global Const $CoordThrees[2] = [187, 191] Global Const $CoordFours[2] = [187, 207] Global Const $CoordFives[2] = [187, 223] Global Const $CoordSixes[2] = [187, 239] Global Const $CoordScore[2] = [187, 257] Global Const $CoordBonus1[2] = [187, 273] Global Const $CoordTotal1[2] = [187, 289] Global Const $Coord3kind[2] = [187, 319] Global Const $Coord4kind[2] = [187, 335] Global Const $CoordFullHouse[2] = [187, 351] Global Const $CoordSmStraight[2] = [187, 367] Global Const $CoordLgStraight[2] = [187, 383] Global Const $CoordYahtzee[2] = [187, 399] Global Const $CoordChance[2] = [187, 415] Global Const $CoordBonus2[2] = [187, 431] Global Const $CoordTotal2[2] = [187, 463] Global $dice_res[6] Global $Aces = 0 Global $Twos = 0 Global $Threes = 0 Global $Fours = 0 Global $Fives = 0 Global $Sixes = 0 Global $3kind = 0 Global $4kind = 0 Global $Full = 0 Global $Small = 0 Global $Large = 0 Global $Yahtzee = 0 Global $Chance = 0 Global $AcesScore = 0 Global $TwosScore = 0 Global $ThreesScore = 0 Global $FoursScore = 0 Global $FivesScore = 0 Global $SixesScore = 0 Global $3kindScore = 0 Global $4kindScore = 0 Global $FullScore = 0 Global $SmallScore = 0 Global $LargeScore = 0 Global $YahtzeeScore = 0 Global $Yahtzee1Score = 0 Global $Yahtzee2Score = 0 Global $Yahtzee3Score = 0 Global $ChanceScore = 0 Global $choice = "" Global $GUI2Close = False #Region ### START Koda GUI section ### $GUI = GUICreate("Yahtzee Au3", 306, 498, 247, 115) GUISetOnEvent($GUI_EVENT_CLOSE, "_close") ;~$DicePic1 = GUICtrlCreatePic("images\dice1.bmp", 32, 24, 46, 46, BitOR($SS_NOTIFY,$WS_GROUP)) ;~GUICtrlSetCursor ($DicePic1, 2) $DicePic1 = GUICtrlCreateButton("", 32, 24, 46, 46, $BS_BITMAP) GUICtrlSetImage($DicePic1, "images\dice1.bmp") GUICtrlSetOnEvent($DicePic1, "dice1click") ;~$DicePic2 = GUICtrlCreatePic("images\dice2.bmp", 128, 24, 46, 46, BitOR($SS_NOTIFY,$WS_GROUP)) ;~GUICtrlSetCursor ($DicePic2, 2) $DicePic2 = GUICtrlCreateButton("", 128, 24, 46, 46, $BS_BITMAP) GUICtrlSetImage($DicePic2, "images\dice2.bmp") GUICtrlSetOnEvent($DicePic2, "dice1click") ;~$DicePic3 = GUICtrlCreatePic("images\dice3.bmp", 224, 24, 46, 46, BitOR($SS_NOTIFY,$WS_GROUP)) ;~GUICtrlSetCursor ($DicePic3, 2) $DicePic3 = GUICtrlCreateButton("", 224, 24, 46, 46, $BS_BITMAP) GUICtrlSetImage($DicePic3, "images\dice3.bmp") GUICtrlSetOnEvent($DicePic3, "dice1click") ;~$DicePic4 = GUICtrlCreatePic("images\dice4.bmp", 80, 72, 46, 46, BitOR($SS_NOTIFY,$WS_GROUP)) ;~GUICtrlSetCursor ($DicePic4, 2) $DicePic4 = GUICtrlCreateButton("", 80, 72, 46, 46, $BS_BITMAP) GUICtrlSetImage($DicePic4, "images\dice4.bmp") GUICtrlSetOnEvent($DicePic4, "dice1click") ;~$DicePic5 = GUICtrlCreatePic("images\dice5.bmp", 174, 72, 46, 46, BitOR($SS_NOTIFY,$WS_GROUP)) $DicePic5 = GUICtrlCreateButton("", 174, 72, 46, 46, $BS_BITMAP) GUICtrlSetImage($DicePic5, "images\dice5.bmp") GUICtrlSetOnEvent($DicePic5, "dice1click") $Pic1 = GUICtrlCreatePic("images\upper_labels.bmp", 80, 160, 103, 150, BitOR($SS_NOTIFY, $WS_GROUP)) $Pic2 = GUICtrlCreatePic("images\lower_labels.bmp", 80, 320, 103, 164, BitOR($SS_NOTIFY, $WS_GROUP)) $Group1 = GUICtrlCreateGroup("", 16, 8, 273, 123) GUICtrlCreateGroup("", -99, -99, 1, 1) $Pic3 = GUICtrlCreatePic("images\upper_boxes.bmp", 183, 160, 43, 150, BitOR($SS_NOTIFY, $WS_GROUP)) $Pic4 = GUICtrlCreatePic("images\lower_boxes.bmp", 183, 320, 43, 164, BitOR($SS_NOTIFY, $WS_GROUP)) $picX1 = GUICtrlCreatePic("images/X.bmp", $CoordX1[0], $CoordX1[1], 12, 15) GUICtrlSetState($picX1, $GUI_HIDE) $picX2 = GUICtrlCreatePic("images/X.bmp", $CoordX2[0], $CoordX2[1], 12, 15) GUICtrlSetState($picX2, $GUI_HIDE) $picX3 = GUICtrlCreatePic("images/X.bmp", $CoordX3[0], $CoordX3[1], 12, 15) GUICtrlSetState($picX3, $GUI_HIDE) $labelAces = GUICtrlCreateLabel("", $CoordAces[0], $CoordAces[1], 45) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelTwos = GUICtrlCreateLabel("", $CoordTwos[0], $CoordTwos[1], 45) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelThrees = GUICtrlCreateLabel("", $CoordThrees[0], $CoordThrees[1], 45) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelFours = GUICtrlCreateLabel("", $CoordFours[0], $CoordFours[1], 45) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelFives = GUICtrlCreateLabel("", $CoordFives[0], $CoordFives[1], 45) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelSixes = GUICtrlCreateLabel("", $CoordSixes[0], $CoordSixes[1], 45) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelScore = GUICtrlCreateLabel("", $CoordScore[0], $CoordScore[1], 45) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelBonus1 = GUICtrlCreateLabel("", $CoordBonus1[0], $CoordBonus1[1], 45) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelTotal1 = GUICtrlCreateLabel("", $CoordTotal1[0], $CoordTotal1[1], 45) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, $ScoreFontSize, 400, 0, $ScoreFont) $label3kind = GUICtrlCreateLabel("", $Coord3kind[0], $Coord3kind[1], 45) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, $ScoreFontSize, 400, 0, $ScoreFont) $label4kind = GUICtrlCreateLabel("", $Coord4kind[0], $Coord4kind[1], 45) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelFull = GUICtrlCreateLabel("", $CoordFullHouse[0], $CoordFullHouse[1], 45) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelSmall = GUICtrlCreateLabel("", $CoordSmStraight[0], $CoordSmStraight[1], 45) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelLarge = GUICtrlCreateLabel("", $CoordLgStraight[0], $CoordLgStraight[1], 45) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelYahtzee = GUICtrlCreateLabel("", $CoordYahtzee[0], $CoordYahtzee[1], 45) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelChance = GUICtrlCreateLabel("", $CoordChance[0], $CoordChance[1], 45) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelBonus2 = GUICtrlCreateLabel("", $CoordBonus2[0], $CoordBonus2[1], 45) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, $ScoreFontSize, 400, 0, $ScoreFont) $labelTotal2 = GUICtrlCreateLabel("", $CoordTotal2[0], $CoordTotal2[1], 45) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, $ScoreFontSize, 400, 0, $ScoreFont) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $iStart = 1 #region main loop For $i = $iStart To 13 _rollDice() ;~ MsgBox (0, "", "You rolled: "&$dice_res[0]&@CRLF&@CRLF&$dice_res[1]&$dice_res[2]&$dice_res[3]&$dice_res[4]&$dice_res[5]) _findPossScores() If Not $Aces And Not $Twos And Not $Threes And Not $Fours And Not $Fives And Not $Sixes And Not $3kind And Not $4kind And Not $Full And Not $Small And Not $Large And Not $Yahtzee And Not $Chance Then MsgBox(0, "Info - Yahtzee Au3", "Oh no! You have no possible moves. You lose a turn!") Else ;~ Opt("GUIOnEventMode", 0) #Region ### START Koda GUI section ###553, 115 $pos = WinGetPos("Yahtzee Au3") $GUI2 = GUICreate("GUI2", 250, 490, $pos[0] + $pos[2], $pos[1]) GUISwitch($GUI2) GUISetOnEvent($GUI_EVENT_CLOSE, "_close") $buttonAces = GUICtrlCreateButton("Aces", 24, 24, 201, 25, 0) GUICtrlSetOnEvent(-1,"GUI2SetOnEventFunc") If Not $Aces Then GUICtrlSetState($buttonAces, $GUI_DISABLE) $buttonTwos = GUICtrlCreateButton("Twos", 24, 56, 201, 25, 0) GUICtrlSetOnEvent(-1,"GUI2SetOnEventFunc") If Not $Twos Then GUICtrlSetState($buttonTwos, $GUI_DISABLE) $buttonThrees = GUICtrlCreateButton("Threes", 24, 88, 201, 25, 0) GUICtrlSetOnEvent(-1,"GUI2SetOnEventFunc") If Not $Threes Then GUICtrlSetState($buttonThrees, $GUI_DISABLE) $buttonFours = GUICtrlCreateButton("Fours", 24, 120, 201, 25, 0) GUICtrlSetOnEvent(-1,"GUI2SetOnEventFunc") If Not $Fours Then GUICtrlSetState($buttonFours, $GUI_DISABLE) $buttonFives = GUICtrlCreateButton("Fives", 24, 152, 201, 25, 0) GUICtrlSetOnEvent(-1,"GUI2SetOnEventFunc") If Not $Fives Then GUICtrlSetState($buttonFives, $GUI_DISABLE) $buttonSixes = GUICtrlCreateButton("Sixes", 24, 184, 201, 25, 0) GUICtrlSetOnEvent(-1,"GUI2SetOnEventFunc") If Not $Sixes Then GUICtrlSetState($buttonSixes, $GUI_DISABLE) $Group1 = GUICtrlCreateGroup("", 8, 8, 233, 217) GUICtrlCreateGroup("", -99, -99, 1, 1) $button3kind = GUICtrlCreateButton("3 of a kind", 24, 248, 201, 25, 0) GUICtrlSetOnEvent(-1,"GUI2SetOnEventFunc") If Not $3kind Then GUICtrlSetState($button3kind, $GUI_DISABLE) $button4kind = GUICtrlCreateButton("4 of a kind", 24, 280, 201, 25, 0) GUICtrlSetOnEvent(-1,"GUI2SetOnEventFunc") If Not $4kind Then GUICtrlSetState($button4kind, $GUI_DISABLE) $buttonFull = GUICtrlCreateButton("Full House", 24, 312, 201, 25, 0) GUICtrlSetOnEvent(-1,"GUI2SetOnEventFunc") If Not $Full Then GUICtrlSetState($buttonFull, $GUI_DISABLE) $buttonSmall = GUICtrlCreateButton("Small Straight", 24, 344, 201, 25, 0) GUICtrlSetOnEvent(-1,"GUI2SetOnEventFunc") If Not $Small Then GUICtrlSetState($buttonSmall, $GUI_DISABLE) $buttonLarge = GUICtrlCreateButton("Large Staight", 24, 376, 201, 25, 0) GUICtrlSetOnEvent(-1,"GUI2SetOnEventFunc") If Not $Large Then GUICtrlSetState($buttonLarge, $GUI_DISABLE) $buttonYahtzee = GUICtrlCreateButton("YAHTZEE", 24, 408, 201, 25, 0) GUICtrlSetOnEvent(-1,"GUI2SetOnEventFunc") If Not $Yahtzee Then GUICtrlSetState($buttonYahtzee, $GUI_DISABLE) $buttonChance = GUICtrlCreateButton("Chance", 24, 440, 201, 25, 0) GUICtrlSetOnEvent(-1,"GUI2SetOnEventFunc") If Not $Chance Then GUICtrlSetState($buttonChance, $GUI_DISABLE) $Group2 = GUICtrlCreateGroup("", 8, 232, 233, 249) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $GUI2Close = False While 1 ;~ Opt ("GUIOnEventMode", 1) ;~ $nMsg = GUIGetMsg() ;~ Opt ("GUIOnEventMode", 0) If $GUI2Close = True Then Exitloop sleep(100) WEnd GUIDelete() Opt("GUIOnEventMode", 1) GUISwitch($GUI) ;~ MsgBox (0, "", $dice_res[0]&@CRLF&@CRLF&$choice&" for "&Eval($choice)&" points") ;assign score If $choice <> "Yahtzee" Then Assign($choice & "Score", Eval($choice)) GUICtrlSetData(Eval("label" & $choice), Eval($choice)) Else If $YahtzeeScore Then If Not $Yahtzee1Score Then $Yahtzee1Score = $Yahtzee GUICtrlSetState($picX1, $GUI_SHOW) ElseIf Not $Yahtzee2Score Then $Yahtzee2Score = $Yahtzee GUICtrlSetState($picX2, $GUI_SHOW) ElseIf Not $Yahtzee3Score Then $Yahtzee3Score = $Yahtzee GUICtrlSetState($picX3, $GUI_SHOW) EndIf Else $YahtzeeScore = $Yahtzee GUICtrlSetData($labelYahtzee, $Yahtzee) EndIf EndIf EndIf ;reset possible scores _reset() Next #endregion main loop ;check score $UpperScore = $AcesScore + $TwosScore + $ThreesScore + $FoursScore + $FivesScore + $SixesScore Sleep(200) GUICtrlSetData($labelScore, $UpperScore) If $UpperScore > 62 Then $bonus1 = 35 Else $bonus1 = 0 EndIf Sleep(200) GUICtrlSetData($labelBonus1, $bonus1) $total1 = $UpperScore + $bonus1 Sleep(200) GUICtrlSetData($labelTotal1, $total1) $LowerScore = $3kindScore + $4kindScore + $FullScore + $SmallScore + $LargeScore + $YahtzeeScore + $ChanceScore $bonus2 = $Yahtzee1Score + $Yahtzee2Score + $Yahtzee3Score Sleep(200) GUICtrlSetData($labelBonus2, $bonus2) $total2 = $LowerScore + $bonus2 Sleep(200) GUICtrlSetData($labelTotal2, $total2) Sleep(1000) MsgBox(0, "Yahtzee Au3", "GRAND TOTAL - " & $total1 + $total2) #region Functions Func _rollDice() $dice1 = Random(1, 6, 1) $dice2 = Random(1, 6, 1) $dice3 = Random(1, 6, 1) $dice4 = Random(1, 6, 1) $dice5 = Random(1, 6, 1) $dice_res[0] = String($dice1 & $dice2 & $dice3 & $dice4 & $dice5) $dice_res[1] = $dice1 $dice_res[2] = $dice2 $dice_res[3] = $dice3 $dice_res[4] = $dice4 $dice_res[5] = $dice5 ;~ MsgBox (0, "", $dice1&$dice2&$dice3&$dice4&$dice5) For $z = 1 To 2 For $zz = 1 To 6 GUICtrlSetImage($DicePic1, "images\dice" & $zz & ".bmp") GUICtrlSetImage($DicePic2, "images\dice" & $zz & ".bmp") GUICtrlSetImage($DicePic3, "images\dice" & $zz & ".bmp") GUICtrlSetImage($DicePic4, "images\dice" & $zz & ".bmp") GUICtrlSetImage($DicePic5, "images\dice" & $zz & ".bmp") Sleep(50) Next Next GUICtrlSetImage($DicePic1, "images\dice" & $dice1 & ".bmp") GUICtrlSetImage($DicePic2, "images\dice" & $dice2 & ".bmp") GUICtrlSetImage($DicePic3, "images\dice" & $dice3 & ".bmp") GUICtrlSetImage($DicePic4, "images\dice" & $dice4 & ".bmp") GUICtrlSetImage($DicePic5, "images\dice" & $dice5 & ".bmp") EndFunc ;==>_rollDice Func _reset() Global $Aces = 0 Global $Twos = 0 Global $Threes = 0 Global $Fours = 0 Global $Fives = 0 Global $Sixes = 0 Global $3kind = 0 Global $4kind = 0 Global $Full = 0 Global $Small = 0 Global $Large = 0 Global $Yahtzee = 0 Global $Yahtzee1Score = 0 Global $Yahtzee2Score = 0 Global $Yahtzee3Score = 0 Global $Chance = 0 EndFunc ;==>_reset Func _close() $close = MsgBox(4, "Yahtzee", "Are you sure you want to quit?") If $close = 7 Then Return $save = MsgBox(4, "Yahtzee", "Save game first?") If $save = 6 Then MsgBox(64, "Yahtzee", "Save feature to be implemented in a later version.") Exit EndFunc ;==>_close Func _stringNumOccur($sStr1, $sStr2) For $i = 1 To StringLen($sStr1) If Not StringInStr($sStr1, $sStr2, 1, $i) Then ExitLoop Next Return $i - 1 EndFunc ;==>_stringNumOccur Func _findPossScores() ;aces If StringInStr($dice_res[0], "1") And Not $AcesScore Then $Aces = _stringNumOccur($dice_res[0], "1") ;twos If StringInStr($dice_res[0], "2") And Not $TwosScore Then $Twos = _stringNumOccur($dice_res[0], "2") * 2 ;threes If StringInStr($dice_res[0], "3") And Not $ThreesScore Then $Threes = _stringNumOccur($dice_res[0], "3") * 3 ;fours If StringInStr($dice_res[0], "4") And Not $FoursScore Then $Fours = _stringNumOccur($dice_res[0], "4") * 4 ;fives If StringInStr($dice_res[0], "5") And Not $FivesScore Then $Fives = _stringNumOccur($dice_res[0], "5") * 5 ;sixes If StringInStr($dice_res[0], "6") And Not $SixesScore Then $Sixes = _stringNumOccur($dice_res[0], "6") * 6 ;3 of a kind If _stringNumOccur($dice_res[0], "1") > 2 Or _stringNumOccur($dice_res[0], "2") > 2 Or _stringNumOccur($dice_res[0], "3") > 2 Or _stringNumOccur($dice_res[0], "4") > 2 Or _stringNumOccur($dice_res[0], "5") > 2 Or _stringNumOccur($dice_res[0], "5") > 2 Then If Not $3kindScore Then $3kind = $dice_res[1] + $dice_res[2] + $dice_res[3] + $dice_res[4] + $dice_res[5] EndIf ;4 of a kind If _stringNumOccur($dice_res[0], "1") > 3 Or _stringNumOccur($dice_res[0], "2") > 3 Or _stringNumOccur($dice_res[0], "3") > 3 Or _stringNumOccur($dice_res[0], "4") > 3 Or _stringNumOccur($dice_res[0], "5") > 3 Or _stringNumOccur($dice_res[0], "5") > 3 Then If Not $4kindScore Then $4kind = $dice_res[1] + $dice_res[2] + $dice_res[3] + $dice_res[4] + $dice_res[5] EndIf ;full house If Not $FullScore Then For $x = 1 To 6 For $xx = 1 To 6 If _stringNumOccur($dice_res[0], $x) = 3 And _stringNumOccur($dice_res[0], $xx) = 2 And $x <> $xx Then $Full = 25 ExitLoop 2 EndIf Next Next EndIf ;small straight If StringInStr($dice_res[0], "1") And StringInStr($dice_res[0], "2") And StringInStr($dice_res[0], "3") And StringInStr($dice_res[0], "4") Then If Not $SmallScore Then $Small = 30 ElseIf StringInStr($dice_res[0], "2") And StringInStr($dice_res[0], "3") And StringInStr($dice_res[0], "4") And StringInStr($dice_res[0], "5") Then If Not $SmallScore Then $Small = 30 ElseIf StringInStr($dice_res[0], "3") And StringInStr($dice_res[0], "4") And StringInStr($dice_res[0], "5") And StringInStr($dice_res[0], "6") Then If Not $SmallScore Then $Small = 30 EndIf ;large straight If StringInStr($dice_res[0], "1") And StringInStr($dice_res[0], "2") And StringInStr($dice_res[0], "3") And StringInStr($dice_res[0], "4") And StringInStr($dice_res[0], "5") Then If Not $LargeScore Then $Large = 40 ElseIf StringInStr($dice_res[0], "2") And StringInStr($dice_res[0], "3") And StringInStr($dice_res[0], "4") And StringInStr($dice_res[0], "5") And StringInStr($dice_res[0], "6") Then If Not $LargeScore Then $Large = 40 EndIf ;yahtzee If $dice_res[1] = $dice_res[2] And $dice_res[2] = $dice_res[3] And $dice_res[3] = $dice_res[4] And $dice_res[4] = $dice_res[5] Then If Not $YahtzeeScore Then $Yahtzee = 50 If $YahtzeeScore Then If Not $Yahtzee1Score Or Not $Yahtzee2Score Or Not $Yahtzee3Score Then $Yahtzee = 100 EndIf EndIf ;chance If Not $ChanceScore Then $Chance = $dice_res[1] + $dice_res[2] + $dice_res[3] + $dice_res[4] + $dice_res[5] EndFunc ;==>_findPossScores Func dice1click() MsgBox(0, "clicked", "clicked") EndFunc ;==>dice1click Func GUI2SetOnEventFunc() Switch @GUI_CtrlId Case $buttonAces $choice = "Aces" $GUI2Close = True Case $buttonTwos $choice = "Twos" $GUI2Close = True Case $buttonThrees $choice = "Threes" $GUI2Close = True Case $buttonFours $choice = "Fours" $GUI2Close = True Case $buttonFives $choice = "Fives" $GUI2Close = True Case $buttonSixes $choice = "Sixes" $GUI2Close = True Case $button3kind $choice = "3kind" $GUI2Close = True Case $button4kind $choice = "4kind" $GUI2Close = True Case $buttonFull $choice = "Full" $GUI2Close = True Case $buttonSmall $choice = "Small" $GUI2Close = True Case $buttonLarge $choice = "Large" $GUI2Close = True Case $buttonYahtzee $choice = "Yahtzee" $GUI2Close = True Case $buttonChance $choice = "Chance" $GUI2Close = True EndSwitch EndFunc ;==>GUI2SetOnEventFunc #endregion Functions "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire
theguy0000 Posted March 28, 2007 Author Posted March 28, 2007 (edited) Yay! Thank you! edit: by the way, what is the hotkey in scite to comment or un-comment a line? :"> Edited March 28, 2007 by theguy0000 The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
The Kandie Man Posted March 31, 2007 Posted March 31, 2007 Yay! Thank you!edit: by the way, what is the hotkey in scite to comment or un-comment a line? :Numpad minus key. "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now