-
Posts
23 -
Joined
-
Last visited
Everything posted by Silas
-
Create different labels within a For Loop
Silas replied to Silas's topic in AutoIt General Help and Support
Dude this actually works. No for loop is needed now. Thank you all and sorry if I was too unclear. -
Create different labels within a For Loop
Silas replied to Silas's topic in AutoIt General Help and Support
Thanks, there won't be. This sounds good. I will try it when I am home -
Create different labels within a For Loop
Silas replied to Silas's topic in AutoIt General Help and Support
;Ideeën: ; - Bij instellen namen geef mogelijkheid om de kleur te kiezen ; - Payment History ; - Doe een "veel plezier!" popup of zo, en ook zon soort popup in plaats van eens stom msgbox met WE HEBBEN EEN WINNAAR (Doe ook meteen het script versimpelen, zodat de melding komt als $SpelersOver=1 en niet met al die gare if statements ; - De knoppen wisselen slim als er 2 spelers over zijn (if inputGUI - radio1 then guicheck radio 6 and guiuncheck radio5) ; - Voorkom tabben (oorzaak van gaar balkje naast radios) ; - Verander de vensters, in plaats van ze opnieuw creëren bij de home knop ;Bugs: ; - Terugknop wordt niet aangemaakt na back() en dan naar n3 ; - Data wordt moet goed opgeslagen ; - Verbreed 2 spelers hoofdscherm #include <ButtonConstants.au3> ;===========Includers #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <EditConstants.au3> #include <Misc.au3> #include <Constants.au3> #include <WinAPI.au3> Global $MB_Progress, $Startbedrag, $Spelers, $VensterFinished_Start, $VensterFinished_N2, $VensterFinished_N3, $VensterFinished_N4, $Speler1, $Speler2, $Speler3, $Speler4 ;Dit is allemaal nodig om ze te kunnen controlleren of al een keer data is ingevoerd Start() Func Start() ;===========Startscherm (hoeveel spelers er zijn) Global $WBreedte = 306 Global $WHoogte = 165 Global $Window = GUICreate("MonoBank - Start", $WBreedte, $WHoogte, @DesktopWidth / 2 - ($WBreedte / 2), @DesktopHeight / 2 - ($WHoogte / 2), $GUI_SS_DEFAULT_GUI) GUISetFont(12, 400, 0, "Arial") Global $Label_Spelers = GUICtrlCreateLabel("Welkom, met hoeveel spelers zijn jullie?", 16, 16, 277, 22) Global $Radio2 = GUICtrlCreateRadio("2 Spelers", 32, 56, 113, 17) GUICtrlSetCursor(-1, 0) If $Spelers = 2 Then GUICtrlSetState(-1, $GUI_CHECKED) ;Al een keer ingevoerd? Dan onthoud ie dat zo Global $Radio3 = GUICtrlCreateRadio("3 Spelers", 32, 88, 113, 17) GUICtrlSetCursor(-1, 0) If $Spelers = 3 Then GUICtrlSetState(-1, $GUI_CHECKED) Global $Radio4 = GUICtrlCreateRadio("4 Spelers", 32, 120, 113, 17) GUICtrlSetCursor(-1, 0) If $Spelers = 4 Then GUICtrlSetState(-1, $GUI_CHECKED) Global $LabelStartbedrag = GUICtrlCreateLabel("Startbedrag:", 175, 56) Global $InputStartbedrag = GUICtrlCreateInput("1500", 160, 81, 120, 25, $ES_NUMBER) If $VensterFinished_Start = 1 Then GUICtrlSetData($InputStartbedrag, $Startbedrag) ;Dit geeft de mogelijkheid om zonder instellingen te resetten stappen terug te gaan. Hierbij door het vorige ingestelde waarde weer terug in te stellen Global $Button_Next = GUICtrlCreateButton("Volgende", 184, 125, 97, 25, $BS_DEFPUSHBUTTON) GUICtrlSetFont(-1, 11, 400, 0, "Arial") GUICtrlSetCursor(-1, 0) GUISetState(@SW_SHOW) Global $While1=1 Global $WhileH=0 ;Global $GameStarted=0 While $While1 ;===========Wat te doen bij startscherm $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button_Next If GUICtrlRead($Radio2) = 1 or GUICtrlRead($Radio3) = 1 or GUICtrlRead($Radio4) = 1 Then Global $Startbedrag = GUICtrlRead($InputStartbedrag) Global $ReturnWindow = 1 Global $VensterFinished_Start = 1 Ctrl_Radio() ;Verwijst naar controle van de opties Else MsgBox($MB_OK, "Niet zo snel", "Voer eerst in met hoeveel spelers jullie zijn") ;Foutmelding EndIf EndSwitch Wend EndFunc ;==>Start Func Ctrl_Radio() ;===========Controlleert welke optie gekozen is, en verwijst door naar toepassende venster If GUICtrlRead($Radio2) = 1 Then Global $Spelers = 2 Namen2() ElseIf GUICtrlRead($Radio3) = 1 Then Global $Spelers = 3 Namen3() ElseIf GUICtrlRead($Radio4) = 1 Then Global $Spelers = 4 Namen4() Else MsgBox($MB_OK, "Houston, we got a problem", "Er kon niet gelezen worden welke optie je gekozen hebt." & @CRLF & "Foutcode: " & @error) ;Foutmelding, lijkt me duidelijk EndIf EndFunc ;==>Ctr_Radio Func Namen2() ;===========Venster waarbij je namen kiest voor 2 spelers If $VensterFinished_N2 = 1 Then ;==> Als Back() wordt uitgevoerd, moet er eerst een venster zijn voordat de rest kan gebeuren Global $Window = GUICreate("MonoBank - Start", 306, 165, @DesktopWidth / 2 - (306 / 2), @DesktopHeight / 2 - (165 / 2), $GUI_SS_DEFAULT_GUI) GUISetFont(12, 400, 0, "Arial") EndIf WinSetTitle($Window, "", "MonoBank - Namen") GUICtrlDelete($Label_Spelers) GUICtrlDelete($Radio2) GUICtrlDelete($Radio3) GUICtrlDelete($Radio4) GUICtrlDelete($Button_Next) GUICtrlDelete($LabelStartbedrag) GUICtrlDelete($InputStartbedrag) Global $Label_Namen = GUICtrlCreateLabel("Hoe zal ik jullie noemen?", 71, 15) Global $Label1 = GUICtrlCreateLabel("Speler 1", 62, 64, 63, 22, $WS_GROUP) GUICtrlSetColor(-1, 0x4286f4) Global $Input1 = GUICtrlCreateInput("", 38, 90, 105, 24, BitOR($ES_AUTOHSCROLL, $WS_GROUP)) GUICtrlSetFont(-1, 10, 400, 0, "Arial") GUICtrlSetCursor(-1, 5) Global $Label2 = GUICtrlCreateLabel("Speler 2", 198, 64, 63, 22, $WS_GROUP) GUICtrlSetColor(-1, 0xea3838) Global $Input2 = GUICtrlCreateInput("", 174, 90, 105, 24, BitOR($ES_AUTOHSCROLL, $WS_GROUP)) GUICtrlSetFont(-1, 10, 400, 0, "Arial") GUICtrlSetCursor(-1, 5) Global $Button_Next = GUICtrlCreateButton("Start", 306 / 2 - 42, 125, 97, 25, $BS_DEFPUSHBUTTON) GUICtrlSetFont(-1, 11, 400, 0, "Arial") GUICtrlSetCursor(-1, 0) Global $Button_Back = GUICtrlCreateButton("<", 0, 0, 25, 25, $WS_GROUP) GUICtrlSetFont(-1, 11, 400, 0, "Arial") GUICtrlSetCursor(-1, 0) GUISetState(@SW_SHOW) Global $While1 = 0 Global $While2 = 1 While $While2 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button_Back If $ReturnWindow = 2 Then ;Als je twee keer achter elkaar op terug drukt, is dit venster nog steeds genoteerd als laatste venster. Dus in dit geval slaat hij Back() over en verwijdert hij alles zelf GUIDelete($Window) $While2=0 and $WhileH=0 Start() Else Back() EndIf Case $Button_Next If GUICtrlRead($Input1) = "" and GUICtrlRead($Input2) = "" Then MsgBox(0, "Niet zo snel", "Ik ken niemand die geen naam heeft") ElseIf GUICtrlRead($Input1) = "" Or GUICtrlRead($Input2) = "" Then MsgBox(0, "Niet zo snel", "Je moet wel voor beide personen een naam invoeren") Else Global $Speler1 = GUICtrlRead($Input1) Global $Speler2 = GUICtrlRead($Input2) Global $ReturnWindow = 2 ;Dit is om bij te houden wat het laastste venster was (back()) Global $VensterFinished_N2 = 1 ;Dit is om aan te geven voor later of de data bij dit venster al is ingevoerd, om later het overschrijven van de data te voorkomen Hoofdscherm() EndIf EndSwitch WEnd EndFunc ;==>Namen2 Func Namen3() ;===========Venster waarbij je namen kiest voor 3 spelers If $VensterFinished_N3 = 1 Then Global $Window = GUICreate("MonoBank - Start", 423, 220, @DesktopWidth / 2 - (423 / 2), @DesktopHeight / 2 - (220 / 2), $GUI_SS_DEFAULT_GUI) GUISetFont(12, 400, 0, "Arial") EndIf Global $WBreedte = 426 Global $WHoogte = 220 WinMove($Window, "", @DesktopWidth / 2 - ($WBreedte / 2), @DesktopHeight / 2 - ($WHoogte / 2), $WBreedte, $WHoogte) WinSetTitle($Window, "", "MonoBank - Namen") GUICtrlDelete($Label_Spelers) GUICtrlDelete($Radio2) GUICtrlDelete($Radio3) GUICtrlDelete($Radio4) GUICtrlDelete($Button_Next) GUICtrlDelete($LabelStartbedrag) GUICtrlDelete($InputStartbedrag) Global $Label_Namen = GUICtrlCreateLabel("Hoe zal ik jullie noemen?", 127, 24, 175, 22, $WS_GROUP) Global $Label1 = GUICtrlCreateLabel("Speler 1", 64, 64, 63, 22, $WS_GROUP) GUICtrlSetColor(-1, 0x4286f4) Global $Input1 = GUICtrlCreateInput("", 40, 96, 105, 24, BitOR($ES_AUTOHSCROLL, $WS_GROUP)) GUICtrlSetFont(-1, 10, 400, 0, "Arial") GUICtrlSetCursor(-1, 5) Global $Label2 = GUICtrlCreateLabel("Speler 2", 184, 64, 63, 22, $WS_GROUP) GUICtrlSetColor(-1, 0xea3838) Global $Input2 = GUICtrlCreateInput("", 160, 96, 105, 24, BitOR($ES_AUTOHSCROLL, $WS_GROUP)) GUICtrlSetFont(-1, 10, 400, 0, "Arial") GUICtrlSetCursor(-1, 5) Global $Label3 = GUICtrlCreateLabel("Speler 3", 304, 64, 63, 22, $WS_GROUP) GUICtrlSetColor(-1, 0x10cc38) Global $Input3 = GUICtrlCreateInput("", 281, 96, 105, 24, BitOR($ES_AUTOHSCROLL, $WS_GROUP)) GUICtrlSetFont(-1, 10, 400, 0, "Arial") GUICtrlSetCursor(-1, 5) Global $Button_Next = GUICtrlCreateButton("Start", 166, 144, 97, 25, BitOR($WS_GROUP, $BS_DEFPUSHBUTTON)) GUICtrlSetFont(-1, 11, 400, 0, "Arial") GUICtrlSetCursor(-1, 0) Global $Button_Back = GUICtrlCreateButton("<", 0, 0, 25, 25, $WS_GROUP) GUICtrlSetFont(-1, 11, 400, 0, "Arial") GUICtrlSetCursor(-1, 0) GUISetState(@SW_SHOW) Global $While1 = 0 Global $While2 = 1 While $While2 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button_Next If GUICtrlRead($Input1) = "" and GUICtrlRead($Input2) = "" And GUICtrlRead($Input3) = "" Then MsgBox(0, "Niet zo snel", "Ik ken niemand die geen naam heeft") ElseIf GUICtrlRead($Input1) = "" Or GUICtrlRead($Input2) = "" Or GUICtrlRead($Input3) = "" Then MsgBox(0, "Niet zo snel", "Je moet wel alle namen invoeren") Else Global $Speler1 = GUICtrlRead($Input1) Global $Speler2 = GUICtrlRead($Input2) Global $Speler3 = GUICtrlRead($Input3) Global $ReturnWindow = 3 Global $VensterFinished_N3 = 1 Hoofdscherm() EndIf Case $Button_Back If $ReturnWindow = 3 Then GUIDelete($Window) $While2=0 and $WhileH=0 Start() Else Back() EndIf EndSwitch WEnd EndFunc ;==>Namen3 Func Namen4() ;===========Venster waarbij je namen kiest voor 4 spelers If $VensterFinished_N4 = 1 Then Global $Window = GUICreate("MonoBank - Start", 546, 220, @DesktopWidth / 2 - (546 / 2), @DesktopHeight / 2 - (220 / 2), $GUI_SS_DEFAULT_GUI) GUISetFont(12, 400, 0, "Arial") EndIf Global $WBreedte = 546 Global $WHoogte = 220 WinMove($Window, "", @DesktopWidth / 2 - ($WBreedte / 2), @DesktopHeight / 2 - ($WHoogte / 2), $WBreedte, $WHoogte) WinSetTitle($Window, "", "MonoBank - Namen") GUICtrlDelete($Label_Spelers) GUICtrlDelete($Radio2) GUICtrlDelete($Radio3) GUICtrlDelete($Radio4) GUICtrlDelete($Button_Next) GUICtrlDelete($LabelStartbedrag) GUICtrlDelete($InputStartbedrag) Global $Label_Namen = GUICtrlCreateLabel("Hoe zal ik jullie noemen?", 185, 24, 175, 22, $WS_GROUP) Global $Label1 = GUICtrlCreateLabel("Speler 1", 64, 64, 63, 22, $WS_GROUP) GUICtrlSetColor(-1, 0x4286f4) Global $Input1 = GUICtrlCreateInput("", 40, 96, 105, 24, BitOR($ES_AUTOHSCROLL, $WS_GROUP)) GUICtrlSetFont(-1, 10, 400, 0, "Arial") GUICtrlSetCursor(-1, 5) If $VensterFinished_N4 = 1 Then GUICtrlSetData(-1, $Speler1) Global $Label2 = GUICtrlCreateLabel("Speler 2", 184, 64, 63, 22, $WS_GROUP) GUICtrlSetColor(-1, 0xea3838) Global $Input2 = GUICtrlCreateInput("", 160, 96, 105, 24, BitOR($ES_AUTOHSCROLL, $WS_GROUP)) GUICtrlSetFont(-1, 10, 400, 0, "Arial") GUICtrlSetCursor(-1, 5) If $VensterFinished_N4 = 1 Then GUICtrlSetData(-1, $Speler2) Global $Label3 = GUICtrlCreateLabel("Speler 3", 304, 64, 63, 22, $WS_GROUP) GUICtrlSetColor(-1, 0x10cc38) Global $Input3 = GUICtrlCreateInput("", 281, 96, 105, 24, BitOR($ES_AUTOHSCROLL, $WS_GROUP)) GUICtrlSetFont(-1, 10, 400, 0, "Arial") GUICtrlSetCursor(-1, 5) If $VensterFinished_N4 = 1 Then GUICtrlSetData(-1, $Speler3) Global $Label4 = GUICtrlCreateLabel("Speler 4", 424, 64, 63, 22, $WS_GROUP) GUICtrlSetColor(-1, 0xdbd82b) Global $Input4 = GUICtrlCreateInput("", 402, 96, 105, 24, BitOR($ES_AUTOHSCROLL, $WS_GROUP)) GUICtrlSetFont(-1, 10, 400, 0, "Arial") GUICtrlSetCursor(-1, 5) If $VensterFinished_N4 = 1 Then GUICtrlSetData(-1, $Speler4) Global $Button_Next = GUICtrlCreateButton("Start", 224, 144, 97, 25, BitOR($WS_GROUP, $BS_DEFPUSHBUTTON)) GUICtrlSetFont(-1, 11, 400, 0, "Arial") GUICtrlSetCursor(-1, 0) Global $Button_Back = GUICtrlCreateButton("<", 0, 0, 25, 25, $WS_GROUP) GUICtrlSetFont(-1, 11, 400, 0, "Arial") GUICtrlSetCursor(-1, 0) GUISetState(@SW_SHOW) Global $While1 = 0 Global $While2 = 1 While $While2 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button_Next If GUICtrlRead($Input1) = "" And GUICtrlRead($Input2) = "" And GUICtrlRead($Input3) = "" And GUICtrlRead($Input4) = "" Then MsgBox(0, "Niet zo snel", "Ik ken niemand die geen naam heeft") ElseIf GUICtrlRead($Input1) = "" Or GUICtrlRead($Input2) = "" Or GUICtrlRead($Input3) = "" Or GUICtrlRead($Input4) = "" Then MsgBox(0, "Niet zo snel", "Je moet wel alle namen invoeren") Else Global $Speler1 = GUICtrlRead($Input1) Global $Speler2 = GUICtrlRead($Input2) Global $Speler3 = GUICtrlRead($Input3) Global $Speler4 = GUICtrlRead($Input4) Global $ReturnWindow = 4 Global $VensterFinished_N4 = 1 Hoofdscherm() EndIf Case $Button_Back If $ReturnWindow = 4 Then GUIDelete($Window) $While2=0 and $WhileH=0 Start() Else Back() EndIf EndSwitch WEnd EndFunc ;==>Namen4 Func Back() GUIDelete($Window) $While2=0 and $WhileH=0 If $ReturnWindow = 1 Then Start() ElseIf $ReturnWindow = 2 Then Namen2() ElseIf $ReturnWindow = 3 Then Namen3() ElseIf $ReturnWindow = 4 Then Namen4() Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden bepaald naar welk venster u wilt terugkeren" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Home/ErrorMsgBox1.0") ;Ik label elke msgbox die een foutcode geeft op deze manier, dan kun je makkelijker vinden waar de fout zich voordeet EndIf EndFunc Func _No_TABSTOP($iCID) _WinAPI_SetWindowLong(GUICtrlGetHandle($iCID), $GWL_STYLE, BitAND(_WinAPI_GetWindowLong(GUICtrlGetHandle($iCID), $GWL_STYLE), BitNOT($WS_TABSTOP))) EndFunc Func Hoofdscherm() ;===========Het venster waar het allemaal gebeurt #Region ;Al het verwijderen WinSetTitle($Window, "", "MonoBank") GUICtrlDelete($Button_Next) GUICtrlDelete($Label1) GUICtrlDelete($Label2) If IsDeclared("Input3") = 1 Then GUICtrlDelete($Label3) If IsDeclared("Input4") = 1 Then GUICtrlDelete($Label4) GUICtrlDelete($Input1) GUICtrlDelete($Input2) If IsDeclared("Input3") = 1 Then GUICtrlDelete($Input3) If IsDeclared("Input4") = 1 Then GUICtrlDelete($Input4) GUICtrlDelete($Label_Namen) ;============= Nu is alles prachtig mooi opgruimt #EndRegion #Region ;Al het toevoegen Global $Einde = False If $Spelers = 2 Then $WBreedte =518 $X_Undo = 228 $X_Input = $X_Undo + 52 $X_Transfer = $X_Undo + 200 If $MB_Progress <> 6 Then ;Dit geeft de mogelijkheid om zonder instellingen te resetten stappen terug te gaan. Dit door te voorkomen om de waardes te overschrijven Global $Geld1 = $Startbedrag Global $Geld2 = $Startbedrag EndIf Global $Spelend1 = 1 Global $Spelend2 = 1 ElseIf $Spelers = 3 Then $WBreedte = 633 $X_Undo = 298 $X_Input = $X_Undo + 52 $X_Transfer = $X_Undo + 200 If $MB_Progress <> 6 Then ;Dit geeft de mogelijkheid om zonder instellingen te resetten stappen terug te gaan. Dit door te voorkomen om de waardes te overschrijven Global $Geld1 = $Startbedrag Global $Geld2 = $Startbedrag Global $Geld3 = $Startbedrag EndIf Global $Spelend1 = 1 Global $Spelend2 = 1 Global $Spelend3 = 1 ElseIf $Spelers = 4 Then $WBreedte = 768 $X_Undo = 368 $X_Input = $X_Undo + 52 $X_Transfer = $X_Undo + 200 If $MB_Progress <> 6 Then ;Dit geeft de mogelijkheid om zonder instellingen te resetten stappen terug te gaan. Dit door te voorkomen om de waardes te overschrijven Global $Geld1 = $Startbedrag Global $Geld2 = $Startbedrag Global $Geld3 = $Startbedrag Global $Geld4 = $Startbedrag EndIf Global $Spelend1 = 1 Global $Spelend2 = 1 Global $Spelend3 = 1 Global $Spelend4 = 1 Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden geladen hoeveel spelers er zijn" & @CRLF & "Foutcode: " & @error) EndIf ;===================== Dit allemaal bepaalt de posities en andere dingen van bepaalde dingen, afhankelijk van het aantal spelers $WHoogte = 380 WinMove($Window, "", @DesktopWidth / 2 - ($WBreedte / 2), @DesktopHeight / 2 - ($WHoogte / 2), $WBreedte, $WHoogte) Global $Zender1 = GUICtrlCreateLabel($Speler1, 232, 52, 105, 36, BitOR($WS_GROUP, $SS_CENTER)) ;===Zender Labels GUICtrlSetFont(-1, 20, 400, 0, "Arial") GUICtrlSetColor(-1, 0x4286f4) Global $Zender2 = GUICtrlCreateLabel($Speler2, 370, 52, 105, 36, BitOR($WS_GROUP, $SS_CENTER)) GUICtrlSetFont(-1, 20, 400, 0, "Arial") GUICtrlSetColor(-1, 0xea3838) If IsDeclared("Spelend3") = 1 Then Global $Zender3 = GUICtrlCreateLabel($Speler3, 509, 52, 105, 36, BitOR($WS_GROUP, $SS_CENTER)) GUICtrlSetFont(-1, 20, 400, 0, "Arial") GUICtrlSetColor(-1, 0x10cc38) EndIf If IsDeclared("Spelend4") = 1 Then Global $Zender4 = GUICtrlCreateLabel($Speler4, 647, 52, 105, 36, BitOR($WS_GROUP, $SS_CENTER)) GUICtrlSetFont(-1, 20, 400, 0, "Arial") GUICtrlSetColor(-1, 0xdbd82b) EndIf Global $GeldStatus1 = GUICtrlCreateLabel("₩" & $Geld1, 232, 18, 105, 31, $SS_CENTER) ;===Geldstatussen GUICtrlSetFont(-1, 18, 400, 0, "Arial") Global $GeldStatus2 = GUICtrlCreateLabel("₩" & $Geld2, 370, 18, 105, 31, $SS_CENTER) GUICtrlSetFont(-1, 18, 400, 0, "Arial") If IsDeclared("Geld3") = 1 Then Global $GeldStatus3 = GUICtrlCreateLabel("₩" & $Geld3, 509, 18, 105, 31, $SS_CENTER) GUICtrlSetFont(-1, 18, 400, 0, "Arial") EndIf If IsDeclared("Geld4") = 1 Then Global $GeldStatus4 = GUICtrlCreateLabel("₩" & $Geld4, 647, 18, 105, 31, $SS_CENTER) GUICtrlSetFont(-1, 18, 400, 0, "Arial") EndIf Global $ROHoogte = 271 Global $Ontvanger1 = GUICtrlCreateLabel($Speler1, 232, $ROHoogte, 105, 36, BitOR($WS_GROUP, $SS_CENTER)) ;===Ontvanger Labels GUICtrlSetFont(-1, 20, 400, 0, "Arial") GUICtrlSetColor(-1, 0x4286f4) Global $Ontvanger2 = GUICtrlCreateLabel($Speler2, 370, $ROHoogte, 105, 36, BitOR($WS_GROUP, $SS_CENTER)) GUICtrlSetFont(-1, 20, 400, 0, "Arial") GUICtrlSetColor(-1, 0xea3838) If IsDeclared("Spelend3") = 1 Then Global $Ontvanger3 = GUICtrlCreateLabel($Speler3, 509, $ROHoogte, 105, 36, BitOR($WS_GROUP, $SS_CENTER)) GUICtrlSetFont(-1, 20, 400, 0, "Arial") GUICtrlSetColor(-1, 0x10cc38) EndIf If IsDeclared("Spelend4") = 1 Then Global $Ontvanger4 = GUICtrlCreateLabel($Speler4, 647, $ROHoogte, 105, 36, BitOR($WS_GROUP, $SS_CENTER)) GUICtrlSetFont(-1, 20, 400, 0, "Arial") GUICtrlSetColor(-1, 0xdbd82b) EndIf ;GUISetState() ;GUICtrlSetStyle($Radio1, $WS_TABSTOP) GUIStartGroup() ;===Radio's Verzenders Global $Radio1 = GUICtrlCreateRadio("", 276, 94, 21, 21, BitOR($BS_AUTORADIOBUTTON,$BS_TOP)) GUICtrlSetCursor (-1, 0) GUICtrlSetState(-1, $GUI_CHECKED) _No_TABSTOP($Radio1) Global $Radio2 = GUICtrlCreateRadio("", 414, 89, 21, 21, BitOR($BS_AUTORADIOBUTTON,$BS_TOP)) GUICtrlSetCursor (-1, 0) If IsDeclared("Spelend3") = 1 Then Global $Radio3 = GUICtrlCreateRadio("", 553, 89, 21, 21, BitOR($BS_AUTORADIOBUTTON,$BS_TOP)) GUICtrlSetCursor (-1, 0) EndIf If IsDeclared("Spelend4") = 1 Then Global $Radio4 = GUICtrlCreateRadio("", 691, 89, 21, 21, BitOR($BS_AUTORADIOBUTTON,$BS_TOP)) GUICtrlSetCursor (-1, 0) EndIf If $Spelers = 2 Then Global $RadioBankVerz = GUICtrlCreateRadio("Bank", $X_Input + 25, 125, 80) If $Spelers = 3 Then Global $RadioBankVerz = GUICtrlCreateRadio("Bank", $X_Input + 25, 125, 80) If $Spelers = 4 Then Global $RadioBankVerz = GUICtrlCreateRadio("Bank", $X_Input + 25, 125, 80) GUICtrlSetCursor (-1, 0) GUICtrlSetFont(-1, 20, 400, 0, "Arial") GUIStartGroup() ;===Radio's Ontvangers Global $Radio5 = GUICtrlCreateRadio("", 276, $ROHoogte + 40, 21, 21, BitOR($BS_AUTORADIOBUTTON,$BS_TOP)) GUICtrlSetCursor (-1, 0) GUICtrlSetState($Radio5, $GUI_CHECKED) _No_TABSTOP($Radio5) Global $Radio6 = GUICtrlCreateRadio("", 414, $ROHoogte + 40, 21, 21, BitOR($BS_AUTORADIOBUTTON,$BS_TOP)) GUICtrlSetCursor (-1, 0) If IsDeclared("Spelend3") = 1 Then Global $Radio7 = GUICtrlCreateRadio("", 553, $ROHoogte + 40, 21, 21, BitOR($BS_AUTORADIOBUTTON,$BS_TOP)) GUICtrlSetCursor (-1, 0) EndIf If IsDeclared("Spelend4") = 1 Then Global $Radio8 = GUICtrlCreateRadio("", 691, $ROHoogte + 40, 21, 21, BitOR($BS_AUTORADIOBUTTON,$BS_TOP)) GUICtrlSetCursor (-1, 0) EndIf If $Spelers = 2 Then Global $RadioBankOntv = GUICtrlCreateRadio("Bank", $X_Input + 25, 225, 80) If $Spelers = 3 Then Global $RadioBankOntv = GUICtrlCreateRadio("Bank", $X_Input + 25, 225, 80) If $Spelers = 4 Then Global $RadioBankOntv = GUICtrlCreateRadio("Bank", $X_Input + 25, 225, 80) GUICtrlSetCursor (-1, 0) GUICtrlSetFont(-1, 20, 400, 0, "Arial") Global $Input = GUICtrlCreateInput("", $X_Input, 163, 144, 50, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$ES_NUMBER,$WS_GROUP)) ;===Transactie Middelen GUICtrlSetFont(-1, 28, 400, 0, "Arial") GUICtrlSetCursor (-1, 5) GUICtrlSetLimit(-1, 6) Global $Button_Transfer = GUICtrlCreateButton("OK", $X_Transfer, 163, 50, 50, BitOR($WS_GROUP, $BS_DEFPUSHBUTTON)) GUICtrlSetCursor(-1, 0) Global $Button_Undo = GUICtrlCreateButton("<", $X_Undo, 163, 50, 50, $WS_GROUP) GUICtrlSetCursor(-1, 0) GUICtrlCreateLabel("Transactie Geschiedenis", 20, 40, 200) ;===PaymentHistory Middelen GUICtrlSetFont(-1, 14, 500, 0, "") Global $PayHLabel[10], $PayH[10] For $i = 1 To 10 $PayH[$i - 1] = ".........." ;Creates the variables for the values $PayHLabel[$i - 1] = GUICtrlCreateLabel($PayH[$i - 1], 30, 40+$i*27, 230) ;Creates the labels which show the values ;==$PayH[$i - 1] Is reference naar vorige waardes GUICtrlSetFont(-1, 12, 300, 0, "Segoe UI") Next #EndRegion Global $While2 = 0 Global $WhileH = 1 Global $GameStarted = 1 If $Spelers = 2 Then Global $SpelersOver = 2 ElseIf $Spelers = 3 Then Global $SpelersOver = 3 ElseIf $Spelers = 4 Then Global $SpelersOver = 4 EndIf ;==> Dit stelt het de variable $Spelers in op het aantal spelers, zodat in de volgende while loop gechekt kan worden of er 2 spelers over zijn, waardoor de radio's zich slimmer gedragen While $WhileH $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button_Transfer If GUICtrlRead($Input)= Not "" And $Einde = False Then Transfer() ; Case $Radio1 ;======================================================================> Slim wisselen ; If $SpelersOver=2 And $Einde=0 Then ; GUICtrlSetState($Radio6,1) ; _No_TABSTOP($Radio6) ; EndIf ; ; Case $Radio2 ; If $SpelersOver=2 And $Einde=0 Then ; GUICtrlSetState($Radio5,1) ; _No_TABSTOP($Radio5) ; EndIf ; ; Case $Radio3 ; If $SpelersOver=2 And $Einde=0 Then ; GUICtrlSetState($Radio5,1) ; _No_TABSTOP($Radio5) ; EndIf ; ; Case $Radio4 ; If $SpelersOver=2 And $Einde=0 Then ; GUICtrlSetState($Radio5,1) ; _No_TABSTOP($Radio5) ; EndIf ; ; Case $Radio5 ; If $SpelersOver=2 And $Einde=0 Then ; GUICtrlSetState($Radio2,1) ; _No_TABSTOP($Radio2) ; EndIf ; ; Case $Radio6 ; If $SpelersOver=2 And $Einde=0 Then ; GUICtrlSetState($Radio1,1) ; _No_TABSTOP($Radio1) ; EndIf ; ; Case $Radio7 ; If $SpelersOver=2 And $Einde=0 Then ; GUICtrlSetState($Radio5,1) ; _No_TABSTOP($Radio5) ; EndIf ; ; Case $Radio8 ; If $SpelersOver=2 And $Einde=0 Then ; GUICtrlSetState($Radio5,1) ; _No_TABSTOP($Radio5) ; EndIf ; Case $Button_Undo ; Sumsing Case $Button_Back Global $MB_Progress = MsgBox(4, "Voortgang onthouden", "Wil je de voortgang onthouden?") Back() ;Hieronder zie je niet wat er gebeurt als er een keuze gemaakt word, alleen dat hij teruggaat naar Back(). Maar bij de vorige vensters, als de waardes worden aangemaakt, worden die waardes niet nog eens gemaakt (en dus overschreden) als het antwoord ja (6) is ;Case $Radio1, $Radio2, $Radio3, $Radio4, $Radio5, $Radio6, $Radio7, $Radio8 ; _No_TABSTOP($nMsg) EndSwitch If GUICtrlRead($GeldStatus1) <> "₩" & $Geld1 Then GUICtrlSetData($GeldStatus1, "₩" & $Geld1) If GUICtrlRead($GeldStatus2) <> "₩" & $Geld2 Then GUICtrlSetData($GeldStatus2, "₩" & $Geld2) If IsDeclared("GeldStatus3") And GuiCtrlRead($GeldStatus3) <> "₩" & $Geld3 Then GUICtrlSetData($GeldStatus3, "₩" & $Geld3) If IsDeclared("GeldStatus4") And GuiCtrlRead($GeldStatus4) <> "₩" & $Geld4 Then GUICtrlSetData($GeldStatus4, "₩" & $Geld4) ;============= Updatet de geldstatussen meteen als een bedrag verandert ;If $SpelersOver=2 Then ;=========================> Laat de radios slim wisselen tussen de 2 spelers die over zijns ;$Done=1 ; If $Einde=0 And $Done=0 Then ; If GUICtrlRead($Radio1)=1 And Not BitAND(GUICtrlGetState($Radio6),1) And Not BitAND(GUICtrlGetState($Radio5),1) Then GUICtrlSetState($Radio6,1) ; If GUICtrlRead($Radio2)=1 And Not BitAND(GUICtrlGetState($Radio5),1) And Not BitAND(GUICtrlGetState($Radio6),1) Then GUICtrlSetState($Radio5,1) ; If GUICtrlRead($Radio5)=1 And Not BitAND(GUICtrlGetState($Radio2),1) And Not BitAND(GUICtrlGetState($Radio1),1) Then GUICtrlSetState($Radio2,1) ; If GUICtrlRead($Radio6)=1 And Not BitAND(GUICtrlGetState($Radio1),1) And Not BitAND(GUICtrlGetState($Radio2),1) Then GUICtrlSetState($Radio1,1) ; GUIRegisterMsg($Radio1, "Radio1") ; $Done=0 ; ; ElseIf $Spelers=3 Then ; Exit ; ElseIf $Spelers=4 Then ; Exit ; EndIf ; EndIf WEnd EndFunc Func Transfer() ;====== Kijkt welke zender is geselecteerd > berekent kosten > bekijkt welke ontvanger is geselecteerd > berekent inkomen en ondertussen checkt hij wanneer iemand gewonnen heeft $GeldErbij = GUICtrlRead($Input) $Schulden1 = False $Temp = 0 $Failliet = 0 If GUICtrlRead($Radio1) = 1 Then Global $Verzender = $Speler1 $Result = $Geld1 - $GeldErbij $PreTransfer = $Geld1 Global $Geld1 = $Result ;===> Berekent de transactie $Failliet = 0 ;Nodig bij het bepalen of iemand failliet is (Begint bij de volgende regel) If $Geld1 < 0 And GUICtrlRead($Radio5) = $GUI_UNCHECKED Then $Schulden1 = True $GeldErbij = $PreTransfer ;Zorgt ervoor dat bij het overmaken aan de ander (zie beneden deze if's), dat de debtor alleen het geld krijgt die de schuldige ook echt heeft $Failliet = MsgBox(4, "Failliet", $Speler1 & " staat hierdoor in het rood." & @CRLF & "Wil je deze speler failliet verklaren?" & @CRLF & "(Als je op nee drukt, wordt het balans van " & $Speler1 & " teruggezet naar 0.") If $Spelers = 2 Then If $Failliet = 6 Then ;Als de speler op ja drukte bij vorige MsgBox GUICtrlSetState($Radio2, 1) GUICtrlSetState($Radio1, 128) GUICtrlSetState($Zender1, 128) GUICtrlSetState($Ontvanger1, 128) GUICtrlSetState($GeldStatus1, 128) GUICtrlSetState($Radio5, 128) $Spelend1 = 0 $SpelersOver = 1 $Einde = True MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler2 & "!") ElseIf $Failliet = 7 Then ;Als de speler op nee drukte $Geld1 = 0 Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden gelezen welke optie u gekozen heeft" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox1.1") ;Ik label elke msgbox die een foutcode geeft op deze manier, dan kun je makkelijker vinden waar de fout zich voordeet EndIf ElseIf $Spelers = 3 Then If $Failliet = 6 Then ;Als de speler op ja drukte bij vorige MsgBox GUICtrlSetState($Zender1, 128) GUICtrlSetState($Ontvanger1, 128) GUICtrlSetState($GeldStatus1, 128) GUICtrlSetState($Radio5, 128) $Spelend1 = 0 $Temp = $SpelersOver $SpelersOver = $Temp - 1 If $Spelend2 = 1 Then ;Hier checkedt hij de Radio die nog overblijft GUICtrlSetState($Radio2, 1) GUICtrlSetState($Radio1, 128) ElseIf $Spelend3 = 1 Then ;Hier checkedt hij de Radio die nog overblijft GUICtrlSetState($Radio3, 1) GUICtrlSetState($Radio1, 128) EndIf If $Spelend3 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler2 & "!") $Einde = True ElseIf $Spelend2 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler3 & "!") $Einde = True EndIf ElseIf $Failliet = 7 Then ;Als de speler op nee drukte $Geld1 = 0 Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden gelezen welke optie u gekozen heeft" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox1.2") EndIf ElseIf $Spelers = 4 Then If $Failliet = 6 Then ;Als de speler op ja drukte bij vorige MsgBox GUICtrlSetState($Zender1, 128) GUICtrlSetState($Ontvanger1, 128) GUICtrlSetState($GeldStatus1, 128) GUICtrlSetState($Radio5, 128) $Spelend1 = 0 $Temp = $SpelersOver $SpelersOver = $Temp - 1 If $Spelend2 = 1 Then ;Hier checkedt(vinkt) hij de Radio die nog overblijft GUICtrlSetState($Radio2, 1) GUICtrlSetState($Radio1, 128) ElseIf $Spelend3 = 1 Then ;Hier checkedt hij de Radio die nog overblijft GUICtrlSetState($Radio3, 1) GUICtrlSetState($Radio1, 128) ElseIf $Spelend4 = 1 Then ;Hier checkedt hij de Radio die nog overblijft GUICtrlSetState($Radio4, 1) GUICtrlSetState($Radio1, 128) EndIf If $Spelend3 = 0 And $Spelend4 = 0 Then ;Hier checkt hij of iemand gewonnen heeft MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler2 & "!") $Einde = True ElseIf $Spelend2 = 0 And $Spelend4 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler3 & "!") $Einde = True ElseIf $Spelend2 = 0 And $Spelend3 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler4 & "!") $Einde = True EndIf ElseIf $Failliet = 7 Then ;Als de speler op nee drukte $Geld1 = 0 Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden gelezen welke optie u gekozen heeft" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox1.3") EndIf Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden geladen hoeveel mensen er zijn" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox1.4") EndIf EndIf If GUICtrlRead($Radio5) = 1 Then Global $Ontvanger = $Speler1 $Result = $Geld1 + $GeldErbij Global $Geld1 = $Result ElseIf GUICtrlRead($Radio6) = 1 Then Global $Ontvanger = $Speler2 $Result = $Geld2 + $GeldErbij Global $Geld2 = $Result ElseIf IsDeclared("Spelend3") = Not 0 And GUICtrlRead($Radio7) = 1 Then Global $Ontvanger = $Speler3 $Result = $Geld3 + $GeldErbij Global $Geld3 = $Result ElseIf IsDeclared("Spelend4") = Not 0 And GUICtrlRead($Radio8) = 1 Then Global $Ontvanger = $Speler4 $Result = $Geld4 + $GeldErbij Global $Geld4 = $Result ElseIf GUICtrlRead($RadioBankOntv) = 1 Then Global $Ontvanger = "Bank" Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden geladen welke radioknop is geselecteerd" & @CRLF & "bij de ontvangers" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox1.5") EndIf ElseIf GUICtrlRead($Radio2) = 1 Then $Result = $Geld2 - $GeldErbij $PreTransfer = $Geld2 Global $Geld2 = $Result ;===> Berekent de transactie $Failliet = 0 ;Nodig bij het bepalen of iemand failliet is (Begint bij de volgende regel) If $Geld2 < 0 And GUICtrlRead($Radio6) = $GUI_UNCHECKED Then $Schulden2 = True $GeldErbij = $PreTransfer ;Zorgt ervoor dat bij het overmaken aan de ander (zie beneden deze if's), dat de debtor alleen het geld krijgt die de schuldige ook echt heeft $Failliet = MsgBox(4, "Failliet", $Speler2 & " staat hierdoor het rood." & @CRLF & "Wil je deze speler failliet verklaren?" & @CRLF & "(Als je op nee drukt, wordt het balans van " & $Speler2 & " teruggezet naar 0.") If $Spelers = 2 Then If $Failliet = 6 Then ;Als de speler op ja drukte bij vorige MsgBox GUICtrlSetState($Radio1, 1) GUICtrlSetState($Radio2, 128) GUICtrlSetState($Radio6, 128) GUICtrlSetState($Zender2, 128) GUICtrlSetState($Ontvanger2, 128) GUICtrlSetState($GeldStatus2, 128) $Spelend2 = 0 $Einde = True MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler1 & "!") ElseIf $Failliet = 7 Then ;Als de speler op nee drukte $Geld2 = 0 Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden gelezen welke optie u gekozen heeft" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox2.1") EndIf ElseIf $Spelers = 3 Then If $Failliet = 6 Then ;Als de speler op ja drukte bij vorige MsgBox GUICtrlSetState($Zender2, 128) GUICtrlSetState($Ontvanger2, 128) GUICtrlSetState($GeldStatus2, 128) GUICtrlSetState($Radio6, 128) $Spelend2 = 0 $Temp = $SpelersOver $SpelersOver = $Temp - 1 If $Spelend1 = 1 Then ;Hier checkedt hij de Radio die nog overblijft GUICtrlSetState($Radio1, 1) GUICtrlSetState($Radio2, 128) ElseIf $Spelend3 = 1 Then ;Hier checkedt hij de Radio die nog overblijft GUICtrlSetState($Radio3, 1) GUICtrlSetState($Radio2, 128) EndIf If $Spelend3 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler1 & "!") $Einde = True ElseIf $Spelend1 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler3 & "!") $Einde = True EndIf ElseIf $Failliet = 7 Then ;Als de speler op nee drukte $Geld2 = 0 Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden gelezen welke optie u gekozen heeft" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox2.2") EndIf ElseIf $Spelers = 4 Then If $Failliet = 6 Then ;Als de speler op ja drukte bij vorige MsgBox GUICtrlSetState($Zender2, 128) GUICtrlSetState($Ontvanger2, 128) GUICtrlSetState($GeldStatus2, 128) GUICtrlSetState($Radio6, 128) $Spelend2 = 0 $Temp = $SpelersOver $SpelersOver = $Temp - 1 If $Spelend1 = 1 Then ;Hier checkedt(vinkt) hij de Radio die nog overblijft GUICtrlSetState($Radio1, 1) GUICtrlSetState($Radio2, 128) ElseIf $Spelend3 = 1 Then ;Hier checkedt hij de Radio die nog overblijft GUICtrlSetState($Radio3, 1) GUICtrlSetState($Radio2, 128) ElseIf $Spelend4 = 1 Then ;Hier checkedt hij de Radio die nog overblijft GUICtrlSetState($Radio4, 1) GUICtrlSetState($Radio2, 128) EndIf If $Spelend3 = 0 And $Spelend4 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler1 & "!") $Einde = True ElseIf $Spelend1 = 0 And $Spelend4 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler3 & "!") $Einde = True ElseIf $Spelend1 = 0 And $Spelend3 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler4 & "!") $Einde = True EndIf ElseIf $Failliet = 7 Then ;Als de speler op nee drukte $Geld2 = 0 Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden gelezen welke optie u gekozen heeft" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox2.3") EndIf Else MsgBox(0, "Niet genoeg info", "Naar wie moet het geld?") EndIf EndIf If GUICtrlRead($Radio5) = 1 Then $Result = $Geld1 + $GeldErbij Global $Geld1 = $Result ElseIf GUICtrlRead($Radio6) = 1 Then $Result = $Geld2 + $GeldErbij Global $Geld2 = $Result ElseIf IsDeclared("Spelend3") = Not 0 And GUICtrlRead($Radio7) = 1 Then $Result = $Geld3 + $GeldErbij Global $Geld3 = $Result ElseIf IsDeclared("Spelend4") = Not 0 And GUICtrlRead($Radio8) = 1 Then $Result = $Geld4 + $GeldErbij Global $Geld4 = $Result ElseIf GUICtrlRead($RadioBankOntv) = 0 Then MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden geladen welke radioknop is geselecteerd" & @CRLF & "bij de ontvangers" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox2.4") EndIf ElseIf GUICtrlRead($Radio3) = 1 Then $Result = $Geld3 - $GeldErbij $PreTransfer = $Geld3 Global $Geld3 = $Result ;===> Berekent de transactie $Failliet = 0 ;Nodig bij het bepalen of iemand failliet is (Begint bij de volgende regel) If $Geld3 < 0 And GUICtrlRead($Radio7) = $GUI_UNCHECKED Then $Schulden3 = True $GeldErbij = $PreTransfer ;Zorgt ervoor dat bij het overmaken aan de ander (zie beneden deze if's), dat de debtor alleen het geld krijgt die de schuldige ook echt heeft $Failliet = MsgBox(4, "Failliet", $Speler3 & " staat hierdoor in het rood." & @CRLF & "Wil je deze speler failliet verklaren?" & @CRLF & "(Als je op nee drukt, wordt het balans van " & $Speler3 & " teruggezet naar 0.") If $Spelers = 3 Then If $Failliet = 6 Then ;Als de speler op ja drukte bij vorige MsgBox GUICtrlSetState($Zender3, 128) GUICtrlSetState($Ontvanger3, 128) GUICtrlSetState($GeldStatus3, 128) GUICtrlSetState($Radio7, 128) $Spelend3 = 0 $Temp = $SpelersOver $SpelersOver = $Temp - 1 If $Spelend1 = 1 Then ;Hier checkedt hij de Radio die nog overblijft GUICtrlSetState($Radio1, 1) GUICtrlSetState($Radio3, 128) ElseIf $Spelend2 = 1 Then ;Hier checkedt hij de Radio die nog overblijft GUICtrlSetState($Radio2, 1) GUICtrlSetState($Radio3, 128) EndIf If $Spelend2 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler1 & "!") $Einde = True ElseIf $Spelend1 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler2 & "!") $Einde = True EndIf ElseIf $Failliet = 7 Then ;Als de speler op nee drukte $Geld3 = 0 Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden gelezen welke optie u gekozen heeft" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox3.1") EndIf ElseIf $Spelers = 4 Then If $Failliet = 6 Then ;Als de speler op ja drukte bij vorige MsgBox GUICtrlSetState($Zender3, 128) GUICtrlSetState($Ontvanger3, 128) GUICtrlSetState($GeldStatus3, 128) GUICtrlSetState($Radio7, 128) $Spelend3 = 0 $Temp = $SpelersOver $SpelersOver = $Temp - 1 If $Spelend4 = 1 Then ;Hier checkedt hij de Radio die nog overblijft GUICtrlSetState($Radio4, 1) GUICtrlSetState($Radio3, 128) ElseIf $Spelend2 = 1 Then ;Hier checkedt hij de Radio die nog overblijft GUICtrlSetState($Radio2, 1) GUICtrlSetState($Radio3, 128) ElseIf $Spelend1 = 1 Then ;Hier checkedt(vinkt) hij de Radio die nog overblijft GUICtrlSetState($Radio1, 1) GUICtrlSetState($Radio3, 128) EndIf If $Spelend2 = 0 And $Spelend4 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler1 & "!") $Einde = True ElseIf $Spelend1 = 0 And $Spelend4 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler2 & "!") $Einde = True ElseIf $Spelend1 = 0 And $Spelend2 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler4 & "!") $Einde = True EndIf ElseIf $Failliet = 7 Then ;Als de speler op nee drukte $Geld3 = 0 Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden gelezen welke optie u gekozen heeft" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox3.2") EndIf Else MsgBox(0, "Niet genoeg info", "Naar wie moet het geld?") EndIf EndIf If GUICtrlRead($Radio5) = 1 Then $Result = $Geld1 + $GeldErbij Global $Geld1 = $Result ElseIf GUICtrlRead($Radio6) = 1 Then $Result = $Geld2 + $GeldErbij Global $Geld2 = $Result ElseIf IsDeclared("Spelend3") = Not 0 And GUICtrlRead($Radio7) = 1 Then $Result = $Geld3 + $GeldErbij Global $Geld3 = $Result ElseIf IsDeclared("Spelend4") = Not 0 And GUICtrlRead($Radio8) = 1 Then $Result = $Geld4 + $GeldErbij Global $Geld4 = $Result ElseIf GUICtrlRead($RadioBankOntv) = 0 Then MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden geladen welke radioknop is geselecteerd" & @CRLF & "bij de ontvangers" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox3.3") EndIf ElseIf GUICtrlRead($Radio4) = 1 Then $Result = $Geld4 - $GeldErbij $PreTransfer = $Geld4 Global $Geld4 = $Result ;===> Berekent de transactie $Failliet = 0 ;Nodig bij het bepalen of iemand failliet is (Begint bij de volgende regel) If $Geld4 < 0 And GUICtrlRead($Radio8) = $GUI_UNCHECKED Then $Schulden4 = True $GeldErbij = $PreTransfer ;Zorgt ervoor dat bij het overmaken aan de ander (zie beneden deze if's), dat de debtor alleen het geld krijgt die de schuldige ook echt heeft $Failliet = MsgBox(4, "Failliet", $Speler4 & " staat hierdoor in het rood." & @CRLF & "Wil je deze speler failliet verklaren?" & @CRLF & "(Als je op nee drukt, wordt het balans van " & $Speler4 & " teruggezet naar 0.") If $Spelers = 4 Then If $Failliet = 6 Then ;Als de speler op ja drukte bij vorige MsgBox GUICtrlSetState($Zender4, 128) GUICtrlSetState($Ontvanger4, 128) GUICtrlSetState($GeldStatus4, 128) GUICtrlSetState($Radio8, 128) $Spelend4 = 0 $Temp = $SpelersOver $SpelersOver = $Temp - 1 If $Spelend3 = 1 Then ;Hier checked hij de Radio die nog overblijft GUICtrlSetState($Radio3, 1) GUICtrlSetState($Radio4, 128) ElseIf $Spelend2 = 1 Then ;Hier checked hij de Radio die nog overblijft GUICtrlSetState($Radio2, 1) GUICtrlSetState($Radio4, 128) ElseIf $Spelend1 = 1 Then ;Hier checked(vinkt) hij de Radio die nog overblijft GUICtrlSetState($Radio1, 1) GUICtrlSetState($Radio4, 128) EndIf If $Spelend2 = 0 And $Spelend3 = 0 Then ;Bepaalt de winnaar MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler1 & "!") $Einde = True ElseIf $Spelend1 = 0 And $Spelend3 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler2 & "!") $Einde = True ElseIf $Spelend1 = 0 And $Spelend2 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler3 & "!") $Einde = True EndIf ElseIf $Failliet = 7 Then ;Als de speler op nee drukte $Geld4 = 0 Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden gelezen welke optie u gekozen heeft" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox4.1") EndIf Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden geladen hoeveel mensen er zijn" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox4.2") EndIf EndIf If GUICtrlRead($Radio5) = 1 Then $Result = $Geld1 + $GeldErbij Global $Geld1 = $Result ElseIf GUICtrlRead($Radio6) = 1 Then $Result = $Geld2 + $GeldErbij Global $Geld2 = $Result ElseIf IsDeclared("Spelend3") = Not 0 And GUICtrlRead($Radio7) = 1 Then $Result = $Geld3 + $GeldErbij Global $Geld3 = $Result ElseIf IsDeclared("Spelend4") = Not 0 And GUICtrlRead($Radio8) = 1 Then $Result = $Geld4 + $GeldErbij Global $Geld4 = $Result ElseIf GUICtrlRead($RadioBankOntv) = 0 Then MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden geladen welke radioknop is geselecteerd" & @CRLF & "bij de ontvangers" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox4.3") EndIf ElseIf GUICtrlRead($RadioBankVerz) = 1 Then If GUICtrlRead($Radio5) = 1 Then $Result = $Geld1 + $GeldErbij Global $Geld1 = $Result ElseIf GUICtrlRead($Radio6) = 1 Then $Result = $Geld2 + $GeldErbij Global $Geld2 = $Result ElseIf IsDeclared("Spelend3") = Not 0 And GUICtrlRead($Radio7) = 1 Then $Result = $Geld3 + $GeldErbij Global $Geld3 = $Result ElseIf IsDeclared("Spelend4") = Not 0 And GUICtrlRead($Radio8) = 1 Then $Result = $Geld4 + $GeldErbij Global $Geld4 = $Result ElseIf GUICtrlRead($RadioBankOntv) = 0 Then MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden geladen welke radioknop is geselecteerd" & @CRLF & "bij de ontvangers" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox4.3") EndIf EndIf If $Verzender <> $Ontvanger Then For $x = 10 to 1 Step -1 $PayH[$x] = $PayH[$x-1] GUICtrlSetData($PayHLabel[$x-1], $PayH[$x-1]) Next ; $PayH[9] = $PayH[8] ; GUICtrlSetData($PayHLabel[9], $PayH[9]) ; $PayH[8] = $PayH[7] ; GUICtrlSetData($PayHLabel[8], $PayH[8]) ; $PayH[7] = $PayH[6] ; GUICtrlSetData($PayHLabel[7], $PayH[7]) ; $PayH[6] = $PayH[5] ; GUICtrlSetData($PayHLabel[6], $PayH[6]) ; $PayH[5] = $PayH[4] ; GUICtrlSetData($PayHLabel[5], $PayH[5]) ; $PayH[4] = $PayH[3] ; GUICtrlSetData($PayHLabel[4], $PayH[4]) ; $PayH[3] = $PayH[2] ; GUICtrlSetData($PayHLabel[3], $PayH[4]) ; $PayH[2] = $PayH[1] ; GUICtrlSetData($PayHLabel[2], $PayH[2]) ; $PayH[1] = $PayH[0] ; GUICtrlSetData($PayHLabel[1], $PayH[1]);==Alles opschuiven (ja dit kan in een for loop) $PayH[1] = $Verzender & " aan " & $Ontvanger & ": ₩" & $GeldErbij GUICtrlSetData($PayHLabel[1], $PayH[1]) If $Failliet = 6 Then GUICtrlSetColor($PayHLabel[1], $COLOR_RED) Else GUICtrlSetColor($PayHLabel[1], $COLOR_BLACK) EndIf EndIf EndFunc ;===> Berekent hoe de dikke stacks flowen boii I am not automating a game. I am replacing that money device for Monopoly, which let's you pay digitally. Mine is broken. Personal use only. -
Create different labels within a For Loop
Silas replied to Silas's topic in AutoIt General Help and Support
I hope you will get me now. I am probably thinking too difficult or something. -
Create different labels within a For Loop
Silas replied to Silas's topic in AutoIt General Help and Support
Then I should have something like For $x = 1 to 10 $PayH[$x] = $PayH[$x+1] GUICtrlSetData($PayHLabel[$x], $PayH[$x]) Next to make it go in the right order. But [$x + 1] creates the same error. Whatever I do, one of the two values in the second line will create an error. -
Create different labels within a For Loop
Silas replied to Silas's topic in AutoIt General Help and Support
I understand the arrays better now, but my situation is really limiting. Although, so it seems to me. I am a bit confused now on how I can solve it. I can't go from 0 to 9, and the referencing part is not part of my problem, as far as I know. The code I provided earlier is exactly what should happen, although I think that is obvious. If any of you has the time and is so kind to give an example of how the code should look like, that would be great. Favorably, with the code I provided earlier. I think that if I can see what is different I will understand what you guys are trying to say to me. Thanks for the help so far guys, you keep the world spinning. -
Create different labels within a For Loop
Silas replied to Silas's topic in AutoIt General Help and Support
Alright I run into another problem, beginning with these codes: For $x = 10 to 1 Step -1 $PayH[$x] = $PayH[$x-1] GUICtrlSetData($PayHLabel[$x], $PayH[$x]) Next I noticed in BrewManNH's post, he used [$i - 1] , otherwise it created an error: "Array variable has incorrect number of subscripts or subscript dimension range exceeded." But why is that? If (in my case) $x = 10, then $PayH[10] is still in the range right? I even declared $PayH[10] before that. Still, I get the error. And now that's a problem, because I need to make item 10 equal to 9, and after that item 9 equal to 8, etc, so that every transaction value shifts one spot. So basically, I need to do $PayH[10]=$PayH[9] and after that $PayH[9] = $PayH[8]. And okay, perhaps he goes till 10 if you say 1 tot 10, so if 10 doesn't exists because of that, $PayH[9]=$PayH[8] would still be an option, right? So, in order to do that I need to do $PayH[$x - 1] = $PayH[$x - 2]. But AutoIt doesn't like [$x - 2], and gives me an error. Do you guys know a way around this? I hope I explained well. The thing I am trying to do here, is to shift all the 10 items in an array one place up, and replace ...[0] with a new, freshly made value (the most recent transaction). Edit: this is the code I am trying to convert into a for loop: $PayH[9] = $PayH[8] GUICtrlSetData($PayHLabel[9], $PayH[9]) $PayH[8] = $PayH[7] GUICtrlSetData($PayHLabel[8], $PayH[8]) $PayH[7] = $PayH[6] GUICtrlSetData($PayHLabel[7], $PayH[7]) $PayH[6] = $PayH[5] GUICtrlSetData($PayHLabel[6], $PayH[6]) $PayH[5] = $PayH[4] GUICtrlSetData($PayHLabel[5], $PayH[5]) $PayH[4] = $PayH[3] GUICtrlSetData($PayHLabel[4], $PayH[4]) $PayH[3] = $PayH[2] GUICtrlSetData($PayHLabel[3], $PayH[3]) $PayH[2] = $PayH[1] GUICtrlSetData($PayHLabel[2], $PayH[2]) $PayH[1] = $PayH[0] GUICtrlSetData($PayHLabel[1], $PayH[1]) -
Create different labels within a For Loop
Silas replied to Silas's topic in AutoIt General Help and Support
Damn Daniel, why didn't I see this? Thanks you all -
Create different labels within a For Loop
Silas replied to Silas's topic in AutoIt General Help and Support
Sorry for the late answer This worked for me, thanks! I am only trying to show the 10 latest transactions. Do you mean that be a problem with this script? Edit: I am trying to create the labels with different top and left values, by using 30 (standard left value) + [$i]*10 . However, this creates a syntax error. How can that be? [$i] will be replaced with 1 or 2 etc right? -
Hello Internet, I am trying to create 10 labels, which all show a history of transactions, in order. Problem is, it get's confused when I try to use [$i] to create different variables. How can I create different labels and thus variables with this? For $i=1 to 10 Assign("PayH_" & $i, 20) ;Creates the variables for the values Global $PayHLabel_[$i] = GUICtrlCreateLabel($PayH_[$i], 30, 30) ;Creates the labels which show the values Next I know I can do this without a For Loop, but I am trying to learn how to keep my script short. Thanks in advance.
-
Thank's for your reply, but how is Select different from Switch?
-
Hello everone, I'm creating a GUI, with radios. Radio's working, everything is fine. Here's a part of my script: $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button_Transfer If GUICtrlRead($Input)= Not "" And $Einde = False Then Transfer() Case $Radio1 If $SpelersOver=2 And $Einde=0 Then GUICtrlSetState($Radio6,1) Case $Radio2 If $SpelersOver=2 And $Einde=0 Then GUICtrlSetState($Radio5,1) Case $Radio3 If $SpelersOver=2 And $Einde=0 Then GUICtrlSetState($Radio5,1) Case $Radio4 If $SpelersOver=2 And $Einde=0 Then GUICtrlSetState($Radio5,1) Case $Radio5 If $SpelersOver=2 And $Einde=0 Then GUICtrlSetState($Radio2,1) Case $Radio6 If $SpelersOver=2 And $Einde=0 Then GUICtrlSetState($Radio1,1) Case $Radio7 If $SpelersOver=2 And $Einde=0 Then GUICtrlSetState($Radio5,1) Case $Radio8 If $SpelersOver=2 And $Einde=0 Then GUICtrlSetState($Radio5,1) ; Case $Button_Undo ; Something Case $Button_Return MsgBox(4, "Waarschuwing", "Als je teruggaat, verlies je alle voortgang." & @CRLF & "Wil je doorgaan?") Start() EndSwitch My problem: If I load the complete script with only 2 players, Radio 3,4,5 and 6 aren't loaded, and thus the script gives an error while loading the script above. I can and have used IsDeclared(), but how can I insert the IsDeclared part into this swith? Something like Case $Radio2 if IsDeclared("PLayer3")=1 If $SpelersOver=2 And $Einde=0 Then GUICtrlSetState($Radio5,1) Thanks in advance, Silas
-
Thanks evryone for your help. I can continue now. I will try the way in which the commands are checked, that one seems the most solid to me. However, Simpel's post may also work. I will try both.
-
Alright, I tried to copy paste some things, but the script looks really weird without the context. #include <ButtonConstants.au3> ;===========Includers #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <EditConstants.au3> #include <Misc.au3> $WBreedte = 306 ;width $WHoogte = 165 ;height Global $Window = GUICreate("MonoBank - Start", $WBreedte, $WHoogte, @DesktopWidth / 2 - ($WBreedte / 2), @DesktopHeight / 2 - ($WHoogte / 2), $GUI_SS_DEFAULT_GUI) GUISetFont(12, 400, 0, "Arial") GUISetState(@SW_SHOW) ;==== I only added this old window so that the following codes still work $Spelers=2 $Speler1=1 $Speler2=1 $Geld1=1500 $Geld2=1500 ;== Variables used later in this script Global $WhileH = 1 ;(Part of bigger thing in the whole script) Global $SpelersOver = 2 #Region ;Al het toevoegen (all the creating of the GUI) Global $Startbedrag = 1500 Global $Einde = False $WBreedte =508 $WHoogte = 360 $X_Undo = 218 $X_Input = 271 $X_Transfer = 418 Global $Spelend1 = 1 Global $Spelend2 = 1 WinMove($Window, "", @DesktopWidth / 2 - ($WBreedte / 2), @DesktopHeight / 2 - ($WHoogte / 2), $WBreedte, $WHoogte) Global $Zender1 = GUICtrlCreateLabel($Speler1, 222, 52, 105, 36, BitOR($WS_GROUP, $SS_CENTER)) GUICtrlSetFont(-1, 20, 400, 0, "Arial") GUICtrlSetColor(-1, 0x4286f4) Global $Zender2 = GUICtrlCreateLabel($Speler2, 360, 52, 105, 36, BitOR($WS_GROUP, $SS_CENTER)) GUICtrlSetFont(-1, 20, 400, 0, "Arial") GUICtrlSetColor(-1, 0xea3838) Global $GeldStatus1 = GUICtrlCreateLabel("?" & $Geld1, 222, 18, 105, 31, $SS_CENTER) GUICtrlSetFont(-1, 18, 400, 0, "Arial") Global $GeldStatus2 = GUICtrlCreateLabel("?" & $Geld2, 360, 18, 105, 31, $SS_CENTER) GUICtrlSetFont(-1, 18, 400, 0, "Arial") Global $Ontvanger1 = GUICtrlCreateLabel($Speler1, 222, 241, 105, 36, BitOR($WS_GROUP, $SS_CENTER)) GUICtrlSetFont(-1, 20, 400, 0, "Arial") GUICtrlSetColor(-1, 0x4286f4) Global $Ontvanger2 = GUICtrlCreateLabel($Speler2, 360, 241, 105, 36, BitOR($WS_GROUP, $SS_CENTER)) GUICtrlSetFont(-1, 20, 400, 0, "Arial") GUICtrlSetColor(-1, 0xea3838) GUIStartGroup() Global $Radio1 = GUICtrlCreateRadio("", 266, 99, 21, 21, BitOR($BS_AUTORADIOBUTTON,$BS_TOP)) GUICtrlSetCursor (-1, 0) Global $Radio2 = GUICtrlCreateRadio("", 404, 99, 21, 21, BitOR($BS_AUTORADIOBUTTON,$BS_TOP)) GUICtrlSetCursor (-1, 0) GUIStartGroup() Global $Radio5 = GUICtrlCreateRadio("", 266, 288, 21, 21, BitOR($BS_AUTORADIOBUTTON,$BS_TOP)) GUICtrlSetCursor (-1, 0) Global $Radio6 = GUICtrlCreateRadio("", 404, 288, 21, 21, BitOR($BS_AUTORADIOBUTTON,$BS_TOP)) GUICtrlSetCursor (-1, 0) Global $Input = GUICtrlCreateInput("", $X_Input, 153, 144, 50, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$ES_NUMBER,$WS_GROUP)) GUICtrlSetFont(-1, 28, 400, 0, "Arial") GUICtrlSetCursor (-1, 5) GUICtrlSetLimit(-1, 6) Global $Button_Transfer = GUICtrlCreateButton("OK", $X_Transfer, 153, 50, 50, BitOR($WS_GROUP, $BS_DEFPUSHBUTTON)) GUICtrlSetCursor(-1, 0) Global $Button_Undo = GUICtrlCreateButton("<", $X_Undo, 153, 50, 50, $WS_GROUP) GUICtrlSetCursor(-1, 0) #EndRegion (creating GUI) While $WhileH $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button_Transfer If GUICtrlRead($Input)= Not "" And $Einde = False Then ;Transfer() EndIf ; Case $Button_Undo ; Sumsing ;Case $Button_Return ; MsgBox(4, "Waarschuwing", "Als je teruggaat, verlies je alle voortgang en krijgt iedereen weer het standaard bedrag." & @CRLF & "Wil je doorgaan?") ;Warning box. About losing progress ; Start() EndSwitch If $SpelersOver=2 Then If $Spelers=2 Then If GUICtrlRead($Radio1)=1 And Not BitAND(GUICtrlGetState($Radio6),1) And Not BitAND(GUICtrlGetState($Radio5),1) Then GUICtrlSetState($Radio6,1) If GUICtrlRead($Radio2)=1 And Not BitAND(GUICtrlGetState($Radio5),1) And Not BitAND(GUICtrlGetState($Radio6),1) Then GUICtrlSetState($Radio5,1) If GUICtrlRead($Radio5)=1 And Not BitAND(GUICtrlGetState($Radio2),1) And Not BitAND(GUICtrlGetState($Radio1),1) Then GUICtrlSetState($Radio2,1) If GUICtrlRead($Radio6)=1 And Not BitAND(GUICtrlGetState($Radio1),1) And Not BitAND(GUICtrlGetState($Radio2),1) Then GUICtrlSetState($Radio1,1) EndIf EndIf WEnd If some things aren't clear: here's the whole script. ;Ideeën: ; - Bij instellen namen, kies ook pion/naam van pion, en kleur? ; - Startbedrag ; - Beginscherm en namen ook groter font maken, zodat iedereen het goed kan lezen ; - Terugknop omzetten in pijl terug: ;$Pic_Return = GUICtrlCreateIcon("C:\Users\Silas\Desktop\Terugknop.bmp", 0, 0,40,20) ;If @error Then ;MsgBox(0, "", @error) ; EndIf ; - Versimpel script (duidelijker maken, uitleggen, maak van Namen2-4 1 func etc ; - De naam en radio samenvoegen in 1, doorzichtige knop ; - Leg script uit met dit soort tekst #include <ButtonConstants.au3> ;===========Includers #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <EditConstants.au3> #include <Misc.au3> Start() Func Start() ;===========Startscherm (hoeveel spelers er zijn) $WBreedte = 306 $WHoogte = 165 Global $Window = GUICreate("MonoBank - Start", $WBreedte, $WHoogte, @DesktopWidth / 2 - ($WBreedte / 2), @DesktopHeight / 2 - ($WHoogte / 2), $GUI_SS_DEFAULT_GUI) GUISetFont(12, 400, 0, "Arial") Global $Label_Spelers = GUICtrlCreateLabel("Welkom, met hoeveel spelers zijn jullie?", 16, 16, 277, 22) Global $Radio2 = GUICtrlCreateRadio("2 Spelers", 32, 56, 113, 17) GUICtrlSetCursor(-1, 0) Global $Radio3 = GUICtrlCreateRadio("3 Spelers", 32, 88, 113, 17) GUICtrlSetCursor(-1, 0) Global $Radio4 = GUICtrlCreateRadio("4 Spelers", 32, 120, 113, 17) GUICtrlSetCursor(-1, 0) Global $Button_Next = GUICtrlCreateButton("Volgende", 184, 125, 97, 25, $BS_DEFPUSHBUTTON) GUICtrlSetFont(-1, 11, 400, 0, "Arial") GUICtrlSetCursor(-1, 0) GUISetState(@SW_SHOW) Global $While1=1 While $While1 ;===========Wat te doen bij startscherm $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button_Next If GUICtrlRead($Radio2) = 1 or GUICtrlRead($Radio3) = 1 or GUICtrlRead($Radio4) = 1 Then Ctr_Radio() ;Verwijst naar controle van de opties Else MsgBox($MB_OK, "Niet zo snel", "Voer eerst in met hoeveel spelers jullie zijn") ;Foutmelding EndIf EndSwitch Wend EndFunc ;==>Start Func Ctr_Radio() ;===========Controlleert welke optie gekozen is, en verwijst door naar toepassende venster If GUICtrlRead($Radio2) = 1 Then Global $Spelers = 2 Namen2() ElseIf GUICtrlRead($Radio3) = 1 Then Global $Spelers = 3 Namen3() ElseIf GUICtrlRead($Radio4) = 1 Then Global $Spelers = 4 Namen4() Else MsgBox($MB_OK, "Hosuton, we got a problem", "Er kon niet gelezen worden welke optie je gekozen hebt." & @CRLF & "Foutcode: " & @error) ;Foutmelding, lijkt me duidelijk EndIf EndFunc ;==>Ctr_Radio Func Namen2() ;===========Venster waarbij je namen kiest voor 2 spelers WinSetTitle($Window, "", "MonoBank - Namen") GUICtrlDelete($Label_Spelers) GUICtrlDelete($Radio2) GUICtrlDelete($Radio3) GUICtrlDelete($Radio4) GUICtrlDelete($Button_Next) Global $Label_Namen = GUICtrlCreateLabel("Hoe zal ik jullie noemen?", 71, 15) Global $Label1 = GUICtrlCreateLabel("Speler 1", 62, 64, 63, 22, $WS_GROUP) GUICtrlSetColor(-1, 0x4286f4) Global $Input1 = GUICtrlCreateInput("", 38, 90, 105, 24, BitOR($ES_AUTOHSCROLL, $WS_GROUP)) GUICtrlSetFont(-1, 10, 400, 0, "Arial") GUICtrlSetCursor(-1, 5) Global $Label2 = GUICtrlCreateLabel("Speler 2", 198, 64, 63, 22, $WS_GROUP) GUICtrlSetColor(-1, 0xea3838) Global $Input2 = GUICtrlCreateInput("", 174, 90, 105, 24, BitOR($ES_AUTOHSCROLL, $WS_GROUP)) GUICtrlSetFont(-1, 10, 400, 0, "Arial") GUICtrlSetCursor(-1, 5) Global $Button_Next = GUICtrlCreateButton("Start", 306 / 2 - 42, 125, 97, 25, $BS_DEFPUSHBUTTON) GUICtrlSetFont(-1, 11, 400, 0, "Arial") GUICtrlSetCursor(-1, 0) Global $Button_Return = GUICtrlCreateButton("<", 0, 0, 25, 25, $WS_GROUP) GUICtrlSetFont(-1, 11, 400, 0, "Arial") GUICtrlSetCursor(-1, 0) Global $While1 = 0 Global $While2 = 1 While $While2 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit ;Case $Button_Return ; Start() Case $Button_Next If GUICtrlRead($Input1) = "" and GUICtrlRead($Input2) = "" Then MsgBox(0, "Niet zo snel", "Ik ken niemand die geen naam heeft") ElseIf GUICtrlRead($Input1) = "" Or GUICtrlRead($Input2) = "" Then MsgBox(0, "Niet zo snel", "Je moet wel voor beide personen een naam invoeren") Else Global $Speler1 = GUICtrlRead($Input1) Global $Speler2 = GUICtrlRead($Input2) Hoofdscherm() EndIf EndSwitch WEnd EndFunc ;==>Namen2 Func Namen3() ;===========Venster waarbij je namen kiest voor 3 spelers $WBreedte = 423 $WHoogte = 220 WinMove($Window, "", @DesktopWidth / 2 - ($WBreedte / 2), @DesktopHeight / 2 - ($WHoogte / 2), $WBreedte, $WHoogte) WinSetTitle($Window, "", "MonoBank - Namen") GUICtrlDelete($Label_Spelers) GUICtrlDelete($Radio2) GUICtrlDelete($Radio3) GUICtrlDelete($Radio4) GUICtrlDelete($Button_Next) Global $Label_Namen = GUICtrlCreateLabel("Hoe zal ik jullie noemen?", 127, 24, 175, 22, $WS_GROUP) Global $Label1 = GUICtrlCreateLabel("Speler 1", 64, 64, 63, 22, $WS_GROUP) GUICtrlSetColor(-1, 0x4286f4) Global $Input1 = GUICtrlCreateInput("", 40, 96, 105, 24, BitOR($ES_AUTOHSCROLL, $WS_GROUP)) GUICtrlSetFont(-1, 10, 400, 0, "Arial") GUICtrlSetCursor(-1, 5) Global $Label2 = GUICtrlCreateLabel("Speler 2", 184, 64, 63, 22, $WS_GROUP) GUICtrlSetColor(-1, 0xea3838) Global $Input2 = GUICtrlCreateInput("", 160, 96, 105, 24, BitOR($ES_AUTOHSCROLL, $WS_GROUP)) GUICtrlSetFont(-1, 10, 400, 0, "Arial") GUICtrlSetCursor(-1, 5) Global $Label3 = GUICtrlCreateLabel("Speler 3", 304, 64, 63, 22, $WS_GROUP) GUICtrlSetColor(-1, 0x10cc38) Global $Input3 = GUICtrlCreateInput("", 281, 96, 105, 24, BitOR($ES_AUTOHSCROLL, $WS_GROUP)) GUICtrlSetFont(-1, 10, 400, 0, "Arial") GUICtrlSetCursor(-1, 5) Global $Button_Next = GUICtrlCreateButton("Start", 166, 144, 97, 25, BitOR($WS_GROUP, $BS_DEFPUSHBUTTON)) GUICtrlSetFont(-1, 11, 400, 0, "Arial") GUICtrlSetCursor(-1, 0) Global $Button_Return = GUICtrlCreateButton("<", 0, 0, 25, 25, $WS_GROUP) GUICtrlSetFont(-1, 11, 400, 0, "Arial") GUICtrlSetCursor(-1, 0) Global $While1 = 0 Global $While2 = 1 While $While2 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button_Next If GUICtrlRead($Input1) = "" and GUICtrlRead($Input2) = "" And GUICtrlRead($Input3) = "" Then MsgBox(0, "Niet zo snel", "Ik ken niemand die geen naam heeft") ElseIf GUICtrlRead($Input1) = "" Or GUICtrlRead($Input2) = "" Or GUICtrlRead($Input3) = "" Then MsgBox(0, "Niet zo snel", "Je moet wel alle namen invoeren") Else Global $Speler1 = GUICtrlRead($Input1) Global $Speler2 = GUICtrlRead($Input2) Global $Speler3 = GUICtrlRead($Input3) Hoofdscherm() EndIf EndSwitch WEnd EndFunc ;==>Namen3 Func Namen4() ;===========Venster waarbij je namen kiest voor 4 spelers $WBreedte = 546 $WHoogte = 220 WinMove($Window, "", @DesktopWidth / 2 - ($WBreedte / 2), @DesktopHeight / 2 - ($WHoogte / 2), $WBreedte, $WHoogte) WinSetTitle($Window, "", "MonoBank - Namen") GUICtrlDelete($Label_Spelers) GUICtrlDelete($Radio2) GUICtrlDelete($Radio3) GUICtrlDelete($Radio4) GUICtrlDelete($Button_Next) Global $Label_Namen = GUICtrlCreateLabel("Hoe zal ik jullie noemen?", 185, 24, 175, 22, $WS_GROUP) Global $Label1 = GUICtrlCreateLabel("Speler 1", 64, 64, 63, 22, $WS_GROUP) GUICtrlSetColor(-1, 0x4286f4) Global $Input1 = GUICtrlCreateInput("", 40, 96, 105, 24, BitOR($ES_AUTOHSCROLL, $WS_GROUP)) GUICtrlSetFont(-1, 10, 400, 0, "Arial") GUICtrlSetCursor(-1, 5) Global $Label2 = GUICtrlCreateLabel("Speler 2", 184, 64, 63, 22, $WS_GROUP) GUICtrlSetColor(-1, 0xea3838) Global $Input2 = GUICtrlCreateInput("", 160, 96, 105, 24, BitOR($ES_AUTOHSCROLL, $WS_GROUP)) GUICtrlSetFont(-1, 10, 400, 0, "Arial") GUICtrlSetCursor(-1, 5) Global $Label3 = GUICtrlCreateLabel("Speler 3", 304, 64, 63, 22, $WS_GROUP) GUICtrlSetColor(-1, 0x10cc38) Global $Input3 = GUICtrlCreateInput("", 281, 96, 105, 24, BitOR($ES_AUTOHSCROLL, $WS_GROUP)) GUICtrlSetFont(-1, 10, 400, 0, "Arial") GUICtrlSetCursor(-1, 5) Global $Label4 = GUICtrlCreateLabel("Speler 4", 424, 64, 63, 22, $WS_GROUP) GUICtrlSetColor(-1, 0xdbd82b) Global $Input4 = GUICtrlCreateInput("", 402, 96, 105, 24, BitOR($ES_AUTOHSCROLL, $WS_GROUP)) GUICtrlSetFont(-1, 10, 400, 0, "Arial") GUICtrlSetCursor(-1, 5) Global $Button_Next = GUICtrlCreateButton("Start", 224, 144, 97, 25, BitOR($WS_GROUP, $BS_DEFPUSHBUTTON)) GUICtrlSetFont(-1, 11, 400, 0, "Arial") GUICtrlSetCursor(-1, 0) Global $Button_Return = GUICtrlCreateButton("<", 0, 0, 25, 25, $WS_GROUP) GUICtrlSetFont(-1, 11, 400, 0, "Arial") GUICtrlSetCursor(-1, 0) Global $While1 = 0 Global $While2 = 1 While $While2 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button_Next If GUICtrlRead($Input1) = "" And GUICtrlRead($Input2) = "" And GUICtrlRead($Input3) = "" And GUICtrlRead($Input4) = "" Then MsgBox(0, "Niet zo snel", "Ik ken niemand die geen naam heeft") ElseIf GUICtrlRead($Input1) = "" Or GUICtrlRead($Input2) = "" Or GUICtrlRead($Input3) = "" Or GUICtrlRead($Input4) = "" Then MsgBox(0, "Niet zo snel", "Je moet wel alle namen invoeren") Else Global $Speler1 = GUICtrlRead($Input1) Global $Speler2 = GUICtrlRead($Input2) Global $Speler3 = GUICtrlRead($Input3) Global $Speler4 = GUICtrlRead($Input4) Hoofdscherm() EndIf EndSwitch WEnd EndFunc ;==>Namen4 Func Hoofdscherm() ;===========Het venster waar het allemaal gebeurt #Region ;Al het verwijderen WinSetTitle($Window, "", "MonoBank") GUICtrlDelete($Button_Next) ;GUICtrlDelete($Button_Return) GUICtrlDelete($Label1) GUICtrlDelete($Label2) If IsDeclared("Label3") = Not 0 Then GUICtrlDelete($Label3) EndIf If IsDeclared("Label4") = Not 0 Then GUICtrlDelete($Label4) EndIf GUICtrlDelete($Input1) GUICtrlDelete($Input2) If IsDeclared("Input3") = Not 0 Then GUICtrlDelete($Input3) EndIf If IsDeclared("Input4") = Not 0 Then GUICtrlDelete($Input4) EndIf GUICtrlDelete($Label_Namen) ;============= Nu is alles prachtig mooi opgruimt #EndRegion #Region ;Al het toevoegen Global $Startbedrag = 1500 Global $Einde = False If $Spelers = 2 Then $WBreedte =508 $X_Undo = 218 $X_Input = 271 $X_Transfer = 418 Global $Geld1 = $Startbedrag Global $Geld2 = $Startbedrag Global $Spelend1 = 1 Global $Spelend2 = 1 ElseIf $Spelers = 3 Then $WBreedte = 623 $X_Undo = 288 $X_Input = 341 $X_Transfer = 488 Global $Geld1 = $Startbedrag Global $Geld2 = $Startbedrag Global $Geld3 = $Startbedrag Global $Spelend1 = 1 Global $Spelend2 = 1 Global $Spelend3 = 1 ElseIf $Spelers = 4 Then $WBreedte = 758 $X_Undo = 358 $X_Input = 411 $X_Transfer = 558 Global $Geld1 = $Startbedrag Global $Geld2 = $Startbedrag Global $Geld3 = $Startbedrag Global $Geld4 = $Startbedrag Global $Spelend1 = 1 Global $Spelend2 = 1 Global $Spelend3 = 1 Global $Spelend4 = 1 Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden geladen hoeveel spelers er zijn" & @CRLF & "Foutcode: " & @error) EndIf ;===================== Dit allemaal bepaalt de posities en andere dingen van bepaalde dingen, afhankelijk van het aantal spelers $WHoogte = 360 WinMove($Window, "", @DesktopWidth / 2 - ($WBreedte / 2), @DesktopHeight / 2 - ($WHoogte / 2), $WBreedte, $WHoogte) Global $Zender1 = GUICtrlCreateLabel($Speler1, 222, 52, 105, 36, BitOR($WS_GROUP, $SS_CENTER)) GUICtrlSetFont(-1, 20, 400, 0, "Arial") GUICtrlSetColor(-1, 0x4286f4) Global $Zender2 = GUICtrlCreateLabel($Speler2, 360, 52, 105, 36, BitOR($WS_GROUP, $SS_CENTER)) GUICtrlSetFont(-1, 20, 400, 0, "Arial") GUICtrlSetColor(-1, 0xea3838) If IsDeclared("Speler3") = Not 0 Then Global $Zender3 = GUICtrlCreateLabel($Speler3, 499, 52, 105, 36, BitOR($WS_GROUP, $SS_CENTER)) GUICtrlSetFont(-1, 20, 400, 0, "Arial") GUICtrlSetColor(-1, 0x10cc38) EndIf Global $GeldStatus1 = GUICtrlCreateLabel("₩" & $Geld1, 222, 18, 105, 31, $SS_CENTER) GUICtrlSetFont(-1, 18, 400, 0, "Arial") Global $GeldStatus2 = GUICtrlCreateLabel("₩" & $Geld2, 360, 18, 105, 31, $SS_CENTER) GUICtrlSetFont(-1, 18, 400, 0, "Arial") If IsDeclared("Speler3") = Not 0 Then Global $GeldStatus3 = GUICtrlCreateLabel("₩" & $Geld3, 499, 18, 105, 31, $SS_CENTER) GUICtrlSetFont(-1, 18, 400, 0, "Arial") EndIf If IsDeclared("Speler4") = Not 0 Then Global $GeldStatus4 = GUICtrlCreateLabel("₩" & $Geld4, 637, 18, 105, 31, $SS_CENTER) GUICtrlSetFont(-1, 18, 400, 0, "Arial") EndIf If IsDeclared("Speler4") = Not 0 Then Global $Zender4 = GUICtrlCreateLabel($Speler4, 637, 52, 105, 36, BitOR($WS_GROUP, $SS_CENTER)) GUICtrlSetFont(-1, 20, 400, 0, "Arial") GUICtrlSetColor(-1, 0xdbd82b) EndIf Global $Ontvanger1 = GUICtrlCreateLabel($Speler1, 222, 241, 105, 36, BitOR($WS_GROUP, $SS_CENTER)) GUICtrlSetFont(-1, 20, 400, 0, "Arial") GUICtrlSetColor(-1, 0x4286f4) Global $Ontvanger2 = GUICtrlCreateLabel($Speler2, 360, 241, 105, 36, BitOR($WS_GROUP, $SS_CENTER)) GUICtrlSetFont(-1, 20, 400, 0, "Arial") GUICtrlSetColor(-1, 0xea3838) If IsDeclared("Speler3") = Not 0 Then Global $Ontvanger3 = GUICtrlCreateLabel($Speler3, 499, 241, 105, 36, BitOR($WS_GROUP, $SS_CENTER)) GUICtrlSetFont(-1, 20, 400, 0, "Arial") GUICtrlSetColor(-1, 0x10cc38) EndIf If IsDeclared("Speler4") = Not 0 Then Global $Ontvanger4 = GUICtrlCreateLabel($Speler4, 637, 241, 105, 36, BitOR($WS_GROUP, $SS_CENTER)) GUICtrlSetFont(-1, 20, 400, 0, "Arial") GUICtrlSetColor(-1, 0xdbd82b) EndIf GUIStartGroup() Global $Radio1 = GUICtrlCreateRadio("", 266, 99, 21, 21, BitOR($BS_AUTORADIOBUTTON,$BS_TOP)) GUICtrlSetCursor (-1, 0) Global $Radio2 = GUICtrlCreateRadio("", 404, 99, 21, 21, BitOR($BS_AUTORADIOBUTTON,$BS_TOP)) GUICtrlSetCursor (-1, 0) If IsDeclared("Speler3") = Not 0 Then Global $Radio3 = GUICtrlCreateRadio("", 543, 99, 21, 21, BitOR($BS_AUTORADIOBUTTON,$BS_TOP)) GUICtrlSetCursor (-1, 0) EndIf If IsDeclared("Speler4") = Not 0 Then Global $Radio4 = GUICtrlCreateRadio("", 681, 99, 21, 21, BitOR($BS_AUTORADIOBUTTON,$BS_TOP)) GUICtrlSetCursor (-1, 0) EndIf GUIStartGroup() Global $Radio5 = GUICtrlCreateRadio("", 266, 288, 21, 21, BitOR($BS_AUTORADIOBUTTON,$BS_TOP)) GUICtrlSetCursor (-1, 0) Global $Radio6 = GUICtrlCreateRadio("", 404, 288, 21, 21, BitOR($BS_AUTORADIOBUTTON,$BS_TOP)) GUICtrlSetCursor (-1, 0) If IsDeclared("Speler3") = Not 0 Then Global $Radio7 = GUICtrlCreateRadio("", 543, 288, 21, 21, BitOR($BS_AUTORADIOBUTTON,$BS_TOP)) GUICtrlSetCursor (-1, 0) EndIf If IsDeclared("Speler4") = Not 0 Then Global $Radio8 = GUICtrlCreateRadio("", 681, 288, 21, 21, BitOR($BS_AUTORADIOBUTTON,$BS_TOP)) GUICtrlSetCursor (-1, 0) EndIf Global $Input = GUICtrlCreateInput("", $X_Input, 153, 144, 50, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$ES_NUMBER,$WS_GROUP)) GUICtrlSetFont(-1, 28, 400, 0, "Arial") GUICtrlSetCursor (-1, 5) GUICtrlSetLimit(-1, 6) Global $Button_Transfer = GUICtrlCreateButton("OK", $X_Transfer, 153, 50, 50, BitOR($WS_GROUP, $BS_DEFPUSHBUTTON)) GUICtrlSetCursor(-1, 0) Global $Button_Undo = GUICtrlCreateButton("<", $X_Undo, 153, 50, 50, $WS_GROUP) GUICtrlSetCursor(-1, 0) #EndRegion ;==================================================Doe een "veel plezier!" popup of zo, en ook zon soort popup in plaats van eens stom msgbox met WE HEBBEN EEN WINNAAR Global $While2 = 0 Global $WhileH = 1 If $Spelers = 2 Then Global $SpelersOver = 2 ElseIf $Spelers = 3 Then Global $SpelersOver = 3 ElseIf $Spelers = 4 Then Global $SpelersOver = 4 EndIf ;==> Dit stelt het de variable $Spelers in op het aantal spelers, zodat in de volgende while loop gechekt kan worden of er 2 spelers over zijn, waardoor de radio's zich slimmer gedragen While $WhileH $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button_Transfer If GUICtrlRead($Input)= Not "" And $Einde = False Then Transfer() EndIf ; Case $Button_Undo ; Sumsing Case $Button_Return MsgBox(4, "Waarschuwing", "Als je teruggaat, verlies je alle voortgang en krijgt iedereen weer het standaard bedrag." & @CRLF & "Wil je doorgaan?") Start() EndSwitch If GuiCtrlRead($GeldStatus1) <> "₩" & $Geld1 Then GUICtrlSetData($GeldStatus1, "₩" & $Geld1) If GuiCtrlRead($GeldStatus2) <> "₩" & $Geld2 Then GUICtrlSetData($GeldStatus2, "₩" & $Geld2) If IsDeclared("Speler3") = Not 0 And GuiCtrlRead($GeldStatus3) <> "₩" & $Geld3 Then GUICtrlSetData($GeldStatus3, "₩" & $Geld3) If IsDeclared("Speler4") = Not 0 And GuiCtrlRead($GeldStatus4) <> "₩" & $Geld4 Then GUICtrlSetData($GeldStatus4, "₩" & $Geld4) ;============= Updatet de geldstatussen meteen als een bedrag verandert If $SpelersOver=2 Then If $Spelers=2 Then If GUICtrlRead($Radio1)=1 And Not BitAND(GUICtrlGetState($Radio6),1) And Not BitAND(GUICtrlGetState($Radio5),1) Then GUICtrlSetState($Radio6,1) If GUICtrlRead($Radio2)=1 And Not BitAND(GUICtrlGetState($Radio5),1) And Not BitAND(GUICtrlGetState($Radio6),1) Then GUICtrlSetState($Radio5,1) If GUICtrlRead($Radio5)=1 And Not BitAND(GUICtrlGetState($Radio2),1) And Not BitAND(GUICtrlGetState($Radio1),1) Then GUICtrlSetState($Radio2,1) If GUICtrlRead($Radio6)=1 And Not BitAND(GUICtrlGetState($Radio1),1) And Not BitAND(GUICtrlGetState($Radio2),1) Then GUICtrlSetState($Radio1,1) ElseIf $Spelers=3 Then Exit ElseIf $Spelers=4 Then Exit EndIf EndIf ;Laat de radios slim wisselen tussen de 2 spelers die over zijn ; If GUICtrlRead($Radio1)=1 And Not BitAND(GUICtrlGetState($Radio5), $GUI_DISABLE) Then GUICtrlSetState($Radio5, 128) ; If GUICtrlRead($Radio1)<>1 And Not BitAND(GUICtrlGetState($Radio5), $GUI_ENABLE) And $Spelend1 = 1 Then GUICtrlSetState($Radio5, 64) ; If GUICtrlRead($Radio5)=1 And Not BitAND(GUICtrlGetState($Radio1), $GUI_DISABLE) Then GUICtrlSetState($Radio1, 128) ; If GUICtrlRead($Radio5)<>1 And Not BitAND(GUICtrlGetState($Radio1), $GUI_ENABLE) And $Spelend1 = 1 Then GUICtrlSetState($Radio1, 64) ; ; If GUICtrlRead($Radio2)=1 And Not BitAND(GUICtrlGetState($Radio6), $GUI_DISABLE) Then GUICtrlSetState($Radio6, 128) ; If GUICtrlRead($Radio2)<>1 And Not BitAND(GUICtrlGetState($Radio6), $GUI_ENABLE) And $Spelend2 = 1 Then GUICtrlSetState($Radio6, 64) ; If GUICtrlRead($Radio6)=1 And Not BitAND(GUICtrlGetState($Radio2), $GUI_DISABLE) Then GUICtrlSetState($Radio2, 128) ; If GUICtrlRead($Radio6)<>1 And Not BitAND(GUICtrlGetState($Radio2), $GUI_ENABLE) And $Spelend2 = 1 Then GUICtrlSetState($Radio2, 64) ; ; If IsDeclared("Speler3") Then ; If GUICtrlRead($Radio3)=1 And Not BitAND(GUICtrlGetState($Radio7), $GUI_DISABLE) Then GUICtrlSetState($Radio7, 128) ; If GUICtrlRead($Radio3)<>1 And Not BitAND(GUICtrlGetState($Radio7), $GUI_ENABLE) And $Spelend3 = 1 Then GUICtrlSetState($Radio7, 64) ; If GUICtrlRead($Radio7)=1 And Not BitAND(GUICtrlGetState($Radio3), $GUI_DISABLE) Then GUICtrlSetState($Radio3, 128) ; If GUICtrlRead($Radio7)<>1 And Not BitAND(GUICtrlGetState($Radio3), $GUI_ENABLE) And $Spelend3 = 1 Then GUICtrlSetState($Radio3, 64) ; EndIf ; ; If IsDeclared("Speler4") Then ; If GUICtrlRead($Radio4)=1 And Not BitAND(GUICtrlGetState($Radio8), $GUI_DISABLE) Then GUICtrlSetState($Radio8, 128) ; If GUICtrlRead($Radio4)<>1 And Not BitAND(GUICtrlGetState($Radio8), $GUI_ENABLE) And $Spelend4 = 1 Then GUICtrlSetState($Radio8, 64) ; If GUICtrlRead($Radio8)=1 And Not BitAND(GUICtrlGetState($Radio4), $GUI_DISABLE) Then GUICtrlSetState($Radio4, 128) ; If GUICtrlRead($Radio8)<>1 And Not BitAND(GUICtrlGetState($Radio4), $GUI_ENABLE) And $Spelend4 = 1 Then GUICtrlSetState($Radio4, 64) ; EndIf ; ;============= Schakelt botsende radio's uit WEnd EndFunc Func Transfer() ;====== Kijkt welke zender is geselecteerd > berekent kosten > bekijkt welke ontvanger is geselecteerd > berekent inkomen en ondertussen checkt hij wanneer iemand gewonnen heeft $GeldErbij = GUICtrlRead($Input) $Schulden1 = False If GUICtrlRead($Radio1) = 1 Then $Result = $Geld1 - $GeldErbij $PreTransfer = $Geld1 Global $Geld1 = $Result ;===> Berekent de transactie $Failliet = 0 ;Nodig bij het bepalen of iemand failliet is (Begint bij de volgende regel) If $Geld1 < 0 Then $Schulden1 = True $GeldErbij = $PreTransfer ;Zorgt ervoor dat bij het overmaken aan de ander (zie beneden deze if's), dat de debtor alleen het geld krijgt die de schuldige ook echt heeft $Failliet = MsgBox(4, "Failliet", $Speler1 & " staat op dit moment in het rood." & @CRLF & "Wil je deze speler failliet verklaren?" & @CRLF & "(Als je op nee drukt, wordt het balans van " & $Speler1 & " teruggezet naar 0.") If $Spelers = 2 Then If $Failliet = 6 Then ;Als de speler op ja drukte bij vorige MsgBox GUICtrlSetState($Radio2, 1) GUICtrlSetState($Radio1, 128) GUICtrlSetState($Zender1, 128) GUICtrlSetState($Ontvanger1, 128) GUICtrlSetState($GeldStatus1, 128) GUICtrlSetState($Radio5, 128) $Spelend1 = 0 $Einde = True MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler2 & "!") ElseIf $Failliet = 7 Then ;Als de speler op nee drukte $Geld1 = 0 Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden gelezen welke optie u gekozen heeft" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox1.1") ;Ik label elke msgbox die een foutcode geeft op deze manier, dan kun je makkelijker vinden waar de fout zich voordeet EndIf ElseIf $Spelers = 3 Then If $Failliet = 6 Then ;Als de speler op ja drukte bij vorige MsgBox GUICtrlSetState($Zender1, 128) GUICtrlSetState($Ontvanger1, 128) GUICtrlSetState($GeldStatus1, 128) GUICtrlSetState($Radio5, 128) $Spelend1 = 0 If $Spelend2 = 1 Then ;Hier checkedt hij de Radio die nog overblijft GUICtrlSetState($Radio2, 1) GUICtrlSetState($Radio1, 128) ElseIf $Spelend3 = 1 Then ;Hier checkedt hij de Radio die nog overblijft GUICtrlSetState($Radio3, 1) GUICtrlSetState($Radio1, 128) EndIf If $Spelend3 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler2 & "!") $Einde = True ElseIf $Spelend2 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler3 & "!") $Einde = True EndIf ElseIf $Failliet = 7 Then ;Als de speler op nee drukte $Geld1 = 0 Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden gelezen welke optie u gekozen heeft" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox1.2") EndIf ElseIf $Spelers = 4 Then If $Failliet = 6 Then ;Als de speler op ja drukte bij vorige MsgBox GUICtrlSetState($Zender1, 128) GUICtrlSetState($Ontvanger1, 128) GUICtrlSetState($GeldStatus1, 128) GUICtrlSetState($Radio5, 128) $Spelend1 = 0 If $Spelend2 = 1 Then ;Hier checkedt(vinkt) hij de Radio die nog overblijft GUICtrlSetState($Radio2, 1) GUICtrlSetState($Radio1, 128) ElseIf $Spelend3 = 1 Then ;Hier checkedt hij de Radio die nog overblijft GUICtrlSetState($Radio3, 1) GUICtrlSetState($Radio1, 128) ElseIf $Spelend4 = 1 Then ;Hier checkedt hij de Radio die nog overblijft GUICtrlSetState($Radio4, 1) GUICtrlSetState($Radio1, 128) EndIf If $Spelend3 = 0 And $Spelend4 = 0 Then ;Hier checkt hij of iemand gewonnen heeft MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler2 & "!") $Einde = True ElseIf $Spelend2 = 0 And $Spelend4 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler3 & "!") $Einde = True ElseIf $Spelend2 = 0 And $Spelend3 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler4 & "!") $Einde = True EndIf ElseIf $Failliet = 7 Then ;Als de speler op nee drukte $Geld1 = 0 Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden gelezen welke optie u gekozen heeft" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox1.3") EndIf Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden geladen hoeveel mensen er zijn" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox1.4") EndIf EndIf If GUICtrlRead($Radio5) = 1 Then $Result = $Geld1 + $GeldErbij Global $Geld1 = $Result ElseIf GUICtrlRead($Radio6) = 1 Then $Result = $Geld2 + $GeldErbij Global $Geld2 = $Result ElseIf IsDeclared("Speler3") = Not 0 And GUICtrlRead($Radio7) = 1 Then $Result = $Geld3 + $GeldErbij Global $Geld3 = $Result ElseIf IsDeclared("Speler4") = Not 0 And GUICtrlRead($Radio8) = 1 Then $Result = $Geld4 + $GeldErbij Global $Geld4 = $Result Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden geladen welke radioknop is geselecteerd" & @CRLF & "bij een van de secties bij het toevoegen van het bedrag." & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox1.5") EndIf ElseIf GUICtrlRead($Radio2) = 1 Then $Result = $Geld2 - $GeldErbij $PreTransfer = $Geld2 Global $Geld2 = $Result ;===> Berekent de transactie $Failliet = 0 ;Nodig bij het bepalen of iemand failliet is (Begint bij de volgende regel) If $Geld2 < 0 Then $Schulden2 = True $GeldErbij = $PreTransfer ;Zorgt ervoor dat bij het overmaken aan de ander (zie beneden deze if's), dat de debtor alleen het geld krijgt die de schuldige ook echt heeft $Failliet = MsgBox(4, "Failliet", $Speler2 & " staat op dit moment in het rood." & @CRLF & "Wil je deze speler failliet verklaren?" & @CRLF & "(Als je op nee drukt, wordt het balans van " & $Speler2 & " teruggezet naar 0.") If $Spelers = 2 Then If $Failliet = 6 Then ;Als de speler op ja drukte bij vorige MsgBox GUICtrlSetState($Radio1, 1) GUICtrlSetState($Radio2, 128) GUICtrlSetState($Radio6, 128) GUICtrlSetState($Zender2, 128) GUICtrlSetState($Ontvanger2, 128) GUICtrlSetState($GeldStatus2, 128) $Spelend2 = 0 $Einde = True MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler1 & "!") ElseIf $Failliet = 7 Then ;Als de speler op nee drukte $Geld2 = 0 Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden gelezen welke optie u gekozen heeft" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox2.1") EndIf ElseIf $Spelers = 3 Then If $Failliet = 6 Then ;Als de speler op ja drukte bij vorige MsgBox GUICtrlSetState($Zender2, 128) GUICtrlSetState($Ontvanger2, 128) GUICtrlSetState($GeldStatus2, 128) GUICtrlSetState($Radio6, 128) $Spelend2 = 0 If $Spelend1 = 1 Then ;Hier checkedt hij de Radio die nog overblijft GUICtrlSetState($Radio1, 1) GUICtrlSetState($Radio2, 128) ElseIf $Spelend3 = 1 Then ;Hier checkedt hij de Radio die nog overblijft GUICtrlSetState($Radio3, 1) GUICtrlSetState($Radio2, 128) EndIf If $Spelend3 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler1 & "!") $Einde = True ElseIf $Spelend1 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler3 & "!") $Einde = True EndIf ElseIf $Failliet = 7 Then ;Als de speler op nee drukte $Geld2 = 0 Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden gelezen welke optie u gekozen heeft" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox2.2") EndIf ElseIf $Spelers = 4 Then If $Failliet = 6 Then ;Als de speler op ja drukte bij vorige MsgBox GUICtrlSetState($Zender2, 128) GUICtrlSetState($Ontvanger2, 128) GUICtrlSetState($GeldStatus2, 128) GUICtrlSetState($Radio6, 128) $Spelend2 = 0 If $Spelend1 = 1 Then ;Hier checkedt(vinkt) hij de Radio die nog overblijft GUICtrlSetState($Radio1, 1) GUICtrlSetState($Radio2, 128) ElseIf $Spelend3 = 1 Then ;Hier checkedt hij de Radio die nog overblijft GUICtrlSetState($Radio3, 1) GUICtrlSetState($Radio2, 128) ElseIf $Spelend4 = 1 Then ;Hier checkedt hij de Radio die nog overblijft GUICtrlSetState($Radio4, 1) GUICtrlSetState($Radio2, 128) EndIf If $Spelend3 = 0 And $Spelend4 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler1 & "!") $Einde = True ElseIf $Spelend1 = 0 And $Spelend4 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler3 & "!") $Einde = True ElseIf $Spelend1 = 0 And $Spelend3 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler4 & "!") $Einde = True EndIf ElseIf $Failliet = 7 Then ;Als de speler op nee drukte $Geld2 = 0 Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden gelezen welke optie u gekozen heeft" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox2.3") EndIf Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden geladen hoeveel mensen er zijn" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox2.4") EndIf EndIf If GUICtrlRead($Radio5) = 1 Then $Result = $Geld1 + $GeldErbij Global $Geld1 = $Result ElseIf GUICtrlRead($Radio6) = 1 Then $Result = $Geld2 + $GeldErbij Global $Geld2 = $Result ElseIf IsDeclared("Speler3") = Not 0 And GUICtrlRead($Radio7) = 1 Then $Result = $Geld3 + $GeldErbij Global $Geld3 = $Result ElseIf IsDeclared("Speler4") = Not 0 And GUICtrlRead($Radio8) = 1 Then $Result = $Geld4 + $GeldErbij Global $Geld4 = $Result Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden geladen welke radioknop is geselecteerd" & @CRLF & "bij een van de secties bij het toevoegen van het bedrag." & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox2.5") EndIf ElseIf GUICtrlRead($Radio3) = 1 Then $Result = $Geld3 - $GeldErbij $PreTransfer = $Geld3 Global $Geld3 = $Result ;===> Berekent de transactie $Failliet = 0 ;Nodig bij het bepalen of iemand failliet is (Begint bij de volgende regel) If $Geld3 < 0 Then $Schulden3 = True $GeldErbij = $PreTransfer ;Zorgt ervoor dat bij het overmaken aan de ander (zie beneden deze if's), dat de debtor alleen het geld krijgt die de schuldige ook echt heeft $Failliet = MsgBox(4, "Failliet", $Speler3 & " staat op dit moment in het rood." & @CRLF & "Wil je deze speler failliet verklaren?" & @CRLF & "(Als je op nee drukt, wordt het balans van " & $Speler3 & " teruggezet naar 0.") If $Spelers = 3 Then If $Failliet = 6 Then ;Als de speler op ja drukte bij vorige MsgBox GUICtrlSetState($Zender3, 128) GUICtrlSetState($Ontvanger3, 128) GUICtrlSetState($GeldStatus3, 128) GUICtrlSetState($Radio7, 128) $Spelend3 = 0 If $Spelend1 = 1 Then ;Hier checkedt hij de Radio die nog overblijft GUICtrlSetState($Radio1, 1) GUICtrlSetState($Radio3, 128) ElseIf $Spelend2 = 1 Then ;Hier checkedt hij de Radio die nog overblijft GUICtrlSetState($Radio2, 1) GUICtrlSetState($Radio3, 128) EndIf If $Spelend2 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler1 & "!") $Einde = True ElseIf $Spelend1 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler2 & "!") $Einde = True EndIf ElseIf $Failliet = 7 Then ;Als de speler op nee drukte $Geld3 = 0 Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden gelezen welke optie u gekozen heeft" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox3.1") EndIf ElseIf $Spelers = 4 Then If $Failliet = 6 Then ;Als de speler op ja drukte bij vorige MsgBox GUICtrlSetState($Zender3, 128) GUICtrlSetState($Ontvanger3, 128) GUICtrlSetState($GeldStatus3, 128) GUICtrlSetState($Radio7, 128) $Spelend3 = 0 If $Spelend4 = 1 Then ;Hier checkedt hij de Radio die nog overblijft GUICtrlSetState($Radio4, 1) GUICtrlSetState($Radio3, 128) ElseIf $Spelend2 = 1 Then ;Hier checkedt hij de Radio die nog overblijft GUICtrlSetState($Radio2, 1) GUICtrlSetState($Radio3, 128) ElseIf $Spelend1 = 1 Then ;Hier checkedt(vinkt) hij de Radio die nog overblijft GUICtrlSetState($Radio1, 1) GUICtrlSetState($Radio3, 128) EndIf If $Spelend2 = 0 And $Spelend4 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler1 & "!") $Einde = True ElseIf $Spelend1 = 0 And $Spelend4 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler2 & "!") $Einde = True ElseIf $Spelend1 = 0 And $Spelend2 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler4 & "!") $Einde = True EndIf ElseIf $Failliet = 7 Then ;Als de speler op nee drukte $Geld3 = 0 Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden gelezen welke optie u gekozen heeft" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox3.2") EndIf Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden geladen hoeveel mensen er zijn" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox3.3") EndIf EndIf If GUICtrlRead($Radio5) = 1 Then $Result = $Geld1 + $GeldErbij Global $Geld1 = $Result ElseIf GUICtrlRead($Radio6) = 1 Then $Result = $Geld2 + $GeldErbij Global $Geld2 = $Result ElseIf IsDeclared("Speler3") = Not 0 And GUICtrlRead($Radio7) = 1 Then $Result = $Geld3 + $GeldErbij Global $Geld3 = $Result ElseIf IsDeclared("Speler4") = Not 0 And GUICtrlRead($Radio8) = 1 Then $Result = $Geld4 + $GeldErbij Global $Geld4 = $Result Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden geladen welke radioknop is geselecteerd" & @CRLF & "bij een van de secties bij het toevoegen van het bedrag." & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox3.4") EndIf ElseIf GUICtrlRead($Radio4) = 1 Then $Result = $Geld4 - $GeldErbij $PreTransfer = $Geld4 Global $Geld4 = $Result ;===> Berekent de transactie $Failliet = 0 ;Nodig bij het bepalen of iemand failliet is (Begint bij de volgende regel) If $Geld4 < 0 Then $Schulden4 = True $GeldErbij = $PreTransfer ;Zorgt ervoor dat bij het overmaken aan de ander (zie beneden deze if's), dat de debtor alleen het geld krijgt die de schuldige ook echt heeft $Failliet = MsgBox(4, "Failliet", $Speler4 & " staat op dit moment in het rood." & @CRLF & "Wil je deze speler failliet verklaren?" & @CRLF & "(Als je op nee drukt, wordt het balans van " & $Speler4 & " teruggezet naar 0.") If $Spelers = 4 Then If $Failliet = 6 Then ;Als de speler op ja drukte bij vorige MsgBox GUICtrlSetState($Zender4, 128) GUICtrlSetState($Ontvanger4, 128) GUICtrlSetState($GeldStatus4, 128) GUICtrlSetState($Radio8, 128) $Spelend4 = 0 If $Spelend3 = 1 Then ;Hier checked hij de Radio die nog overblijft GUICtrlSetState($Radio3, 1) GUICtrlSetState($Radio4, 128) ElseIf $Spelend2 = 1 Then ;Hier checked hij de Radio die nog overblijft GUICtrlSetState($Radio2, 1) GUICtrlSetState($Radio4, 128) ElseIf $Spelend1 = 1 Then ;Hier checked(vinkt) hij de Radio die nog overblijft GUICtrlSetState($Radio1, 1) GUICtrlSetState($Radio4, 128) EndIf If $Spelend2 = 0 And $Spelend3 = 0 Then ;Bepaalt de winnaar MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler1 & "!") $Einde = True ElseIf $Spelend1 = 0 And $Spelend3 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler2 & "!") $Einde = True ElseIf $Spelend1 = 0 And $Spelend2 = 0 Then MsgBox(0, "Gefeliciteerd!", "We hebben een winnaar: " & $Speler3 & "!") $Einde = True EndIf ElseIf $Failliet = 7 Then ;Als de speler op nee drukte $Geld4 = 0 Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden gelezen welke optie u gekozen heeft" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox4.1") EndIf Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden geladen hoeveel mensen er zijn" & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox4.2") EndIf EndIf If GUICtrlRead($Radio5) = 1 Then $Result = $Geld1 + $GeldErbij Global $Geld1 = $Result ElseIf GUICtrlRead($Radio6) = 1 Then $Result = $Geld2 + $GeldErbij Global $Geld2 = $Result ElseIf IsDeclared("Speler3") = Not 0 And GUICtrlRead($Radio7) = 1 Then $Result = $Geld3 + $GeldErbij Global $Geld3 = $Result ElseIf IsDeclared("Speler4") = Not 0 And GUICtrlRead($Radio8) = 1 Then $Result = $Geld4 + $GeldErbij Global $Geld4 = $Result Else MsgBox(0, "Bug-detector 2000", "Er kon helaas niet worden geladen welke radioknop is geselecteerd" & @CRLF & "bij een van de secties bij het toevoegen van het bedrag." & @CRLF & "Foutcode: " & @error & @CRLF & @CRLF & "Transfer/ErrorMsgBox4.3") EndIf EndIf EndFunc ;===> Berekent hoe de dikke stacks flowen boii You guys can collapse everything except for Hoofdmenu(). Yes, I'm Dutch but I have bilingual school, so you guys don't have to worry about it. The codes I shared earlier are at line 178, and line 421 in my whole script. ($SpelersOver is short for Players which are still playing, and Spelers means Players.) And note that this isn't game automatation. This is just replacing the digital bank for Monopoly, which you have to buy. Also, you don't have to use the banknotes anymore. I understand where Francesco is going, but I don't understand the part where you have to use WM_COMMAND. Is it still relevant after I send my whole script?
-
Hello everyone, First, watch the screenshot I attached: The background beneath the radios is that a value is subtracted from Player 1, and added to player 2, in the case of the screenshot I made. You can see that I created 2 radio groups. On the upper part, radio 1 and 2, and on the lower part radio 5 and 6. Now I automated the buttons in such a way ,that when in group 1 player 1 is selected, player 2 in group 2 automatically gets checked for you. Same thing when checking player 2 in the upper part: player 1 gets checked on the lower part. I did this because there is no reason selecting player 1 or 2 twice, because nothing will change. Now that runs smoothly using this script: If GUICtrlRead($Radio1)=1 And Not BitAND(GUICtrlGetState($Radio6),1) And Not BitAND(GUICtrlGetState($Radio5),1) Then GUICtrlSetState($Radio6,1) If GUICtrlRead($Radio2)=1 And Not BitAND(GUICtrlGetState($Radio5),1) And Not BitAND(GUICtrlGetState($Radio6),1) Then GUICtrlSetState($Radio5,1) If GUICtrlRead($Radio5)=1 And Not BitAND(GUICtrlGetState($Radio2),1) And Not BitAND(GUICtrlGetState($Radio1),1) Then GUICtrlSetState($Radio2,1) If GUICtrlRead($Radio6)=1 And Not BitAND(GUICtrlGetState($Radio1),1) And Not BitAND(GUICtrlGetState($Radio2),1) Then GUICtrlSetState($Radio1,1) But there is a problem when clicking on a radio in group 2, the lower one. It is very hard to check one, because for some reason the radio get's deselected instantly most of the time. I already tried to prevent it by using the second BitAND() in the codes I shared (It doesn't check the radio automatically if the other radio in the other group is selected, meaning that the user want's to switch the radios). But it didn't work. Does somebody know why you sometimes can't check radio 5 or 6 (the lower part)?
-
Can't enable a radio with GUICtrlsetState()
Silas replied to Silas's topic in AutoIt GUI Help and Support
Thank you guys. The answer from Mikell solved my problem. It works smoothly when I use this: If GUICtrlRead($Radio1)<>1 And Not BitAND(GUICtrlGetState($Radio5), $GUI_ENABLE) Then GUICtrlSetState($Radio5, 64)- 5 replies
-
- guictrlsetstate
- enable
-
(and 1 more)
Tagged with:
-
Hello everyone, I have a radio button ($Radio1), which I want to disable as soon as another one get's checked (Radio5). (The system fails if the radio button i'm troubling with also gets checked). I know how to disable him: If GUICtrlRead($Radio1)=1 And Not BitAND(GUICtrlGetState($Radio5), $GUI_DISABLE) Then GUICtrlSetState($Radio5, 128) But if i try to enable $Radio5 again, after $Radio1 isn't checked anymore, it fails: If GUICtrlRead($Radio1)=Not 1 And Not BitAND(GUICtrlGetState($Radio5), $GUI_ENABLE) Then GUICtrlSetState($Radio5, 64) Anyone knows why?
- 5 replies
-
- guictrlsetstate
- enable
-
(and 1 more)
Tagged with:
-
Can't open other au3 file with #include
Silas replied to Silas's topic in AutoIt General Help and Support
i tried #include ("C:\Backup\Bots\WIFI-S\Sources\Scripts\Testau3.au3") but the he says: C:\Backup\Bots\WIFI-S\WIFI-S - Test.au3 (8) : ==> Cannot parse #include.: #include ("C:\Backup\Bots\WIFI-S\Sources\Scripts\Testau3.au3") -
Can't open other au3 file with #include
Silas replied to Silas's topic in AutoIt General Help and Support
Sorry i think I made a mistake in my script, I meaned Test in stead of Text. It is a .exe file. I tried what you said in every way, but it still says that he can't open the file. But what do you mean with extension? Im new to AutoIt. -
If i want to use #include for making my script easier to edit, it can't load the file. Here is my script: #include <C:\Backup\Bots\WIFI-S\Sources\Scripts\Text> ;#Region ### START Koda GUI section ### Form=c:\backup\bots\bronnen\koda\wifi-s\wifi-s.kxf ;---------------Startcherm (this is in the other file i want to open) ;global $Start = GUICreate("WIFI-S ©", 679, 269, -1, -1) ;GUISetBkColor(0xFFFFFF) ;global $StartButton = GUICtrlCreateButton("Start", 400, 184, 163, 41) ;GUICtrlSetTip( -1, "Los het internet probleem op") ;GUICtrlSetFont(-1, 11, 400, 0, "Segoe UI") ;GUICtrlSetCursor (-1, 0) ;global $Logo = GUICtrlCreatePic("C:\Backup\Bots\WIFI-S\Sources\Afbeeldingen\Bijna overal\Logo Wifi-S.jpg", 8, 8, 132, 132) ;GUICtrlSetTip( -1, "Dit is het logo van WIFI-S") ;global $Tekst = GUICtrlCreateLabel("Welkom bij de WIFI-Solver", 136, 32, 507, 60) ;GUICtrlSetFont(-1, 40, 800, 0, "Segoe MDL2 Assets") ;GUICtrlSetColor(-1, 0x000000) ;global $History = GUICtrlCreateButton("Geschiedenis", 112, 184, 163, 41) ;GUICtrlSetTip( -1, "Kijk naar welke problemen je het meest hebben getroffen") ;GUICtrlSetFont(-1, 11, 400, 0, "Segoe UI") ;GUICtrlSetCursor (-1, 0) ;global $teks = GUICtrlCreateLabel("Als je problemen hebt geef het dan alsjeblieft door. Dit is nog een Béta.", 160, 104, 480, 24) ;GUICtrlSetFont(-1, 11, 400, 0, "Segoe UI") ;Dim $Start_AccelTable[2][2] = [["s", $StartButton],["g", $History]] ;GUISetAccelerators($Start_AccelTable) ;GUISetState(@SW_SHOW) ;#EndRegion ### END Koda GUI section ### ;While 1 ; $nMsg = GUIGetMsg() ; Switch $nMsg ; Case $GUI_EVENT_CLOSE ; Case $StartButton ; Start() ; EndSwitch ;WEnd Func Start() ;-------------------------------------------------------------------------------------------------------------Stap 1 GUISetState(@SW_HIDE, $Start) ;Zorg ervoor dat vensters verschijnen en verdwijnen(Nog bezig met maken) #Region ### START Koda GUI section ### Form=c:\backup\bots\bronnen\koda\wifi-s\stap 1.kxf Global $Stap1 = GUICreate("Stap 1 - Wifi-S ©", 732, 240, -1, -1) GUISetFont(9, 400, 0, "Segoe UI") GUISetBkColor(0xFFFFFF) global $Home = GUICtrlCreateButton("Home", 8, 184, 40, 40, $BS_ICON) GUICtrlSetCursor (-1, 0) GUICtrlSetTip( -1, "Ga terug naar het beginscherm") GUICtrlSetImage(-1, "C:\Backup\Bots\WIFI-S\Sources\Afbeeldingen\\Bijna overal\HomeKnop.ico", -1) GUICtrlSetFont(-1, 11, 400, 0, "Segoe UI") GUICtrlSetCursor (-1, 0) global $Logo = GUICtrlCreatePic("C:\Backup\Bots\WIFI-S\Sources\Afbeeldingen\\Bijna overal\Logo Wifi-S.jpg", 8, 8, 132, 132) GUICtrlSetTip( -1, "Dit is het logo van WIFI-S") global $Stap = GUICtrlCreateLabel("Oplossing 1/20", 8, 128, 140, 29) GUICtrlSetFont(-1, 14, 800, 0, "Segoe UI Semibold") GUICtrlSetColor(-1, 0x000000) global $Titel = GUICtrlCreateLabel("Probeer te herverbinden", 172, 32, 500, 55) GUICtrlSetFont(-1, 32, 800, 0, "Arial") GUICtrlSetColor(-1, 0x000000) global $Uitleg1 = GUICtrlCreateLabel("Soms doet het internet het toch na eventjes wachten.", 208, 101, 353, 24) GUICtrlSetFont(-1, 11, 400, 0, "Segoe UI") global $Werkte = GUICtrlCreateButton("Dit werkte", 300, 192, 131, 33) GUICtrlSetCursor (-1, 0) GUICtrlSetTip( -1, "DIt heeft het probleem opgelost") GUICtrlSetFont(-1, 10, 400, 0, "Segoe UI") global $Volgende = GUICtrlCreateButton("Dit werkte niet", 544, 192, 131, 33) GUICtrlSetCursor (-1, 0) GUICtrlSetTip( -1, "Ik heb nog steeds internetproblemen") GUICtrlSetFont(-1, 10, 400, 0, "Segoe UI") global $Stap1_AccelTable[1][2] = [["+{BS}", $Home]] GUISetAccelerators($Stap1_AccelTable) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Home Home() Case $Volgende Stap2() Case $Werkte Werkte() EndSwitch WEnd EndFunc Func Home() ;------------------Herstart programma. Run ("WIFI-S.exe") Exit EndFunc Can you guys help me?
-
Hello everyone, I am making a litle programm that helps my classmates how to fix their internet problems. I just started with is so there isn't very much in the window yet.. But what i want to ask you guy's: is there a way that the window changes while it is active. Like first you see picture 1 and some text, and when you press the start button the hole window changes so that the picture and text are gone and you see something els. And that when you restart it, it is resetted. I tried it whit just opening a new window but that became somewhat odd. Can you guys help me? (And i don't mean by making litle tabs.) In other words: when you press the start button, the picture and start button disapears, and in stead of that other buttons and text and pictures appear. #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #Region ### START Koda GUI section ### Form=c:\backup\bots\bronnen\koda\wifi-s.kxf $Form1 = GUICreate("WIFI-S ©", 762, 467, -1, -1) GUISetBkColor(0xFFFFFF) $Start = GUICtrlCreateButton("Start", 568, 368, 131, 57) GUICtrlSetFont(-1, 11, 400, 0, "Segoe UI") $Logo = GUICtrlCreatePic("C:\Backup\Bots\WIFI-S\Sources\Home\Logo Wifi-S.jpg", 8, 8, 132, 132) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Start Start() EndSwitch WEnd Func Start() EndFunc Thank you very much if you have a answer because i searched a lot but i didn't find anything like this.
-
Hello everyone, When I want to start the start function after i stopped it i can't start it again. Can someone help me? Here are my codes: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=C:\Users\Silas Peters\Desktop\Bots\Cookie Clicker.kxf Global $Form1 = GUICreate("Cookie Clicker Bot", 267, 87, -1, -1) Global $Start = GUICtrlCreateButton("Start", 160, 48, 75, 25) Global $Stop = GUICtrlCreateLabel("Om te stoppen druk op de 'ESC' knop", 40, 16, 182, 17) Global $Internet = GUICtrlCreateButton("Open Coockie Clicker", 24, 48, 123, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### HotKeySet("{ESC}", "Stop") Local $i = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $start Start() Case $Internet Internet() EndSwitch WEnd Func Start() $i = 1 While 1 If $i = 1 Then MouseClick ("left", 215, 379) WEnd EndFunc Func Internet() ShellExecute ("http://orteil.dashnet.org/cookieclicker/") WinWaitActive ("" , "Chrome Legacy Window" ) Sleep (3000) WinActivate ("Cookie Clicker Bot") EndFunc Func Stop() $i = 0 WinActivate ("Cookie Clicker Bot") EndFunc And also, if you guy's know it too, can you tell me how i can keep the window of the bot in front all the time while the website is starting? I would really apreciate it if you guy's can help me.
-
Hello everyone, I'm new and i really like programming. Now i am making a bot for orteil.dashnet.org/cookieclicker/ . Here is the script I have now: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=C:\Users\Silas Peters\Desktop\Bots\Cookie Clicker.kxf Global $Form1 = GUICreate("Cookie Clicker Bot", 267, 87, -1, -1) Global $Start = GUICtrlCreateButton("Start", 160, 48, 75, 25) Global $Stop = GUICtrlCreateLabel("Om te stoppen druk op de 'ESC' knop", 40, 16, 182, 17) Global $Internet = GUICtrlCreateButton("Open Coockie Clicker", 24, 48, 123, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $g_bPaused = False HotKeySet("{ESC}", "Stop") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $start Start() Case $Internet Internet() EndSwitch WEnd Func Start() While 1 MouseClick ("left", 215, 379) WEnd EndFunc Func Internet() ShellExecute ("http://orteil.dashnet.org/cookieclicker/") WinWaitActive ("" , "Chrome Legacy Window" ) Sleep (3000) WinActivate ("Cookie Clicker Bot") EndFunc Func Stop() Exit EndFunc But i want that if you press ESC that the spamming stops but that the window still stay's open so you can manually restart it... Can anyone help me? And also, if you guy's know it too, can you tell me how i can keep the window of the bot in front all the time while the website is starting? I would really apreciate it if you guy's can help me. P.S. I'm actually dutch so sorry if i make some mistakes in grammar...