Zealot Posted November 11, 2007 Share Posted November 11, 2007 I have an updown control linked to an input box and all the controls have $GUI_DOCKALL set. When I resize the window to hide the controls, then expand it again, the inputbox width has changed. Input boxes by themselves don't display this behavior. Am I doing something wrong, or is there a way to fix it? Thanks, Simon Example Code: expandcollapse popup#include <GUIConstants.au3> #include <Array.au3> $GUIHandle= GUICreate("Example", 120, 100, -1, -1) $ControlAreaDummyStart = GUICtrlCreateDummy() ;<-- Added this here for start of controls $RollUpWindow= GUICtrlCreateButton("Roll Up Window",5,5,105,20) $RollDownWindow= GUICtrlCreateButton("Roll Down Window",5,5,105,20) ;~ Hide and disable the Roll Down button GUICtrlSetState($RollDownWindow,$GUI_DISABLE + $GUI_HIDE) $Pool1= GUICtrlCreateInput("1", 5, 40, 43, 20, $ES_NUMBER) $Pool2= GUICtrlCreateInput("1", 5, 70, 43, 20, $ES_NUMBER) GUICtrlCreateUpdown($Pool2) $ControlAreaDummyEnd = GUICtrlCreateDummy() GuiSetState () For $q = $ControlAreaDummyStart To $ControlAreaDummyEnd GUICtrlSetResizing($q, $GUI_DOCKALL) Next While 1 $msg = GUIGetMsg() Select Case $msg = $RollDownWindow ; 574, 469, GUICtrlSetState($RollUpWindow,$GUI_ENABLE + $GUI_SHOW) GUICtrlSetState($RollDownWindow,$GUI_DISABLE + $GUI_HIDE) $WinSizeArray= WinGetPos($GUIHandle) WinMove($GUIHandle,"",$WinSizeArray[0],$WinSizeArray[1],$WinSizeArray[2]+5,$WinSizeArray[3]+70) Case $msg = $RollUpWindow GUICtrlSetState($RollDownWindow,$GUI_ENABLE + $GUI_SHOW) GUICtrlSetState($RollUpWindow,$GUI_DISABLE + $GUI_HIDE) $WinSizeArray= WinGetPos($GUIHandle) WinMove($GUIHandle,"",$WinSizeArray[0],$WinSizeArray[1],$WinSizeArray[2]-5,$WinSizeArray[3]-70) EndSelect If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend Full app code: expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_outfile=Odds and Evens v0.1.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;~ Program: Odds and Evens ;~ Script Compiler: Autoit version: 3 ;~ Author: Simon Goodson ;~ Email: zealott@hotmail.com ;~ Date: 7 Nov 2007 ;~ ;~ Based on: Flanf's Die Roller v1.6 ;~ Coded by: Christoph Flandorfer ;~ Created on: 13 Sept 2006 ;~ ;~ Special Thanks To: smashly from the forums for helping me to unclutter the rolled up window ;~ ;~ Script Function: ;~ A dice roller, card picker, and point tracker for use in RPGs or whatever ;~ ;~ Odds and Evens ;~ -------------- ;~ Planned v0.3 Create a new way to select which games are displayed, combo or list box ;~ Move the point tracker out into the general area somewhere ;~ ;~ ;~ v0.2 Swapped the positions of the "Roll Up Window" and KWoT checkbox button with the "Clear Results" ;~ button and made the window roll up to just show the "Roll Down Window" and KWoT buttons ;~ Changed the Generic tab to DnD, and left the Attribute Roll on that tab, all of the other ;~ functions were moved to the essentials area ;~ Added 5 point pools to the Essentails area ;~ Changed the game selection function to a combo box ;~ v0.1 Renamed app to "Odds and Evens" ;~ Began redisign of GUI ;~ Adding "Stay on Top" feature ;~ Adding "Roll-up Window" feature ;~ Adding Fate Dice function ;~ ;~ Flanf's Dice Roller ;~ ------------------- ;- Version 1.6a: Switched the output window around to get more space for the dice buttons ;- Added a tab to perform d1 through d20 wild dice. ;- Added the d20 dice to the S.Worlds tab, mostly for asthetics ;- Moved the card functions to its own section ;- Implemented 3 decks, 1 always containing all the cards, 1 to pick 1 card at a time out, and ;- one to issue multiple cards for combat also with a function to pick singles if needed ;- Moved the sort function so that all the dice results could be sorted or not depending on preference ;- Generated a random number and used it to seed the random table ;- Added a bunch of remarks to help me (Simon) understand the code ;~ Version 1.6: You can now draw Cards WITHOUT Shuffeling under Savage Worlds. ;~ Version 1.5: Marked the Wild Die Result in Savage Worlds. ;~ Version 1.4: The Fate-Table moved from the tabs to the right side and will be always easily available. Massive Changes to the GUI ;~ Version 1.3: Changes in the Output of the Savage Die Rolls (Wild Card & Sort Function). Savage Worlds is now default Tab ;~ Version 1.2: Includes now part of the Fate-Table from the Mythic RPG ;~ Version 1.1: Now with Pokercards (+2 Joker) (Savage Worlds) #include <GUIConstants.au3> #include <Array.au3> ;Global $cardsindeck Global $FullDeck ;Declare 3 arrays to contain card decks Global $CardDeck1 Global $CardDeck2 InitializeFullDeck() ;Calls the Initialize function to create the cards decks InitializeCardDeck1() InitializeCardDeck2() ; Generates a random number between 1 and 1 million and uses it to seed the random number generator $RandomSeed=random(1,1000000,1) SRandom($RandomSeed) ; Define the GUI $GUIHandle= GUICreate("Odds and Evens", 574, 469, -1, -1) $ControlAreaDummyStart = GUICtrlCreateDummy() ;<-- Added this here for start of controls $RollUpWindow= GUICtrlCreateButton("Roll Up Window",5,5,105,20) $RollDownWindow= GUICtrlCreateButton("Roll Down Window",5,5,105,20) ;~ Hide and disable the Roll Down button GUICtrlSetState($RollDownWindow,$GUI_DISABLE + $GUI_HIDE) $KeepOnTop= GUICtrlCreateCheckbox("",125,8,15,15) GUICtrlCreateLabel("Keep Window on Top",141,9) $GroupLSide= 5 $GroupTop= 28 $Essentials= GUICtrlCreateGroup("Essentials",$GroupLSide,$GroupTop,564,197) GUICtrlSetFont($Essentials,11,600) $DiceGroupSide= 9 $DiceGroupTop= 45 $DiceGroupWidth= 156 $DiceGroupHeight= 116 $Dice1stColumnOffset= 3 $DiceColumnSpacing= 52 $Dice1stRowOffset= 17 $DiceRowSpacing= 25 $DiceButtonMultiplierWidth= 15 $DicePipButtonWidth= 32 $DiceSetPipWidth= $DiceButtonMultiplierWidth+$DicePipButtonWidth $DiceButtonHeight= 20 $DiceLabel= GUICtrlCreateGroup("Dice", $DiceGroupSide, $DiceGroupTop, $DiceGroupWidth, $DiceGroupHeight, $BS_CENTER) GUICtrlSetFont($DiceLabel, 9, 400, 4) ;1st Row $SpecialButtonXD2= GUICtrlCreatebutton("x", $DiceGroupSide+$Dice1stColumnOffset, $DiceGroupTop+$Dice1stRowOffset, $DiceButtonMultiplierWidth, $DiceButtonHeight) $DiceButtonD2= GUICtrlCreateButton("d2", $DiceGroupSide+$Dice1stColumnOffset+$DiceButtonMultiplierWidth-1, $DiceGroupTop+$Dice1stRowOffset, $DicePipButtonWidth, $DiceButtonHeight) $SpecialButtonXD3= GUICtrlCreatebutton("x", $DiceGroupSide+$Dice1stColumnOffset+($DiceColumnSpacing*1), $DiceGroupTop+$Dice1stRowOffset, $DiceButtonMultiplierWidth, $DiceButtonHeight) $DiceButtonD3= GUICtrlCreateButton("d3", $DiceGroupSide+$Dice1stColumnOffset+($DiceColumnSpacing*1)+$DiceButtonMultiplierWidth-1, $DiceGroupTop+$Dice1stRowOffset, $DicePipButtonWidth, $DiceButtonHeight) $SpecialButtonXD4= GUICtrlCreatebutton("x", $DiceGroupSide+$Dice1stColumnOffset+($DiceColumnSpacing*2), $DiceGroupTop+$Dice1stRowOffset, $DiceButtonMultiplierWidth, $DiceButtonHeight) $DiceButtonD4= GUICtrlCreateButton("d4", $DiceGroupSide+$Dice1stColumnOffset+($DiceColumnSpacing*2)+$DiceButtonMultiplierWidth-1, $DiceGroupTop+$Dice1stRowOffset, $DicePipButtonWidth, $DiceButtonHeight) ;2nd Row $SpecialButtonXD6= GUICtrlCreatebutton("x", $DiceGroupSide+$Dice1stColumnOffset, $DiceGroupTop+$Dice1stRowOffset+($DiceRowSpacing*1), $DiceButtonMultiplierWidth, $DiceButtonHeight) $DiceButtonD6= GUICtrlCreateButton("d6", $DiceGroupSide+$Dice1stColumnOffset+$DiceButtonMultiplierWidth-1, $DiceGroupTop+$Dice1stRowOffset+($DiceRowSpacing*1), $DicePipButtonWidth, $DiceButtonHeight) $SpecialButtonXD8= GUICtrlCreatebutton("x", $DiceGroupSide+$Dice1stColumnOffset+($DiceColumnSpacing*1), $DiceGroupTop+$Dice1stRowOffset+($DiceRowSpacing*1), $DiceButtonMultiplierWidth, $DiceButtonHeight) $DiceButtonD8= GUICtrlCreateButton("d8", $DiceGroupSide+$Dice1stColumnOffset+($DiceColumnSpacing*1)+$DiceButtonMultiplierWidth-1, $DiceGroupTop+$Dice1stRowOffset+($DiceRowSpacing*1), $DicePipButtonWidth, $DiceButtonHeight) $SpecialButtonXD10= GUICtrlCreatebutton("x", $DiceGroupSide+$Dice1stColumnOffset+($DiceColumnSpacing*2), $DiceGroupTop+$Dice1stRowOffset+($DiceRowSpacing*1), $DiceButtonMultiplierWidth, $DiceButtonHeight) $DiceButtonD10= GUICtrlCreateButton("d10", $DiceGroupSide+$Dice1stColumnOffset+($DiceColumnSpacing*2)+$DiceButtonMultiplierWidth-1, $DiceGroupTop+$Dice1stRowOffset+($DiceRowSpacing*1), $DicePipButtonWidth, $DiceButtonHeight) ;3rd Row $SpecialButtonXD12= GUICtrlCreatebutton("x", $DiceGroupSide+$Dice1stColumnOffset, $DiceGroupTop+$Dice1stRowOffset+($DiceRowSpacing*2), $DiceButtonMultiplierWidth, $DiceButtonHeight) $DiceButtonD12= GUICtrlCreateButton("d12", $DiceGroupSide+$Dice1stColumnOffset+$DiceButtonMultiplierWidth-1, $DiceGroupTop+$Dice1stRowOffset+($DiceRowSpacing*2), $DicePipButtonWidth, $DiceButtonHeight) $SpecialButtonXD20= GUICtrlCreatebutton("x", $DiceGroupSide+$Dice1stColumnOffset+($DiceColumnSpacing*1), $DiceGroupTop+$Dice1stRowOffset+($DiceRowSpacing*2), $DiceButtonMultiplierWidth, $DiceButtonHeight) $DiceButtonD20= GUICtrlCreateButton("d20", $DiceGroupSide+$Dice1stColumnOffset+($DiceColumnSpacing*1)+$DiceButtonMultiplierWidth-1, $DiceGroupTop+$Dice1stRowOffset+($DiceRowSpacing*2), $DicePipButtonWidth, $DiceButtonHeight) $SpecialButtonXD100= GUICtrlCreatebutton("x", $DiceGroupSide+$Dice1stColumnOffset+($DiceColumnSpacing*2), $DiceGroupTop+$Dice1stRowOffset+($DiceRowSpacing*2), $DiceButtonMultiplierWidth, $DiceButtonHeight) $DiceButtonD100= GUICtrlCreateButton("d100", $DiceGroupSide+$Dice1stColumnOffset+($DiceColumnSpacing*2)+$DiceButtonMultiplierWidth-1, $DiceGroupTop+$Dice1stRowOffset+($DiceRowSpacing*2), $DicePipButtonWidth, $DiceButtonHeight) ;4th Row $SpecialButtonXDY= GUICtrlCreatebutton("x", $DiceGroupSide+$Dice1stColumnOffset+($DiceColumnSpacing*.5), $DiceGroupTop+$Dice1stRowOffset+($DiceRowSpacing*3), $DiceButtonMultiplierWidth, $DiceButtonHeight) $SpecialButtonDiePip= GUICtrlCreatebutton("dY", $DiceGroupSide+$Dice1stColumnOffset+($DiceColumnSpacing*.5)+$DiceButtonMultiplierWidth-1, $DiceGroupTop+$Dice1stRowOffset+($DiceRowSpacing*3), $DicePipButtonWidth, $DiceButtonHeight) $DiceSetPip= GUICtrlCreatebutton("Set Pip", $DiceGroupSide+$Dice1stColumnOffset+($DiceColumnSpacing*.5)+$DiceButtonMultiplierWidth+$DicePipButtonWidth-2, $DiceGroupTop+$Dice1stRowOffset+($DiceRowSpacing*3), $DiceSetPipWidth, $DiceButtonHeight) $ProbGroupSide= 168 $ProbGroupTop= 45 $ProbGroupWidth= 144 $ProbGroupHeight= 116 $Prob1stColumnOffset= 3 $ProbColumnSpacing= 73 $Prob1stRowOffset= 17 $ProbRowSpacing= 25 $ProbButtonWidth= 65 $ProbButtonHeight= 20 $ProbLabel= GUICtrlCreateGroup("Probabilities", $ProbGroupSide, $ProbGroupTop, $ProbGroupWidth, $ProbGroupHeight, $BS_CENTER) GUICtrlSetFont($ProbLabel, 9, 400, 4) ;1st Row $ProbabilityWeak= GUICtrlCreateButton("Weak", $ProbGroupSide+$Prob1stColumnOffset, $ProbGroupTop+$Prob1stRowOffset, $ProbButtonWidth, $ProbButtonHeight) $ProbabilityLow= GUICtrlCreateButton("Low", $ProbGroupSide+$Prob1stColumnOffset+($ProbColumnSpacing*1), $ProbGroupTop+$Prob1stRowOffset, $ProbButtonWidth, $ProbButtonHeight) ;2nd Row $ProbabilityBelowAvg= GUICtrlCreateButton("Below Av.", $ProbGroupSide+$Prob1stColumnOffset, $ProbGroupTop+$Prob1stRowOffset+($ProbRowSpacing*1), $ProbButtonWidth, $ProbButtonHeight) $ProbabilityAvg= GUICtrlCreateButton("Average", $ProbGroupSide+$Prob1stColumnOffset+($ProbColumnSpacing*1), $ProbGroupTop+$Prob1stRowOffset+($ProbRowSpacing*1), $ProbButtonWidth, $ProbButtonHeight) ;3rd Row $ProbabilityAboveAvg= GUICtrlCreateButton("Above Av.", $ProbGroupSide+$Prob1stColumnOffset, $ProbGroupTop+$Prob1stRowOffset+($ProbRowSpacing*2), $ProbButtonWidth, $ProbButtonHeight) $ProbabilityHigh= GUICtrlCreateButton("High", $ProbGroupSide+$Prob1stColumnOffset+($ProbColumnSpacing*1), $ProbGroupTop+$Prob1stRowOffset+($ProbRowSpacing*2), $ProbButtonWidth, $ProbButtonHeight) ;4th Row $ProbabilityExcep= GUICtrlCreateButton("Exceptional", $ProbGroupSide+$Prob1stColumnOffset+($ProbColumnSpacing*.5), $ProbGroupTop+$Prob1stRowOffset+($ProbRowSpacing*3), $ProbButtonWidth, $ProbButtonHeight) $CardGroupSide= 315 $CardGroupTop= 45 $CardGroupWidth= 250 $CardGroupHeight= 143 $CardDeck1stColumnOffset= 4 $CardDeckColumnSpacing= 123 $CardDeck1stRowOffset= 17 $CardDeckWidth= 119 $CardFullDeckHeight= 37 $CardDeckRowSpacing= $CardFullDeckHeight + 2 $CardButtonColumnOffset= 3 $CardButton1stRowOffset= 13 $CardDeck1ButtonSpacing= 22 $CardDeck2ButtonSpacing= 31 $CardDeck2Height= 98 $CardButtonWidth= 113 $CardButtonHeight= 20 $ExampleDeckTop= $CardGroupTop+$CardDeck1stRowOffset+$CardDeck2Height+2 $CardGroup= GUICtrlCreateGroup("Cards", $CardGroupSide, $CardGroupTop, $CardGroupWidth, $CardGroupHeight, $BS_CENTER) GUICtrlSetFont($CardGroup, 9, 400, 4) GUICtrlCreateGroup("An Always Full Deck", $CardGroupSide+$CardDeck1stColumnOffset, $CardGroupTop+$CardDeck1stRowOffset, $CardDeckWidth,$CardFullDeckHeight) $DrawRandomCard= GUICtrlCreatebutton("Draw a Random Card", $CardGroupSide+$CardDeck1stColumnOffset+$CardButtonColumnOffset, $CardGroupTop+$CardDeck1stRowOffset+$CardButton1stRowOffset, $CardButtonWidth, $CardButtonHeight) GUICtrlCreateGroup("Deck 1", $CardGroupSide+$CardDeck1stColumnOffset, $CardGroupTop+$CardDeck1stRowOffset+$CardDeckRowSpacing, $CardDeckWidth,59) $DrawFromDeck1= GUICtrlCreatebutton("Draw a Card", $CardGroupSide+$CardDeck1stColumnOffset+$CardButtonColumnOffset, $CardGroupTop+$CardDeck1stRowOffset+$CardButton1stRowOffset+$CardDeckRowSpacing, $CardButtonWidth, $CardButtonHeight) $ReshuffleDeck1= GUICtrlCreateButton("Reshuffle Deck", $CardGroupSide+$CardDeck1stColumnOffset+$CardButtonColumnOffset, $CardGroupTop+$CardDeck1stRowOffset+$CardButton1stRowOffset+$CardDeckRowSpacing+$CardDeck1ButtonSpacing, $CardButtonWidth, $CardButtonHeight) GUICtrlCreateGroup("Deck 2", $CardGroupSide+$CardDeck1stColumnOffset+$CardDeckColumnSpacing, $CardGroupTop+$CardDeck1stRowOffset, $CardDeckWidth,$CardDeck2Height) $IssueCards= GUICtrlCreateButton("Issue X Cards", $CardGroupSide+$CardDeck1stColumnOffset+$CardButtonColumnOffset+$CardDeckColumnSpacing, $CardGroupTop+$CardDeck1stRowOffset+$CardButton1stRowOffset, $CardButtonWidth, $CardButtonHeight) $DrawFromDeck2= GUICtrlCreatebutton("Draw a Single Card", $CardGroupSide+$CardDeck1stColumnOffset+$CardButtonColumnOffset+$CardDeckColumnSpacing, $CardGroupTop+$CardDeck1stRowOffset+$CardButton1stRowOffset+($CardDeck2ButtonSpacing*1), $CardButtonWidth, $CardButtonHeight) $ReshuffleDeck2= GUICtrlCreateButton("Reshuffle Deck", $CardGroupSide+$CardDeck1stColumnOffset+$CardButtonColumnOffset+$CardDeckColumnSpacing, $CardGroupTop+$CardDeck1stRowOffset+$CardButton1stRowOffset+($CardDeck2ButtonSpacing*2)-1, $CardButtonWidth, $CardButtonHeight) $ShowADeck= GUICtrlCreatebutton("Show Example Deck", $CardGroupSide+$CardDeck1stColumnOffset+($CardDeckColumnSpacing*.5), $ExampleDeckTop, $CardDeckWidth, $CardButtonHeight) $PtsGroupSide= 9 $PtsGroupTop= 163 $PtsGroupWidth= 303 $PtsGroupHeight= 58 $PtsLabelColumnOffset= 11 $PtsLabelColumnSpacing= 63 $PtsLabelRowOffset= 18 $PtsLabelWidth= 30 $PtsLabelHeight= 12 $PtsPoolColumnOffset= 4 $PtsPoolColumnSpacing= 63 $PtsPoolRowOffset= 33 $PoolWidth= 43 $PoolHeight= 20 $PointsGroup= GUICtrlCreateGroup("Points", $PtsGroupSide, $PtsGroupTop, $PtsGroupWidth, $PtsGroupHeight, $BS_CENTER) GUICtrlSetFont($PointsGroup, 9, 400, 4) GUICtrlCreateLabel("Pool 1", $PtsGroupSide+$PtsLabelColumnOffset, $PtsGroupTop+$PtsLabelRowOffset, $PtsLabelWidth, $PtsLabelHeight) $Pool1= GUICtrlCreateInput("1", $PtsGroupSide+$PtsPoolColumnOffset, $PtsGroupTop+$PtsPoolRowOffset, $PoolWidth, $PoolHeight, $ES_NUMBER) GUICtrlCreateUpdown($Pool1) GUICtrlCreateLabel("Pool 2", $PtsGroupSide+$PtsLabelColumnOffset+($PtsLabelColumnSpacing*1), $PtsGroupTop+$PtsLabelRowOffset, $PtsLabelWidth, $PtsLabelHeight) $Pool2= GUICtrlCreateInput("1", $PtsGroupSide+$PtsPoolColumnOffset+($PtsPoolColumnSpacing*1), $PtsGroupTop+$PtsPoolRowOffset, $PoolWidth, $PoolHeight, $ES_NUMBER) GUICtrlCreateUpdown($Pool2) GUICtrlSetResizing($Pool2,$GUI_DOCKSIZE) GUICtrlCreateLabel("Pool 3", $PtsGroupSide+$PtsLabelColumnOffset+($PtsLabelColumnSpacing*2), $PtsGroupTop+$PtsLabelRowOffset, $PtsLabelWidth, $PtsLabelHeight) $Pool3= GUICtrlCreateInput("1", $PtsGroupSide+$PtsPoolColumnOffset+($PtsPoolColumnSpacing*2), $PtsGroupTop+$PtsPoolRowOffset, $PoolWidth, $PoolHeight, $ES_NUMBER) GUICtrlCreateUpdown($Pool3) GUICtrlSetResizing($Pool3,$GUI_DOCKSIZE) GUICtrlCreateLabel("Pool 4", $PtsGroupSide+$PtsLabelColumnOffset+($PtsLabelColumnSpacing*3), $PtsGroupTop+$PtsLabelRowOffset, $PtsLabelWidth, $PtsLabelHeight) $Pool4= GUICtrlCreateInput("1", $PtsGroupSide+$PtsPoolColumnOffset+($PtsPoolColumnSpacing*3), $PtsGroupTop+$PtsPoolRowOffset, $PoolWidth, $PoolHeight, $ES_NUMBER) GUICtrlCreateUpdown($Pool4) GUICtrlSetResizing($Pool4,$GUI_DOCKSIZE) GUICtrlCreateLabel("Pool 5", $PtsGroupSide+$PtsLabelColumnOffset+($PtsLabelColumnSpacing*4), $PtsGroupTop+$PtsLabelRowOffset, $PtsLabelWidth, $PtsLabelHeight) $Pool5= GUICtrlCreateInput("1", $PtsGroupSide+$PtsPoolColumnOffset+($PtsPoolColumnSpacing*4), $PtsGroupTop+$PtsPoolRowOffset, $PoolWidth, $PoolHeight, $ES_NUMBER) GUICtrlCreateUpdown($Pool5) GUICtrlSetResizing($Pool5,$GUI_DOCKSIZE) $DisplayHelp= GUICtrlCreatebutton("Help", 521, 191, 45, 29) GUICtrlCreateLabel("Select a" & @crlf & "Number", 8, 260) $NumberSelected = GUICtrlCreateList("1", 5, 290, 45, 183, $WS_VSCROLL) For $i= 2 to 100 GUICtrlSetData($NumberSelected,$i) Next $GameLabel= GUICtrlCreateLabel("Game:", 10, 231, 45, 20) GUICtrlSetFont($GameLabel,11,600) $GameSelector= GUICtrlCreateCombo("", 57, 229, 239, 20) GUICtrlSetData($GameSelector,"DnD|Fate|Savage Worlds|Savage Worlds- Ravaged Rules", "Fate") $GameAreaDummyStart= GUICtrlCreateDummy() $TabLeftSide= 57 $TabTop= 248 $TabWidth= 239 $TabHeight= 217 $SavageWorldsDummyStart= GUICtrlCreateDummy() $SavageWorlds=GUICtrlCreateGroup ("", $TabLeftSide, $TabTop, $TabWidth, $TabHeight) $MainButtonW=30 $BigButtonW=55 $SmallButtonW=17 $ButtonH=25 $1stCLSide=109 $2ndCLSide= $1stCLSide+101 $MidCLSide= $1stCLSide+38 $TopRow= 285 $1stRTop=$TopRow $2ndRTop=$TopRow+40 $3rdRTop=$TopRow+80 $4thRTop=$TopRow+120 ;First Row $SWButtonUnsk= GUICtrlCreatebutton("Unskilled", $MidCLSide, $1stRTop, $BigButtonW, $ButtonH) $SWButtonUnskx= GUICtrlCreatebutton("x", $MidCLSide-$SmallButtonW, $1stRTop, $SmallButtonW, $ButtonH) $SWButtonUnskw= GUICtrlCreatebutton("w", $MidCLSide+$BigButtonW, $1stRTop, $SmallButtonW, $ButtonH) ;Second Row $SWButtonD4= GUICtrlCreatebutton("d4", $1stCLSide, $2ndRTop, $MainButtonW, $ButtonH) $SWButtonD4x= GUICtrlCreatebutton("x", $1stCLSide-$SmallButtonW, $2ndRTop, $SmallButtonW, $ButtonH) $SWButtonD4w= GUICtrlCreatebutton("w", $1stCLSide+$MainButtonW, $2ndRTop, $SmallButtonW, $ButtonH) $SWButtonD6= GUICtrlCreatebutton("d6", $2ndCLSide, $2ndRTop, $MainButtonW, $ButtonH) $SWButtonD6x= GUICtrlCreatebutton("x", $2ndCLSide-$SmallButtonW, $2ndRTop, $SmallButtonW, $ButtonH) $SWButtonD6w= GUICtrlCreatebutton("w", $2ndCLSide+$MainButtonW, $2ndRTop, $SmallButtonW, $ButtonH) ;Third Row $SWButtonD8= GUICtrlCreatebutton("d8", $1stCLSide, $3rdRTop, $MainButtonW, $ButtonH) $SWButtonD8x= GUICtrlCreatebutton("x", $1stCLSide-$SmallButtonW, $3rdRTop, $SmallButtonW, $ButtonH) $SWButtonD8w= GUICtrlCreatebutton("w", $1stCLSide+$MainButtonW, $3rdRTop, $SmallButtonW, $ButtonH) $SWButtonD10= GUICtrlCreatebutton("d10", $2ndCLSide, $3rdRTop, $MainButtonW, $ButtonH) $SWButtonD10x= GUICtrlCreatebutton("x", $2ndCLSide-$SmallButtonW, $3rdRTop, $SmallButtonW, $ButtonH) $SWButtonD10w= GUICtrlCreatebutton("w", $2ndCLSide+$MainButtonW, $3rdRTop, $SmallButtonW, $ButtonH) ;Forth Row $SWButtonD12= GUICtrlCreatebutton("d12", $1stCLSide, $4thRTop, $MainButtonW, $ButtonH) $SWButtonD12x= GUICtrlCreatebutton("x", $1stCLSide-$SmallButtonW, $4thRTop, $SmallButtonW, $ButtonH) $SWButtonD12w= GUICtrlCreatebutton("w", $1stCLSide+$MainButtonW, $4thRTop, $SmallButtonW, $ButtonH) $SWButtonD20= GUICtrlCreateButton("d20", $2ndCLSide, $4thRTop, $MainButtonW, $ButtonH) $SWButtonD20x= GUICtrlCreateButton("x", $2ndCLSide-$SmallButtonW, $4thRTop, $SmallButtonW, $ButtonH) $SWButtonD20w= GUICtrlCreateButton("w", $2ndCLSide+$MainButtonW, $4thRTop, $SmallButtonW, $ButtonH) $SavageWorldsDummyEnd= GUICtrlCreateDummy() $RavagedRulesDummyStart= GUICtrlCreateDummy() $RavagedRules=GUICtrlCreateGroup ("", $TabLeftSide, $TabTop, $TabWidth, $TabHeight) $MainButtonW=30 $SmallButtonW=17 $ButtonH=20 $1stCLSide=83 $2ndCLSide=161 $3rdCLSide=240 $LSideMod=37 $TopRow=275 $1stRTop=$TopRow $2ndRTop=$TopRow+24 $3rdRTop=$TopRow+49 $4thRTop=$TopRow+73 $5thRTop=$TopRow+98 $6thRTop=$TopRow+122 $7thRTop=$TopRow+147 ;First Row $SWModButtonD1= GUICtrlCreatebutton("d1", $1stCLSide, $1stRTop, $MainButtonW, $ButtonH) $SWModButtonD1x= GUICtrlCreatebutton("x", $1stCLSide-$SmallButtonW, $1stRTop, $SmallButtonW, $ButtonH) $SWModButtonD1W= GUICtrlCreatebutton("w", $1stCLSide+$MainButtonW, $1stRTop, $SmallButtonW, $ButtonH) $SWModButtonD2= GUICtrlCreatebutton("d2", $2ndCLSide, $1stRTop, $MainButtonW, $ButtonH) $SWModButtonD2x= GUICtrlCreatebutton("x", $2ndCLSide-$SmallButtonW, $1stRTop, $SmallButtonW, $ButtonH) $SWModButtonD2W= GUICtrlCreatebutton("w", $2ndCLSide+$MainButtonW, $1stRTop, $SmallButtonW, $ButtonH) $SWModButtonD3= GUICtrlCreatebutton("d3", $3rdCLSide, $1stRTop, $MainButtonW, $ButtonH) $SWModButtonD3x= GUICtrlCreatebutton("x", $3rdCLSide-$SmallButtonW, $1stRTop, $SmallButtonW, $ButtonH) $SWModButtonD3W= GUICtrlCreatebutton("w", $3rdCLSide+$MainButtonW, $1stRTop, $SmallButtonW, $ButtonH) ;Second Row $SWModButtonD4= GUICtrlCreatebutton("d4", $1stCLSide, $2ndRTop, $MainButtonW, $ButtonH) $SWModButtonD4x= GUICtrlCreatebutton("x", $1stCLSide-$SmallButtonW, $2ndRTop, $SmallButtonW, $ButtonH) $SWModButtonD4W= GUICtrlCreatebutton("w", $1stCLSide+$MainButtonW, $2ndRTop, $SmallButtonW, $ButtonH) $SWModButtonD5= GUICtrlCreatebutton("d5", $2ndCLSide, $2ndRTop, $MainButtonW, $ButtonH) $SWModButtonD5x= GUICtrlCreatebutton("x", $2ndCLSide-$SmallButtonW, $2ndRTop, $SmallButtonW, $ButtonH) $SWModButtonD5W= GUICtrlCreatebutton("w", $2ndCLSide+$MainButtonW, $2ndRTop, $SmallButtonW, $ButtonH) $SWModButtonD6= GUICtrlCreatebutton("d6", $3rdCLSide, $2ndRTop, $MainButtonW, $ButtonH) $SWModButtonD6x= GUICtrlCreatebutton("x", $3rdCLSide-$SmallButtonW, $2ndRTop, $SmallButtonW, $ButtonH) $SWModButtonD6W= GUICtrlCreatebutton("w", $3rdCLSide+$MainButtonW, $2ndRTop, $SmallButtonW, $ButtonH) ;Third Row $SWModButtonD7= GUICtrlCreatebutton("d7", $1stCLSide, $3rdRTop, $MainButtonW, $ButtonH) $SWModButtonD7x= GUICtrlCreatebutton("x", $1stCLSide-$SmallButtonW, $3rdRTop, $SmallButtonW, $ButtonH) $SWModButtonD7W= GUICtrlCreatebutton("w", $1stCLSide+$MainButtonW, $3rdRTop, $SmallButtonW, $ButtonH) $SWModButtonD8= GUICtrlCreatebutton("d8", $2ndCLSide, $3rdRTop, $MainButtonW, $ButtonH) $SWModButtonD8x= GUICtrlCreatebutton("x", $2ndCLSide-$SmallButtonW, $3rdRTop, $SmallButtonW, $ButtonH) $SWModButtonD8W= GUICtrlCreatebutton("w", $2ndCLSide+$MainButtonW, $3rdRTop, $SmallButtonW, $ButtonH) $SWModButtonD9= GUICtrlCreatebutton("d9", $3rdCLSide, $3rdRTop, $MainButtonW, $ButtonH) $SWModButtonD9x= GUICtrlCreatebutton("x", $3rdCLSide-$SmallButtonW, $3rdRTop, $SmallButtonW, $ButtonH) $SWModButtonD9W= GUICtrlCreatebutton("w", $3rdCLSide+$MainButtonW, $3rdRTop, $SmallButtonW, $ButtonH) ;Fourth Row $SWModButtonD10= GUICtrlCreatebutton("d10", $1stCLSide, $4thRTop, $MainButtonW, $ButtonH) $SWModButtonD10x= GUICtrlCreatebutton("x", $1stCLSide-$SmallButtonW, $4thRTop, $SmallButtonW, $ButtonH) $SWModButtonD10W= GUICtrlCreatebutton("w", $1stCLSide+$MainButtonW, $4thRTop, $SmallButtonW, $ButtonH) $SWModButtonD11= GUICtrlCreatebutton("d11", $2ndCLSide, $4thRTop, $MainButtonW, $ButtonH) $SWModButtonD11x= GUICtrlCreatebutton("x", $2ndCLSide-$SmallButtonW, $4thRTop, $SmallButtonW, $ButtonH) $SWModButtonD11W= GUICtrlCreatebutton("w", $2ndCLSide+$MainButtonW, $4thRTop, $SmallButtonW, $ButtonH) $SWModButtonD12= GUICtrlCreatebutton("d12", $3rdCLSide, $4thRTop, $MainButtonW, $ButtonH) $SWModButtonD12x= GUICtrlCreatebutton("x", $3rdCLSide-$SmallButtonW, $4thRTop, $SmallButtonW, $ButtonH) $SWModButtonD12W= GUICtrlCreatebutton("w", $3rdCLSide+$MainButtonW, $4thRTop, $SmallButtonW, $ButtonH) ;Fifth Row $SWModButtonD13= GUICtrlCreatebutton("d13", $1stCLSide, $5thRTop, $MainButtonW, $ButtonH) $SWModButtonD13x= GUICtrlCreatebutton("x", $1stCLSide-$SmallButtonW, $5thRTop, $SmallButtonW, $ButtonH) $SWModButtonD13W= GUICtrlCreatebutton("w", $1stCLSide+$MainButtonW, $5thRTop, $SmallButtonW, $ButtonH) $SWModButtonD14= GUICtrlCreatebutton("d14", $2ndCLSide, $5thRTop, $MainButtonW, $ButtonH) $SWModButtonD14x= GUICtrlCreatebutton("x", $2ndCLSide-$SmallButtonW, $5thRTop, $SmallButtonW, $ButtonH) $SWModButtonD14W= GUICtrlCreatebutton("w", $2ndCLSide+$MainButtonW, $5thRTop, $SmallButtonW, $ButtonH) $SWModButtonD15= GUICtrlCreatebutton("d15", $3rdCLSide, $5thRTop, $MainButtonW, $ButtonH) $SWModButtonD15x= GUICtrlCreatebutton("x", $3rdCLSide-$SmallButtonW, $5thRTop, $SmallButtonW, $ButtonH) $SWModButtonD15W= GUICtrlCreatebutton("w", $3rdCLSide+$MainButtonW, $5thRTop, $SmallButtonW, $ButtonH) ;Sixth Row $SWModButtonD16= GUICtrlCreatebutton("d16", $1stCLSide, $6thRTop, $MainButtonW, $ButtonH) $SWModButtonD16x= GUICtrlCreatebutton("x", $1stCLSide-$SmallButtonW, $6thRTop, $SmallButtonW, $ButtonH) $SWModButtonD16W= GUICtrlCreatebutton("w", $1stCLSide+$MainButtonW, $6thRTop, $SmallButtonW, $ButtonH) $SWModButtonD17= GUICtrlCreatebutton("d17", $2ndCLSide, $6thRTop, $MainButtonW, $ButtonH) $SWModButtonD17x= GUICtrlCreatebutton("x", $2ndCLSide-$SmallButtonW, $6thRTop, $SmallButtonW, $ButtonH) $SWModButtonD17W= GUICtrlCreatebutton("w", $2ndCLSide+$MainButtonW, $6thRTop, $SmallButtonW, $ButtonH) $SWModButtonD18= GUICtrlCreatebutton("d18", $3rdCLSide, $6thRTop, $MainButtonW, $ButtonH) $SWModButtonD18x= GUICtrlCreatebutton("x", $3rdCLSide-$SmallButtonW, $6thRTop, $SmallButtonW, $ButtonH) $SWModButtonD18W= GUICtrlCreatebutton("w", $3rdCLSide+$MainButtonW, $6thRTop, $SmallButtonW, $ButtonH) ;Seventh Row $SWModButtonD19= GUICtrlCreatebutton("d19", $1stCLSide+$LSideMod, $7thRTop, $MainButtonW, $ButtonH) $SWModButtonD19x= GUICtrlCreatebutton("x", $1stCLSide+$LSideMod-$SmallButtonW, $7thRTop, $SmallButtonW, $ButtonH) $SWModButtonD19W= GUICtrlCreatebutton("w", $1stCLSide+$LSideMod+$MainButtonW, $7thRTop, $SmallButtonW, $ButtonH) $SWModButtonD20= GUICtrlCreatebutton("d20", $2ndCLSide+$LSideMod, $7thRTop, $MainButtonW, $ButtonH) $SWModButtonD20x= GUICtrlCreatebutton("x", $2ndCLSide+$LSideMod-$SmallButtonW, $7thRTop, $SmallButtonW, $ButtonH) $SWModButtonD20W= GUICtrlCreatebutton("w", $2ndCLSide+$LSideMod+$MainButtonW, $7thRTop, $SmallButtonW, $ButtonH) $RavagedRulesDummyEnd= GUICtrlCreateDummy() $FateDummyStart= GUICtrlCreateDummy() $Fate= GUICtrlCreateGroup ("", $TabLeftSide, $TabTop, $TabWidth, $TabHeight) GUICtrlCreateLabel("+8 Legendary" & @CRLF & "+7 Epic" & @CRLF & "+6 Fantastic" & @CRLF & "+5 Superb" & @CRLF & "+4 Great" & @CRLF & "+3 Good" & @CRLF & "+2 Fair" & @CRLF & "+1 Average" & @CRLF & " 0 Mediocre" & @CRLF & "-1 Poor" & @CRLF & "-2 Terrible",$TabLeftSide+20, $TabTop+25, 100, 175) GUICtrlSetFont(-1,9,400) $LeftSide= 183 $TopOfButton= 334 $FtButton4dF= GUICtrlCreateButton("4dF",$LeftSide,$TopOfButton,40,40) $FtButtonXdF= GUICtrlCreateButton("XdF",$LeftSide+48,$TopOfButton,40,40) $FateDummyEnd= GUICtrlCreateDummy() $DnDDummyStart= GUICtrlCreateDummy() $DnD= GUICtrlCreateGroup ("", $TabLeftSide, $TabTop, $TabWidth, $TabHeight) $DnDAttrib= GUICtrlCreatebutton("DnD Attribute Roll", 120, 335, 120, 25) $DnDDummyEnd= GUICtrlCreateDummy() $GameAreaDummyEnd= GUICtrlCreateDummy() $BaseOutputLeft= 300 $BaseOutputTop= 229 $SortResults= GUICtrlCreateCheckbox("", $BaseOutputLeft+2, $BaseOutputTop+3, 15, 15) GUICtrlCreateLabel("Sort Results", $BaseOutputLeft+19, $BaseOutputTop+4) $ClearButton= GUICtrlCreateButton("Clear Results", $BaseOutputLeft+194, $BaseOutputTop,75,20) $OutputWindow = GUICtrlCreateEdit("", $BaseOutputLeft, $BaseOutputTop+25, 269, 210) $ControlAreaDummyEnd = GUICtrlCreateDummy() For $q = $GameAreaDummyStart To $GameAreaDummyEnd GUICtrlSetState($q, $GUI_DISABLE + $GUI_HIDE) Next For $q = $FateDummyStart To $FateDummyEnd GUICtrlSetState($q, $GUI_ENABLE + $GUI_SHOW) Next GuiSetState () For $q = $ControlAreaDummyStart To $ControlAreaDummyEnd GUICtrlSetResizing($q, $GUI_DOCKALL) Next ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $RollDownWindow ; 574, 469, GUICtrlSetState($RollUpWindow,$GUI_ENABLE + $GUI_SHOW) GUICtrlSetState($RollDownWindow,$GUI_DISABLE + $GUI_HIDE) $WinSizeArray= WinGetPos($GUIHandle) WinMove($GUIHandle,"",$WinSizeArray[0],$WinSizeArray[1],$WinSizeArray[2]+325,$WinSizeArray[3]+439) Case $msg = $RollUpWindow GUICtrlSetState($RollDownWindow,$GUI_ENABLE + $GUI_SHOW) GUICtrlSetState($RollUpWindow,$GUI_DISABLE + $GUI_HIDE) $WinSizeArray= WinGetPos($GUIHandle) WinMove($GUIHandle,"",$WinSizeArray[0],$WinSizeArray[1],$WinSizeArray[2]-325,$WinSizeArray[3]-439) Case $msg = $KeepOnTop If GUICtrlRead($KeepOnTop) = 1 Then WinSetOnTop($GUIHandle,"",1) Else WinSetOnTop($GUIHandle,"",0) EndIf Case $msg = $GameSelector Select Case GUICtrlRead($GameSelector) = "Savage Worlds" SwitchGames($SavageWorldsDummyStart,$SavageWorldsDummyEnd) Case GUICtrlRead($GameSelector) = "Savage Worlds- Ravaged Rules" SwitchGames($RavagedRulesDummyStart,$RavagedRulesDummyEnd) Case GUICtrlRead($GameSelector) = "Fate" SwitchGames($FateDummyStart,$FateDummyEnd) Case GUICtrlRead($GameSelector) = "DnD" SwitchGames($DnDDummyStart,$DnDDummyEnd) EndSelect Case $msg = $ClearButton GUICtrlSetData($OutputWindow,"") Case $msg = $ProbabilityWeak ProbabilityTable(3,15,84) Case $msg = $ProbabilityLow ProbabilityTable(5,25,86) Case $msg = $ProbabilityBelowAvg ProbabilityTable(7,35,88) Case $msg = $ProbabilityAvg ProbabilityTable(10,50,91) Case $msg = $ProbabilityAboveAvg ProbabilityTable(13,65,94) Case $msg = $ProbabilityHigh ProbabilityTable(15,75,96) Case $msg = $ProbabilityExcep ProbabilityTable(16,85,97) Case $msg = $SpecialButtonXD2 multidie(2) Case $msg = $DiceButtonD2 easydie(2) Case $msg = $SpecialButtonXD3 multidie(3) Case $msg = $DiceButtonD3 easydie(3) Case $msg = $SpecialButtonXD4 multidie(4) Case $msg = $DiceButtonD4 easydie(4) Case $msg = $SpecialButtonXD6 multidie(6) Case $msg = $DiceButtonD6 easydie(6) Case $msg = $SpecialButtonXD8 multidie(8) Case $msg = $DiceButtonD8 easydie(8) Case $msg = $SpecialButtonXD10 multidie(10) Case $msg = $DiceButtonD10 easydie(10) Case $msg = $SpecialButtonXD12 multidie(12) Case $msg = $DiceButtonD12 easydie(12) Case $msg = $SpecialButtonXD20 multidie(20) Case $msg = $DiceButtonD20 easydie(20) Case $msg = $SpecialButtonXD100 multidie(100) Case $msg = $DiceButtonD100 easydie(100) Case $msg = $SpecialButtonXDY $x = GUICtrlRead($SpecialButtonDiePip) $Pip = StringTrimLeft($x,1) if $x = "dY" then GUICtrlSetData($OutputWindow, "You have to choose a die-type and press the right button" & @CRLF & GuiCtrlRead($OutputWindow)) else multidie($Pip) endif Case $msg = $SpecialButtonDiePip $x = GUICtrlRead($SpecialButtonDiePip) $Pip = StringTrimLeft($x,1) if $x = "dY" then GUICtrlSetData($OutputWindow, "You have to choose a die-type and press the right button" & @CRLF & GuiCtrlRead($OutputWindow)) else easydie($Pip) endif Case $msg = $DiceSetPip GUICtrlSetData ($SpecialButtonDiePip, "d" & GUICtrlRead($NumberSelected)) Case $msg = $FtButton4dF FateDie() Case $msg = $FtButtonXdF FateMultiDie(GUICtrlRead($NumberSelected)) Case $msg = $DisplayHelp GUICtrlSetData($OutputWindow,"Help file not written yet, sorry." & @CRLF & GuiCtrlRead($OutputWindow)) Case $msg = $DnDAttrib DnDAttributes() Case $msg = $DrawRandomCard DrawRandomCard() Case $msg = $DrawFromDeck1 DrawFromDeck1() Case $msg = $ReshuffleDeck1 InitializeCardDeck1() GUICtrlSetData($OutputWindow,"Shuffled deck 1" & @CRLF & GuiCtrlRead($OutputWindow)) Case $msg = $IssueCards IssueCards(GUICtrlRead($NumberSelected)) ;Read the number selection to get the number of players to issue cards to. Case $msg = $DrawFromDeck2 DrawFromDeck2() Case $msg = $ReshuffleDeck2 InitializeCardDeck2() GUICtrlSetData($OutputWindow,"Shuffled deck 2" & @CRLF & GuiCtrlRead($OutputWindow)) Case $msg = $ShowADeck _ArrayDisplay($FullDeck,"Card Deck") Case $msg = $SWButtonUnsk savagedie("unskilled") Case $msg = $SWButtonUnskx ;x dices savagemultidie("unskilled") Case $msg = $SWButtonUnskw ;Wild Die savagewilddie("unskilled") Case $msg = $SWButtonD4 savagedie(4) Case $msg = $SWButtonD4x ;x dices savagemultidie(4) Case $msg = $SWButtonD4w ;Wild Die savagewilddie(4) Case $msg = $SWButtonD6 savagedie(6) Case $msg = $SWButtonD6x ;x dices savagemultidie(6) Case $msg = $SWButtonD6w ;Wild Die savagewilddie(6) Case $msg = $SWButtonD8 savagedie(8) Case $msg = $SWButtonD8x ;x dices savagemultidie(8) Case $msg = $SWButtonD8w ;Wild Die savagewilddie(8) Case $msg = $SWButtonD10 savagedie(10) Case $msg = $SWButtonD10x ;x dices savagemultidie(10) Case $msg = $SWButtonD10w ;Wild Die savagewilddie(10) Case $msg = $SWButtonD12 savagedie(12) Case $msg = $SWButtonD12x ;x dices savagemultidie(12) Case $msg = $SWButtonD12w ;Wild Die savagewilddie(12) Case $msg = $SWButtonD20 savagedie(20) Case $msg = $SWButtonD20x ;x dices savagemultidie(20) Case $msg = $SWButtonD20w ;Wild Die savagewilddie(20) Case $msg = $SWModButtonD1 savagedie(1) Case $msg = $SWModButtonD1x ;x dices savagemultidie(1) Case $msg = $SWModButtonD1W ;Wild Die savagewilddie(1) Case $msg = $SWModButtonD2 savagedie(2) Case $msg = $SWModButtonD2x ;x dices savagemultidie(2) Case $msg = $SWModButtonD2W ;Wild Die savagewilddie(2) Case $msg = $SWModButtonD3 savagedie(3) Case $msg = $SWModButtonD3x ;x dices savagemultidie(3) Case $msg = $SWModButtonD3W ;Wild Die savagewilddie(3) Case $msg = $SWModButtonD4 savagedie(4) Case $msg = $SWModButtonD4x ;x dices savagemultidie(4) Case $msg = $SWModButtonD4W ;Wild Die savagewilddie(4) Case $msg = $SWModButtonD5 savagedie(5) Case $msg = $SWModButtonD5x ;x dices savagemultidie(5) Case $msg = $SWModButtonD5W ;Wild Die savagewilddie(5) Case $msg = $SWModButtonD6 savagedie(6) Case $msg = $SWModButtonD6x ;x dices savagemultidie(6) Case $msg = $SWModButtonD6W ;Wild Die savagewilddie(6) Case $msg = $SWModButtonD7 savagedie(7) Case $msg = $SWModButtonD7x ;x dices savagemultidie(7) Case $msg = $SWModButtonD7W ;Wild Die savagewilddie(7) Case $msg = $SWModButtonD8 savagedie(8) Case $msg = $SWModButtonD8x ;x dices savagemultidie(8) Case $msg = $SWModButtonD8W ;Wild Die savagewilddie(8) Case $msg = $SWModButtonD9 savagedie(9) Case $msg = $SWModButtonD9x ;x dices savagemultidie(9) Case $msg = $SWModButtonD9W ;Wild Die savagewilddie(9) Case $msg = $SWModButtonD10 savagedie(10) Case $msg = $SWModButtonD10x ;x dices savagemultidie(10) Case $msg = $SWModButtonD10W ;Wild Die savagewilddie(10) Case $msg = $SWModButtonD11 savagedie(11) Case $msg = $SWModButtonD11x ;x dices savagemultidie(11) Case $msg = $SWModButtonD11W ;Wild Die savagewilddie(11) Case $msg = $SWModButtonD12 savagedie(12) Case $msg = $SWModButtonD12x ;x dices savagemultidie(12) Case $msg = $SWModButtonD12W ;Wild Die savagewilddie(12) Case $msg = $SWModButtonD13 savagedie(13) Case $msg = $SWModButtonD13x ;x dices savagemultidie(13) Case $msg = $SWModButtonD13W ;Wild Die savagewilddie(13) Case $msg = $SWModButtonD14 savagedie(14) Case $msg = $SWModButtonD14x ;x dices savagemultidie(14) Case $msg = $SWModButtonD14W ;Wild Die savagewilddie(14) Case $msg = $SWModButtonD15 savagedie(15) Case $msg = $SWModButtonD15x ;x dices savagemultidie(15) Case $msg = $SWModButtonD15W ;Wild Die savagewilddie(15) Case $msg = $SWModButtonD16 savagedie(16) Case $msg = $SWModButtonD16x ;x dices savagemultidie(16) Case $msg = $SWModButtonD16W ;Wild Die savagewilddie(16) Case $msg = $SWModButtonD17 savagedie(17) Case $msg = $SWModButtonD17x ;x dices savagemultidie(17) Case $msg = $SWModButtonD17W ;Wild Die savagewilddie(17) Case $msg = $SWModButtonD18 savagedie(18) Case $msg = $SWModButtonD18x ;x dices savagemultidie(18) Case $msg = $SWModButtonD18W ;Wild Die savagewilddie(18) Case $msg = $SWModButtonD19 savagedie(19) Case $msg = $SWModButtonD19x ;x dices savagemultidie(19) Case $msg = $SWModButtonD19W ;Wild Die savagewilddie(19) Case $msg = $SWModButtonD20 savagedie(20) Case $msg = $SWModButtonD20x ;x dices savagemultidie(20) Case $msg = $SWModButtonD20W ;Wild Die savagewilddie(20) EndSelect If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend ;~ --------------------------------------------------------------------------------------------------------------- ;~ --------------------------------------- End of Main Script ---------------------------------------------------- ;~ --------------------------------------------------------------------------------------------------------------- Func SwitchGames($StartID,$EndID) Select Case GUICtrlGetState($SavageWorlds) < $GUI_DISABLE $DisableAreaStart= $SavageWorldsDummyStart $DisableAreaEnd= $SavageWorldsDummyEnd Case GUICtrlGetState($RavagedRules) < $GUI_DISABLE $DisableAreaStart= $RavagedRulesDummyStart $DisableAreaEnd= $RavagedRulesDummyEnd Case GUICtrlGetState($Fate) < $GUI_DISABLE $DisableAreaStart= $FateDummyStart $DisableAreaEnd= $FateDummyEnd Case GUICtrlGetState($DnD) < $GUI_DISABLE $DisableAreaStart= $DnDDummyStart $DisableAreaEnd= $DnDDummyEnd EndSelect For $q = $DisableAreaStart To $DisableAreaEnd GUICtrlSetState($q, $GUI_DISABLE + $GUI_HIDE) Next For $q = $StartID To $EndID GUICtrlSetState($q, $GUI_ENABLE + $GUI_SHOW) Next EndFunc Func FateDie() dim $avResults[4] ;Stores the "+", "-", and "0" die results dim $total ;Stores the final total Dim $Roll ;Stores the individual die roll (either -1, 0, or 1) Dim $Mod ;Stores either "+", "-", or "0" depending on the value of the total $total = 0 For $i = 0 To 3 $Roll= Random(-1,1,1) $total= $total + $Roll If $Roll < 0 Then $avResults[$i] = "-" ElseIf $Roll > 0 Then $avResults[$i] = "+" Else $avResults[$i] = "0" EndIf Next If $total < 0 Then $Mod = "-" ElseIf $total > 0 Then $Mod = "+" Else $Mod = "" EndIf If GUICtrlRead($SortResults)=1 then _ArraySort( $avResults,1) ;Sorts array, 1= descending GUICtrlSetData($OutputWindow, $avResults[0] & ", " & $avResults[1] & ", " & $avResults[2] & ", " & $avResults[3] & " (Result: " & $Mod & Abs($total) & " | 4dF)" & @CRLF & GuiCtrlRead($OutputWindow)) EndFunc Func FateMultiDie($NumberOfDice) dim $avResults[$NumberOfDice] ;Stores the "+", "-", and "0" die results dim $total ;Stores the final total Dim $Roll ;Stores the individual die roll (either -1, 0, or 1) Dim $Mod ;Stores either "+", "-", or "0" depending on the value of the total Dim $ResultString ;Stores the results $total = 0 For $i = 0 To $NumberOfDice - 1 $Roll= Random(-1,1,1) $total= $total + $Roll If $Roll < 0 Then $avResults[$i] = "-" ElseIf $Roll > 0 Then $avResults[$i] = "+" Else $avResults[$i] = "0" EndIf Next If $total < 0 Then $Mod = "-" ElseIf $total > 0 Then $Mod = "+" Else $Mod = "" EndIf If GUICtrlRead($SortResults)=1 then _ArraySort( $avResults,1) ;Sorts array, 1= descending $ResultString = $avResults[0] ;Create the result string For $i = 1 To $NumberOfDice - 1 $ResultString = $ResultString & ", " & $avResults[$i] Next GUICtrlSetData($OutputWindow, $ResultString & " (Result: " & $Mod & Abs($total) & " | " & $NumberOfDice & "dF)" & @CRLF & GuiCtrlRead($OutputWindow)) EndFunc Func easydie($die) ; simple die with output $results = Random(1,$die, 1) GUICtrlSetData($OutputWindow, $results & " (d" &$die &")" & @CRLF & GuiCtrlRead($OutputWindow)) EndFunc Func multidie($die) ; multible dice rolls with output dim $avArray[GUICtrlRead($NumberSelected)+1] ;This seems like the array is being declared with an extra element, don't know why $string1=GUICtrlRead($NumberSelected)&"d"&$die ;the number of dice followed by the number of pips for $i = 1 to GUICtrlRead($NumberSelected) $avArray[$i-1]=Random(1,$die,1) ;$avArray[$i-1] is because the array element numbering starts at 0 Next if GUICtrlRead($SortResults)=1 then _ArraySort( $avArray,1) ;Sorts array, 1= descending $string=$avArray[0] ;Load the first element of the array inro $string $total=int($avArray[0]) ;Load the first element of the array into $total for $i = 1 to (GUICtrlRead($NumberSelected)-1) $string= $string & ", " & $avArray[$i] ;Read the array values into a variable seperated by a comma and a space $total=$total+int($avArray[$i]) ;Add the values in the array together Next GUICtrlSetData($OutputWindow, $string & " (" & "Total: " & $total & " | " &$string1 & ")" & @CRLF & GuiCtrlRead($OutputWindow)) EndFunc Func DnDAttributes() ; D&D 3 Attribute roller (4d6 keep highest 3) dim $avArray[4] dim $total[6] for $j = 0 to 5 ;Generate 6 different numbers for $i = 0 to 3 ;Track array elements $avArray[$i]=Random(1,6,1) ;Generate random values to store in the array. next _ArraySort( $avArray,1) ;Sort the array, descneding $total[$j]=$avArray[0]+$avArray[1]+$avArray[2] ;add the first three (highest) values of the sorted array into the result array next _ArraySort($total,1) ;Sort the six results, descending GUICtrlSetData($OutputWindow, "D&D Attributes: " & $total[0] & ", " & $total[1] & ", " & $total[2] & ", " & $total[3] & ", " & $total[4] & ", " & $total[5] & @CRLF & GuiCtrlRead($OutputWindow)) endfunc Func savagedie($diex) ; roll again on max, unskilled d4-2 if $diex="unskilled" then ;If the button (die) = unskilled, then set the die to 4 and subtract 2 from the results. $die=4 $results=-2 $string1="unskilled" elseif $diex=1 then ;If a 1 is passed, use the formula d2-1 provided in the SW Attribute+ Skill doc to resolve the roll $die=2 $results=-1 $string1="d"&$diex else ;if $diex is 2 or more, the die = the value of the button and the results are not modified. $die=$diex $results=0 $string1="d"&$diex endif Do ;Generate die numbers until the number generated is less than the maximum number of pips on the die. Add the numbers to get the final results $x=Random(1,$die,1) $results=$results+$x until $x<$die GUICtrlSetData($OutputWindow, $results & " (" & $string1 & ")" & @CRLF & GuiCtrlRead($OutputWindow)) EndFunc Func savagemultidie($diex) ;Same as savagedie but multiple dies dim $avArray[GUICtrlRead($NumberSelected)+1] if $diex="unskilled" then $die=4 $string1="unskilled" elseif $diex=1 Then $die=2 $string1=GUICtrlRead($NumberSelected)&"d"&$diex else $die=$diex $string1=GUICtrlRead($NumberSelected)&"d"&$diex endif for $i = 1 to GUICtrlRead($NumberSelected) if $diex="unskilled" then $avArray[$i-1]=-2 elseif $diex=1 then $avArray[$i-1]=-1 else $avArray[$i-1]=0 endif Do $x=Random(1,$die,1) $avArray[$i-1]=$avArray[$i-1]+$x ;add the numbers to the $avArray variable at element $i-1 until $x<$die Next if GUICtrlRead($SortResults)=1 then _ArraySort( $avArray,1) $string=$avArray[0] $total=int($avArray[0]) for $i = 1 to (GUICtrlRead($NumberSelected)-1) $string= $string & ", " & $avArray[$i] $total=$total+int($avArray[$i]) Next GUICtrlSetData($OutputWindow, $string & " (" & "Total: " & $total & " | " &$string1 & ")" & @CRLF & GuiCtrlRead($OutputWindow)) Endfunc Func savagewilddie($diex) ; same as savagedie but roll also an additional d6 (wild die) -> higher roll counts if $diex="unskilled" then $die=4 $results1=-2 $results2=-2 $string1="unskilled" elseif $diex=1 then $die=2 $results1=-1 $results2=-1 $string1="d"&$diex else $die=$diex $results1=0 $results2=0 $string1="d"&$diex endif Do $x=Random(1,$die,1) $results1=$results1+$x until $x<$die Do $x=Random(1,6,1) $results2=$results2+$x until $x<6 if $results1 >= $results2 then $string = $results1 & ", " & $results2 & "w (" & $string1 & ")" else $string = $results2 & "w, " & $results1 & " (" & $string1 & ")" endif GUICtrlSetData($OutputWindow, $string & @CRLF & GuiCtrlRead($OutputWindow)) endfunc Func InitializeFullDeck() ;Create an array containing a full deck of cards, the placeholder is just window dressing in this deck $FullDeck = _ArrayCreate("Ace of Spades", "Ace of Diamonds", "Ace of Hearts", "Ace of Clubs") For $i=2 To 13 Switch $i Case 2 To 10 $CardValue= $i Case 11 $CardValue= "Jack" Case 12 $CardValue= "Queen" Case 13 $CardValue= "King" EndSwitch _ArrayAdd( $FullDeck,$CardValue&" of Spades") _ArrayAdd( $FullDeck,$CardValue&" of Diamonds") _ArrayAdd( $FullDeck,$CardValue&" of Hearts") _ArrayAdd( $FullDeck,$CardValue&" of Clubs") Next _ArrayAdd($FullDeck,"Little Joker") _ArrayAdd($FullDeck,"Big Joker") _ArrayAdd($FullDeck,"Placeholder") EndFunc Func InitializeCardDeck1() ;create a deck of cards, the placeholder is so that there is still an element in the array when all the rest of the cards have been chosen. $CardDeck1 = _ArrayCreate("Ace of Spades", "Ace of Diamonds", "Ace of Hearts", "Ace of Clubs") For $i=2 To 13 Switch $i Case 2 To 10 $CardValue= $i Case 11 $CardValue= "Jack" Case 12 $CardValue= "Queen" Case 13 $CardValue= "King" EndSwitch _ArrayAdd( $CardDeck1,$CardValue&" of Spades") _ArrayAdd( $CardDeck1,$CardValue&" of Diamonds") _ArrayAdd( $CardDeck1,$CardValue&" of Hearts") _ArrayAdd( $CardDeck1,$CardValue&" of Clubs") Next _ArrayAdd($CardDeck1,"Little Joker") _ArrayAdd($CardDeck1,"Big Joker") _ArrayAdd($CardDeck1,"Placeholder") EndFunc Func InitializeCardDeck2() ;Same as Deck 1 $CardDeck2 = _ArrayCreate("Ace of Spades", "Ace of Diamonds", "Ace of Hearts", "Ace of Clubs") For $i=2 To 13 Switch $i Case 2 To 10 $CardValue= $i Case 11 $CardValue= "Jack" Case 12 $CardValue= "Queen" Case 13 $CardValue= "King" EndSwitch _ArrayAdd( $CardDeck2,$CardValue&" of Spades") _ArrayAdd( $CardDeck2,$CardValue&" of Diamonds") _ArrayAdd( $CardDeck2,$CardValue&" of Hearts") _ArrayAdd( $CardDeck2,$CardValue&" of Clubs") Next _ArrayAdd($CardDeck2,"Little Joker") _ArrayAdd($CardDeck2,"Big Joker") _ArrayAdd($CardDeck2,"Placeholder") EndFunc Func DrawRandomCard() $i=Random(0,53) $CardDrawn=$FullDeck[$i] GUICtrlSetData($OutputWindow, $CardDrawn & @CRLF & GuiCtrlRead($OutputWindow)) EndFunc Func DrawFromDeck1() $NumberOfCardsLeft=UBound($CardDeck1)-1 ;Subtract 1 for the placeholder $i=Random(0, $NumberOfCardsLeft) $CardDrawn=$CardDeck1[$i] _ArrayDelete($CardDeck1,$i) GUICtrlSetData($OutputWindow, $CardDrawn & @CRLF & GuiCtrlRead($OutputWindow)) If UBound($CardDeck1)=1 Then InitializeCardDeck1() GUICtrlSetData($OutputWindow, "Out of Cards. Deck 1 reshuffled." & @CRLF & GuiCtrlRead($OutputWindow)) EndIf EndFunc Func IssueCards($NumberOfPlayers) Dim $CardsPicked[$NumberOfPlayers] ;Create an array to hold the cards picked $NumberOfCardsLeft=UBound($CardDeck2)-1 ;Subtract 1 for the placeholder If $NumberOfPlayers > 54 Then GUICtrlSetData($OutputWindow, $NumberOfPlayers & "?! Thats more players then cards in the deck. Please choose a smaller number." & @CRLF & GuiCtrlRead($OutputWindow)) Return ElseIf $NumberOfPlayers > $NumberOfCardsLeft Then InitializeCardDeck2() GUICtrlSetData($OutputWindow, "- - - - - -" & @CRLF & GuiCtrlRead($OutputWindow)) GUICtrlSetData($OutputWindow, "More players than cards remaining. Deck 2 reshuffled." & @CRLF & GuiCtrlRead($OutputWindow)) EndIf GUICtrlSetData($OutputWindow, "-----------" & @CRLF & GuiCtrlRead($OutputWindow)) For $i = 0 To $NumberOfPlayers-1 ;Load the card array. $j=Random(0, $NumberOfCardsLeft) $CardDrawn=$CardDeck2[$j] _ArrayDelete($CardDeck2,$j) $CardsPicked[$i]=$CardDrawn $NumberOfCardsLeft=UBound($CardDeck2)-1 ;Reset the number of cards left in the deck. Subtract 1 for the placeholder Next For $i = $NumberOfPlayers-1 To 0 Step -1 GUICtrlSetData($OutputWindow, "Player " & $i+1 & ": " & $CardsPicked[$i] & @CRLF & GuiCtrlRead($OutputWindow)) Next If UBound($CardDeck2)=1 Then InitializeCardDeck2() GUICtrlSetData($OutputWindow, "Out of Cards. Deck 2 reshuffled." & @CRLF & GuiCtrlRead($OutputWindow)) EndIf EndFunc Func DrawFromDeck2() $NumberOfCardsLeft=UBound($CardDeck2)-1 ;Subtract 1 for the placeholder $i=Random(0, $NumberOfCardsLeft) $CardDrawn=$CardDeck2[$i] _ArrayDelete($CardDeck2,$i) GUICtrlSetData($OutputWindow, $CardDrawn & @CRLF & GuiCtrlRead($OutputWindow)) If UBound($CardDeck2)=1 Then InitializeCardDeck2() GUICtrlSetData($OutputWindow, "Out of Cards. Deck 2 reshuffled." & @CRLF & GuiCtrlRead($OutputWindow)) EndIf EndFunc Func ProbabilityTable($1,$2,$3) ; choose how probale a question is and it will thell you Yes++/Yes/No/No-- -> more explaination in the Mythic RPG $results = Random(1,100, 1) Select Case $results <= $1 GUICtrlSetData($OutputWindow, "Yes maximum" & @CRLF & GuiCtrlRead($OutputWindow)) Case $results <= $2 GUICtrlSetData($OutputWindow, "Yes" & @CRLF & GuiCtrlRead($OutputWindow)) Case $results < $3 GUICtrlSetData($OutputWindow, "No" & @CRLF & GuiCtrlRead($OutputWindow)) Case Else GUICtrlSetData($OutputWindow, "No maximum" & @CRLF & GuiCtrlRead($OutputWindow)) EndSelect EndFunc Link to comment Share on other sites More sharing options...
Zealot Posted November 13, 2007 Author Share Posted November 13, 2007 Bump Link to comment Share on other sites More sharing options...
Danny35d Posted November 13, 2007 Share Posted November 13, 2007 This part of your code is not working the way you want to. I don't even know if that will be the right way to do it.For $q = $ControlAreaDummyStart To $ControlAreaDummyEnd GUICtrlSetResizing($q, $GUI_DOCKALL) NextYou will have to add GUICtrlSetResizing(-1, $GUI_DOCKALL) to all the GUI cotrol.Try it:expandcollapse popup#include <GUIConstants.au3> #include <Array.au3> $GUIHandle = GUICreate("Example", 120, 100, -1, -1) $ControlAreaDummyStart = GUICtrlCreateDummy() ;<-- Added this here for start of controls GUICtrlSetResizing(-1, $GUI_DOCKALL) $RollUpWindow = GUICtrlCreateButton("Roll Up Window", 5, 5, 105, 20) GUICtrlSetResizing(-1, $GUI_DOCKALL) $RollDownWindow = GUICtrlCreateButton("Roll Down Window", 5, 5, 105, 20) ;~ Hide and disable the Roll Down button GUICtrlSetState($RollDownWindow, $GUI_DISABLE + $GUI_HIDE) GUICtrlSetResizing(-1, $GUI_DOCKALL) $Pool1 = GUICtrlCreateInput("1", 5, 40, 43, 20, $ES_NUMBER) GUICtrlSetResizing(-1, $GUI_DOCKALL) $Pool2 = GUICtrlCreateInput("1", 5, 70, 43, 20, $ES_NUMBER) $Pool3 = GUICtrlCreateUpdown($Pool2) GUICtrlSetResizing(-1, $GUI_DOCKALL) $ControlAreaDummyEnd = GUICtrlCreateDummy() GUICtrlSetResizing(-1, $GUI_DOCKALL) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $RollDownWindow ; 574, 469, GUICtrlSetState($RollUpWindow, $GUI_ENABLE + $GUI_SHOW) GUICtrlSetState($RollDownWindow, $GUI_DISABLE + $GUI_HIDE) GUICtrlSetState($Pool2, $GUI_ENABLE + $GUI_SHOW) GUICtrlSetState($Pool3, $GUI_ENABLE + $GUI_SHOW) $WinSizeArray = WinGetPos($GUIHandle) WinMove($GUIHandle, "", $WinSizeArray[0], $WinSizeArray[1], $WinSizeArray[2] + 5, $WinSizeArray[3] + 70) Case $msg = $RollUpWindow GUICtrlSetState($RollDownWindow, $GUI_ENABLE + $GUI_SHOW) GUICtrlSetState($RollUpWindow, $GUI_DISABLE + $GUI_HIDE) GUICtrlSetState($Pool2, $GUI_DISABLE + $GUI_HIDE) GUICtrlSetState($Pool3, $GUI_DISABLE + $GUI_HIDE) $WinSizeArray = WinGetPos($GUIHandle) WinMove($GUIHandle, "", $WinSizeArray[0], $WinSizeArray[1], $WinSizeArray[2] - 5, $WinSizeArray[3] - 70) EndSelect If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
smashly Posted November 13, 2007 Share Posted November 13, 2007 (edited) Hi, nothing wrong with the dummy loop works fine for me, just set the dummy resizing loop before GuiSetState()..#include <GUIConstants.au3> Global $State $GUIHandle = GUICreate("Example", 115, 100, -1, -1) $DummyStart = GUICtrlCreateDummy() $RollUpWindow = GUICtrlCreateButton("Roll Up Window", 5, 5, 105, 20) $Pool1 = GUICtrlCreateInput("1", 5, 40, 43, 20, $ES_NUMBER) $Pool2 = GUICtrlCreateInput("1", 5, 70, 43, 20, $ES_NUMBER) $Pool3 = GUICtrlCreateUpdown($Pool2) $DummyEnd = GUICtrlCreateDummy() For $q = $DummyStart To $DummyEnd GUICtrlSetResizing($q, $GUI_DOCKALL) Next GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $RollUpWindow If $State = 0 Then $State = 1 GuiCtrlSetData($RollUpWindow, "Roll Down Window") $WinSizeArray = WinGetPos($GUIHandle) WinMove($GUIHandle, "", $WinSizeArray[0], $WinSizeArray[1], $WinSizeArray[2], 70) Else $State = 0 GuiCtrlSetData($RollUpWindow, "Roll Up Window") $WinSizeArray = WinGetPos($GUIHandle) WinMove($GUIHandle, "", $WinSizeArray[0], $WinSizeArray[1], $WinSizeArray[2], 130) EndIf EndSelect WEnd Cheers Edit: Yep doing You will have to add GUICtrlSetResizing(-1, $GUI_DOCKALL) to all the GUI cotrol. is exactly right but having to do that on an already made script with 100's of controls is a pain.. so the dummy loop method is a quick way around doing the tedious adding of GUICtrlSetResizing(-1, $GUI_DOCKALL) to every control Edited November 13, 2007 by smashly Link to comment Share on other sites More sharing options...
Danny35d Posted November 13, 2007 Share Posted November 13, 2007 (edited) Edit: Yep doing is exactly right but having to do that on an already made script with 100's of controls is a pain.. so the dummy loop method is a quick way around doing the tedious adding of GUICtrlSetResizing(-1, $GUI_DOCKALL) to every control Thanks a lot for the tip. I'm always learning new tricks in this forms. Edited November 13, 2007 by Danny35d AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
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