Jump to content

Gui Won't Cycle Properly


Recommended Posts

Ok well I'm not sure how to make "proper" transitions between GUI's but this is how I set out to do it by setting While loops to variables and reassigning them to route my script from GUI to GUI but it keeps crashing after the third window.. I'm really not sure why and I thought I would ask to see if it is obvious to anyone.

If you want to try this out, continuously push the "Store" and "Back" button.

;action path for alpha

;;;;;;;;;;gui which takes cityid input from user until i improve the code to find it myself;;;;;;;;;;

Global $single,$double
Func cityinput()
Local $a,$a1,$a2,$a3,$a4,$a5,$ci0,$ci1,$ci2,$ci3,$ci4,$ci5
    $single=1
    GuiCreate("Ikariam City ID's.", 350, 200)
    GuiSetState(@sw_show)
    GuiCtrlCreateLabel("Input City1 ID Here",20,10)
    GuiCtrlCreateLabel("Input City2 ID Here",20,60)
    GuiCtrlCreateLabel("Input City3 ID Here",125,10)
    GUICtrlCreateLabel("Input City4 ID Here",125,60)
    GuiCtrlCreateLabel("Input City5 ID Here",230,10)
    GuiCtrlCreateLabel("Input City6 ID Here",230,60)
    $ci0=GUICtrlCreateInput($a,20,30,100,20)
    $ci1=GUICtrlCreateInput($a1,20,80,100,20)
    $ci2=GuiCtrlCreateInput($a2,125,30,100,20)
    $ci3=GuiCtrlCreateInput($a3,125,80,100,20)
    $ci4=GuiCtrlCreateInput($a4,230,30)
    $ci5=GUICtrlCreateInput($a5,230,80)
    $button1=GuiCtrlCreateButton("Store", 270,165,60,20)
    GuiCtrlCreateLabel("The city id can be found by right clicking on Show Town",25,110)
    GuiCtrlCreateLabel("and clicking Properties, city by city.",25,125)
    While $single=1
        Local $msg=GUIGetMsg()
        Select
            Case $msg=$button1
                GuiSetState(@sw_hide)
                $single=0
                $double=1
        EndSelect       
    WEnd
EndFunc

Func path()
;;;;;;;;;;main control code;;;;;;;;;;
;city1 code
    #include <GUIConstantsEx.au3>
    AutoitSetOption("TrayIconHide",1)
    GUICreate("Hamster Pellet Counter",400,350)
    GuiSetState(@sw_show)
    GuiCtrlCreateLabel("Please select the buildings you would like to focus on in each city.",10,10)
    GUICtrlCreateLabel("City One",260,63)
    GUICtrlCreateLabel("City Two",260,93)
    GUICtrlCreateLabel("City Three",260,123)
    GUICtrlCreateLabel("City Four",260,153)
    GUICtrlCreateLabel("City Five",260,183)
    GUICtrlCreateLabel("City Six",260,213)
    GuiCtrlCreateLabel("--------------------------------------------------"& _
    "---------------------------",10,35)
    $ctl=GuiCtrlCreateCombo("",10,60)
    GuiCtrlSetData(-1,"Town Hall|Academy|Warehouse|Tavern|Palace/Gov.Res.|Museum|Trading Port|"& _
    "Shipyard|Barracks|Town Wall|Embassy|Trading Post|Workshop|Hideout|Forester's House|"& _
    "Glassblower|Alchemist's Tower|Winegrower|Stonemason|Carpenter|Optician|"& _
    "Firework Test Area|Wine Press|Architect's Office","Town Hall")
    $ctl1=GuiCtrlCreateCombo("",10,90)
    GuiCtrlSetData(-1,"Town Hall|Academy|Warehouse|Tavern|Palace/Gov.Res.|Museum|Trading Port|"& _
    "Shipyard|Barracks|Town Wall|Embassy|Trading Post|Workshop|Hideout|Forester's House|"& _
    "Glassblower|Alchemist's Tower|Winegrower|Stonemason|Carpenter|Optician|"& _
    "Firework Test Area|Wine Press|Architect's Office","Town Hall")
    $ctl2=GuiCtrlCreateCombo("",10,120)
    GuiCtrlSetData(-1,"Town Hall|Academy|Warehouse|Tavern|Palace/Gov.Res.|Museum|Trading Port|"& _
    "Shipyard|Barracks|Town Wall|Embassy|Trading Post|Workshop|Hideout|Forester's House|"& _
    "Glassblower|Alchemist's Tower|Winegrower|Stonemason|Carpenter|Optician|"& _
    "Firework Test Area|Wine Press|Architect's Office","Town Hall")
    $ctl3=GuiCtrlCreateCombo("",10,150)
    GuiCtrlSetData(-1,"Town Hall|Academy|Warehouse|Tavern|Palace/Gov.Res.|Museum|Trading Port|"& _
    "Shipyard|Barracks|Town Wall|Embassy|Trading Post|Workshop|Hideout|Forester's House|"& _
    "Glassblower|Alchemist's Tower|Winegrower|Stonemason|Carpenter|Optician|"& _
    "Firework Test Area|Wine Press|Architect's Office","Town Hall")
    $ctl4=GuiCtrlCreateCombo("",10,180)
    GuiCtrlSetData(-1,"Town Hall|Academy|Warehouse|Tavern|Palace/Gov.Res.|Museum|Trading Port|"& _
    "Shipyard|Barracks|Town Wall|Embassy|Trading Post|Workshop|Hideout|Forester's House|"& _
    "Glassblower|Alchemist's Tower|Winegrower|Stonemason|Carpenter|Optician|"& _
    "Firework Test Area|Wine Press|Architect's Office","Town Hall")
    $ctl5=GuiCtrlCreateCombo("",10,210)
    GuiCtrlSetData(-1,"Town Hall|Academy|Warehouse|Tavern|Palace/Gov.Res.|Museum|Trading Port|"& _
    "Shipyard|Barracks|Town Wall|Embassy|Trading Post|Workshop|Hideout|Forester's House|"& _
    "Glassblower|Alchemist's Tower|Winegrower|Stonemason|Carpenter|Optician|"& _
    "Firework Test Area|Wine Press|Architect's Office","Town Hall")
;launch,id,reserved buttons
    $ebtn=GuiCtrlCreateButton("RESERVE",300,300,75,25)
    $Lbtn=GUICtrlCreateButton("Launch",200,300,75,25)
    $twnbtn=GUICtrlCreateButton("Set Town IDs",100,300,75,25)
    $bbtn=GuiCtrlCreateButton("Back",10,300,75,25)
;creates and sets slider values
    $sld=GuiCtrlCreateSlider(10,260,200)
    GuiCtrlSetLimit(-1,90,15)
    GuiCtrlSetData($sld,55)
;labels
    GuiCtrlCreateLabel("Minute Delay",210,255)
    GuiCtrlCreateLabel("90",190,240)
    GuiCtrlCreateLabel("75",154,240)
    GuiCtrlCreateLabel("55",108,240)
    GuiCtrlCreateLabel("35",62,240)
    GuiCtrlCreateLabel("15",16,240)
    While $double=1
        Local $msg=GuiGetMsg()
        Select  
            Case $ctl=$msg
                MsgBox(0,"First","Set to "& GuiCtrlRead($ctl)&".",.5)
            Case $ctl1=$msg
                MsgBox(0,"Second","Set to "& GuiCtrlRead($ctl1)&".",.5)
            Case $ctl2=$msg
                MsgBox(0,"Third","Set to "& GuiCtrlRead($ctl2)&".",.5)
            Case $ctl3=$msg
                MsgBox(0,"Fourth","Set to "& GuiCtrlRead($ctl3)&".",.5)
            Case $ctl4=$msg
                MsgBox(0,"Fifth","Set to "& GuiCtrlRead($ctl4)&".",.5)
            Case $ctl5=$msg
                MsgBox(0,"Sixth","Set to "& GuiCtrlRead($ctl5)&".",.5)
            Case $Lbtn=$msg
                MsgBox(0,"Launching","Launching main sequence with a "&GuiCtrlRead($sld)&" minute delay.",2)
            Case $bbtn=$msg
                GuiSetState(@sw_hide)
                $double=0
                $single=1
        EndSelect
    Wend
EndFunc

while 1
    cityinput()
    path()
WEnd
Edited by myxomatosii
Link to comment
Share on other sites

All you have to do is move your #Inlcude file on line 40 to the top. What was happening was you were declaring the same constants over and over again because of the loop. Just move the indclude to the top of the script and you should be fine.

Edited by dantay9
Link to comment
Share on other sites

All you have to do is move your #Inlcude file on line 40 to the top. What was happening was you were declaring the same constants over and over again because of the loop. Just move the indclude to the top of the script and you should be fine.

Okay, that makes sense. I was writing the two parts separately and added them together later. Didn't notice the include

Link to comment
Share on other sites

Create an account or sign in to comment

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

Create an account

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

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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