Jump to content
Silas

Create different labels within a For Loop

Recommended Posts

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.

Share this post


Link to post
Share on other sites

Don't declare the array inside the loop, declare it ONCE, then just use the array itself inside the loop. Also, instead of using Assign, you can just create another array and fill it with the information you need for the label.

Something like this is cleaner.

Global $PayHLabel_[10], $PayH_[10]
For $i = 1 To 10
    $PayH_[$i - 1] = 20     ;Creates the variables for the values
    $PayHLabel_[$i - 1] = GUICtrlCreateLabel($PayH_[$i1 - 1], 30, 30)     ;Creates the labels which show the values
Next

 


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
On 4/5/2019 at 1:23 PM, Silas said:

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.

Repetitive data problem? What if there are more than 10 transactions? Display in a listview?


Skysnake

Why is the snake in the sky?

Share this post


Link to post
Share on other sites
Posted (edited)

Sorry for the late answer

On 4/5/2019 at 1:31 PM, BrewManNH said:

Don't declare the array inside the loop, declare it ONCE, then just use the array itself inside the loop. Also, instead of using Assign, you can just create another array and fill it with the information you need for the label.

Something like this is cleaner.

Global $PayHLabel_[10], $PayH_[10]
For $i = 1 To 10
    $PayH_[$i - 1] = 20     ;Creates the variables for the values
    $PayHLabel_[$i - 1] = GUICtrlCreateLabel($PayH_[$i1 - 1], 30, 30)     ;Creates the labels which show the values
Next

 

This worked for me, thanks!

16 hours ago, Skysnake said:

Repetitive data problem? What if there are more than 10 transactions? Display in a listview?

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?

Edited by Silas
Addition

Share this post


Link to post
Share on other sites
17 minutes ago, Nine said:

Hmmm, first $i1 is not declared anywhere, typo ?

Yes, typo, should be this instead.

$PayH_[$i - 1]

 


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
1 hour ago, Nine said:

Second remove brackets, use $i simply, instead of [$i]

Damn Daniel, why didn't I see this? Thanks you all

Share this post


Link to post
Share on other sites
Posted (edited)

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])

 

Edited by Silas
Useful addition, typo

Share this post


Link to post
Share on other sites
Posted (edited)

Arrays are base-0 indexed in AutoIt, so the first entry sits in $array[0], the second in $array[1], etc; so an array containing 10 slots spans indices 0-9.

If you wish to remove one array element with automatic array resize and remaining following entries shifting up, check out _ArrayDelete in the Help.

Edited by RTFC

Share this post


Link to post
Share on other sites
5 hours ago, Silas said:

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].

That's silly, of course you don't need to do that. Just use -1 for any references to the array, or start your loop at zero and go to 9 instead. As mentioned, arrays start at 0 and their upper limit is the declared size minus 1. 


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
6 minutes ago, Silas said:

I can't go from 0 to 9,

Why not?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
16 minutes ago, BrewManNH said:

Why not?

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.

Share this post


Link to post
Share on other sites

WHY are you attempting to write code to put the value from one array element into another element in the same array? There's NO reason to do that, and you're complicating things by attempting to do something totally unnecessary.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

I hope you will get me now. I am probably thinking too difficult or something.

Share this post


Link to post
Share on other sites

Can you post the script you're working on so we can see what it is you're trying to accomplish. That video didn't show me at all what you're trying to do.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
;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.

Share this post


Link to post
Share on other sites

how about _arraypush?, just _arraypush the new values in to the array and rewrite the labels from the array
in the help file is an example of _arraypush

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • By hendrikhe
      Hello,
      I am wondering how to "scroll" to left and right  (till the end ) on a webpage .
      Sending Arrow left/right only moves a bit, I wan to move isntaly to the end
      Up and down is easily done sending Page Up and Page Down.
      Any ideas?
      Greetings
      Hendrik
    • By Zag8888
      Hey folks, I have a little problem with my script.
      I have no experience with these things, and I know for  sure that my code is not the best, but please be lenient, thanks 😅
      The User should first choose 1 of the 2 Options to actually start the script. If 1 of the 2 Option is choosen then the User should click start again and all should work.
      I have already commented the problem, If the button Start is clicked before, the User will select just 1 of the 2 option and the program will start (Without clicking start).How can I set $Start to $GUI_UNCHECKED? I have already tried to use GuiCtrlSetState, but didnt worked.
       
      $Start = GuiCtrlCreateButton("Start", 20, 200, 90, 50,bitor($BS_CENTER,0,0)) GUICtrlSetOnEvent($Start,"Startallrun") Func Startallrun() If ((GUICtrlRead($Option1) = $GUI_UNCHECKED) And (GUICtrlRead($Option2) = $GUI_UNCHECKED)) Then MsgBox($MB_OK, "Error", "You have to select 1 Option") While (GUICtrlRead($Option1) = $GUI_UNCHECKED) Sleep(10) If (GUICtrlRead($Option1) = $GUI_CHECKED) Or (GUICtrlRead($Option2) = $GUI_CHECKED) Then GUICtrlSetState($Start,$GUI_UNCHECKED) ; This doesen't work for Buttons While (GUICtrlRead($Start) = $GUI_UNCHECKED) Sleep(10) If ($Start = $GUI_CHECKED) Then ; That's the problem. The script will start if I click one of the 2 options (because start was already checked before) ExitLoop EndIf WEnd ExitLoop EndIf WEnd Else If (GUICtrlRead($Option1) = $GUI_CHECKED) Then MsgBox($MB_OK, "Starting", "Start") Start() EndIf EndIf EndFunc  
    • By Zag8888
      $x1 = InputBox("xx", "xxxx?")
      if ($x1 = 1) Then
         MouseClick(132,393,1)
         Sleep(5000)
      EndIf
       
      So if I input 1 the if statement should work but it won't, what I wrong?
    • By Docfxit
      I'm getting an error in this script:
      Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) TrayTip("clears any tray tip","",0) AutoItSetOption("TrayIconDebug", 1) ;0-off #include "OSVersion.au3" Run('C:\Dnload\9xAddons\TestThis.exe') MsgBox("","Test","$ProgramFiles - " & $ProgramFiles & @CRLF & "_OSVersion() - " & _OSVersion()) Exit This is the error I am getting:

      The variables should be defined in the #include "OSVersion.au3"
      Func _OSVersion() Global $OSVersion Local $sWinVer = FileGetVersion('winver.exe') $OS_Version = @OSVersion $servicepack_version = StringReplace(@OSServicePack, "Service Pack ", "SP") If @error = -1 Then $servicepack_version = "" ConsoleWrite($OS_Version & $servicepack_version & StringRegExpReplace(@OSArch, '(X86)', '') & @CRLF) ConsoleWrite(@OSArch & @CRLF) If $OSVersion = 'Win7' Or $OSVersion = 'Win7SP1' Or $OSVersion = 'Win7X64' Or $OSVersion = 'Win7SP1x64' Then $ProgramFiles = "C:\Programs\" Else $ProgramFiles = "C:\Program Files\" EndIf Return $OS_Version & $servicepack_version & StringRegExpReplace(@OSArch, '(X86)', '') EndFunc ;==>_OSVersion What do I need to do to resolve the error?
      Thanks,
      Docfxit
    • By coles
      Hi All,
      Need a help with Autoit task, I am trying to copy an XML file and edit that XML file and copy it back
      The script i have attached if the script we use to copy files to client from server, so basically what it does is
      Going through a Set of IP address and 
      Map the drive Copy the file Write copy process was success Goes on a loop through IP's to check all machines have updated files   #include <File.au3> #include <iNet.au3> #include <_XMLDomWrapper.au3> func latestUpdate($address, $name) Local $result Local $hFileIndexHTML DriveMapDel ( "G:" ) ConsoleWrite('Trying: ' & $address & "/" & $name & @CRLF); $result = DriveMapAdd ( "G:", "\\" & $address & "\C$", 0, $name & "\adminname","adminpswd") ;Copying the file from Mapped drive to local if $result = 1 Then FileCopy( "G:\Program Files\test.xml", "C:\sample\test.xml", 1); ConsoleWrite('Copying Updated File: ' & $address & @CRLF); $hFileIndexHTML = FileOpen("C:\sample\test.txt", 1) FileWrite($hFileIndexHTML, $address & @CRLF) FileClose($hFileIndexHTML) EndIf EndFunc func done($file, $address) For $i = 1 to _FileCountLines($file) $line = FileReadLine($file, $i) if ( $address = $line ) Then ConsoleWrite('Already done: ' & $file & " " & $address & @CRLF); return true EndIf Next return false EndFunc func getMachineName($ipaddress) return _TCPIpToName($ipaddress) EndFunc func process($address) local $machineName $machineName = getMachineName($address) if ($machineName = "") Then ConsoleWrite("No machine found at:" & $address & @CRLF) Else ConsoleWrite("Machine found at:" & $address & " - " & $machineName & @CRLF) if ( done( "C:\sample\test.txt", $address) = false ) then if ( $machineName <> "" ) then latestUpdate($address, $machineName) else endif endif EndIf EndFunc TCPStartup() while 1=1 PROCESS("10.10.1.1") sleep( 1000 * 60 * 10) wend The XML file i am trying to copy is unique and different in all machines (Machine name,ID's etc), But whole structure is the same (ie, the num of lines ) [That's the reason i can't copy a single file to all the machines].
      I was thinking of using _FileWriteToLine  to replace 3 lines with new data 
      eg:
      _FileWriteToLine("c:\sample\test.xml", 71,  "<RIA>"http://goog.html"</RIA>", True) 
      _FileWriteToLine("c:\sample\test.xml", 350,  "<col header="Status" width="7%" dataFld="status_code" style="" preprocesser="processES" template="" hidden="0"/>", True) 
      _FileWriteToLine("c:\sample\test.xml", 650,  "<col header="Units" width="11%" dataFld="units" style="" preprocesser="" template="fU(units)" hidden="0"/>", True) 
      These lines inside XML  
      340<em>
      341<gd
      342-360 is similar as blah blah <col header="Status" width="7%" dataFld="status_code" style="" preprocesser="processES" template="" hidden="0"/>
      same goes for 650th line also
       
      I would like to get opinion of copying this file as this is a highly critical file needed to keep machines running
       
      Do you think using _file write to line is risky?. Do you think i have to copy the file from parent folder to another folder after replacing the lines and then copy from there back to client system. This is all what i can think now, Any comments/suggestions will be much appreciated.
       
       
       
       
       
×
×
  • Create New...