Sign in to follow this  
Followers 0
pacman1176

Combo List creates another Combo List problems

2 posts in this topic

So, I have an objective within a GUI. This has been stumping me for a few days. I have a GUI where I have a combo:

#include <GUIconstants.au3>
$dir = "config"
$parent1 = GUICreate("Program",295,450)
$cancelbutton = GUICtrlCreateButton ( "Exit",   175, 385, 50)
GUISetState (@SW_SHOW)
GuiCtrlCreateGroup("Zone", 5, 295, 210, 40)
GuiCtrlCreateGroup("Mob", 5, 335, 210, 40)
$combozone = GUICtrlCreateCombo("-Select a Zone-",10, 310, 200,-1)
        GUICtrlSetData(-1,"Ta'lorn|Catacombs|Essence of Malice|The Shadowmist|-Starter zone-|Erathia's Magic Shop" & _
        "|Dwarven Armory|The Wilderness|Enchanted Forest|Bladeforge|Royal University|The Jail|Demon Gate" & _
        "|Forest of Jewels","-Select a Zone-")
        
Dim $comboTalorn, $comboCatacombs
$SelectaMob = "   --Select a mob--"

Now, to trigger the combo, I use

while 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE or $msg = $cancelbutton Then ExitLoop
    Select
        Case $msg = $combozone
            GUIDeleteCombos()
            If GUICtrlRead($combozone) = "Ta'lorn" Then
                IniWrite($dir,"Zone","Zone","1")  
                $comboTalorn = GUICtrlCreateCombo($SelectaMob,10, 350, 200,-1)
                GUICtrlSetData($comboTalorn,"Snotling Armsbearer|Skulking Minion|Druchii Guardsman|Goblin Swordstealer|Accolyte of Darkness|Skaven Fleshweaver" & _  
                "|Deathkissed Druid|Lamia Darkmaiden|Merciless Maidenslayer|Maniacal Paladin|Fallen Templar",$SelectaMob)
            ElseIf GUICtrlRead($combozone) = "Catacombs" Then
                IniWrite($dir,"Zone","Zone","2")
                $comboCatacombs = GUICtrlCreateCombo($SelectaMob,10, 350, 200,-1)
                GUICtrlSetData($comboCatacombs,"Hellfire Wurm|Wizard of Thunder|Leviathan|Flowstone Behemoth|Emerald Drake|Defiler of Justice" & _
                "|Soothsayer of Fate|Arbiter of Time",$SelectaMob)
            EndIf
        Case $msg = $comboTalorn        
            If GUICtrlRead($comboTalorn) = "Snotling Armsbearer" Then
                IniWrite($dir,"zone","Mob","1")
            ElseIf GUICtrlRead($comboTalorn) = "Skulking Minion" Then
                IniWrite($dir,"zone","Mob","2")
            ElseIf GUICtrlRead($comboTalorn) = "Druchii Guardsman" Then
                IniWrite($dir,"zone","Mob","3")
            ElseIf GUICtrlRead($comboTalorn) = "Goblin Swordstealer" Then
                IniWrite($dir,"zone","Mob","4")
            ElseIf GUICtrlRead($comboTalorn) = "Accolyte of Darkness" Then
                IniWrite($dir,"zone","Mob","5")
            ElseIf GUICtrlRead($comboTalorn) = "Skaven Fleshweaver" Then
                IniWrite($dir,"zone","Mob","6")
            ElseIf GUICtrlRead($comboTalorn) = "Deathkissed Druid" Then
                IniWrite($dir,"zone","Mob","7")
            ElseIf GUICtrlRead($comboTalorn) = "Lamia Darkmaiden" Then
                IniWrite($dir,"zone","Mob","8")
            ElseIf GUICtrlRead($comboTalorn) = "Merciless Maidenslayer" Then
                IniWrite($dir,"zone","Mob","9")
            ElseIf GUICtrlRead($comboTalorn) = "Maniacal Paladin" Then
                IniWrite($dir,"zone","Mob","10")
            ElseIf GUICtrlRead($comboTalorn) = "Fallen Templar" Then
                IniWrite($dir,"zone","Mob","11")
            EndIf   
        Case $msg = $comboCatacombs
            If GUICtrlRead($comboCatacombs) = "Hellfire Wurm" Then
                IniWrite($dir,"zone","Mob","1")
            ElseIf GUICtrlRead($comboCatacombs) = "Wizard of Thunder" Then
                IniWrite($dir,"zone","Mob","2")
            ElseIf GUICtrlRead($comboCatacombs) = "Leviathan" Then
                IniWrite($dir,"zone","Mob","3")
            ElseIf GUICtrlRead($comboCatacombs) = "Flowstone Behemoth" Then
                IniWrite($dir,"zone","Mob","4")
            ElseIf GUICtrlRead($comboCatacombs) = "Emerald Drake" Then
                IniWrite($dir,"zone","Mob","5")
            ElseIf GUICtrlRead($comboCatacombs) = "Defiler of Justice" Then
                IniWrite($dir,"zone","Mob","6")
            ElseIf GUICtrlRead($comboCatacombs) = "Soothsayer of Fate" Then
                IniWrite($dir,"zone","Mob","7")
            ElseIf GUICtrlRead($comboCatacombs) = "Arbiter of Time" Then
                IniWrite($dir,"zone","Mob","8")
            EndIf
       EndSelect
WEnd

So what I'm doing, is I'm making a combo list where each seperate item will create a new combo in a new location on the GUI. I've managed that much.

So two combo lists, each should print its own value to the Ini file. The first combo does fine, prints right to the ini. But I can't figure how to get to the newly created combo 100%. And I've tried many things. Sometimes, the code above seems to write "1" to my "Mob" value no matter which item is selected.

My DeleteCombos function simply deletes the second combo created each time, to prevent stacking.

Note that there are a total of 37 'zones' (first combo), I cut them short. And I didn't include the Creatures (second combo) for each zone.

What I've given as a sample seems to only work for the Ta'lorn option as far as writing the "Mob".

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi there

See if this amended code, works any better.

Good Luck

HardCopy

#include <GUIconstants.au3>
#Include <GuiCombo.au3>

$dir = "config"
$parent1 = GUICreate("Program",295,450)
$cancelbutton = GUICtrlCreateButton ( "Exit",   175, 385, 50)
GUISetState (@SW_SHOW)
GuiCtrlCreateGroup("Zone", 5, 295, 210, 40)
GuiCtrlCreateGroup("Mob", 5, 335, 210, 40)

Global $SelectaMob = "   --Select a Mob--"
$combozone = GUICtrlCreateCombo("  --Select a Zone--",10, 310, 200,-1)
        
Dim $comboTalorn, $comboCatacombs
Global $ZoneData      = "Ta'lorn|Catacombs|Essence of Malice|The Shadowmist|-Starter zone-|Erathia's Magic Shop|Dwarven Armory|The Wilderness|Enchanted Forest|Bladeforge|Royal University|The Jail|Demon Gate|Forest of Jewels"
Global $TalornData    = "Snotling Armsbearer|Skulking Minion|Druchii Guardsman|Goblin Swordstealer|Accolyte of Darkness|Skaven Fleshweaver|Deathkissed Druid|Lamia Darkmaiden|Merciless Maidenslayer|Maniacal Paladin|Fallen Templar"
Global $CatacombsData = "Hellfire Wurm|Wizard of Thunder|Leviathan|Flowstone Behemoth|Emerald Drake|Defiler of Justice|Soothsayer of Fate|Arbiter of Time|Soothsayer of Fate|Arbiter of Time"

    GUICtrlSetData($combozone,$ZoneData,$SelectaMob)


while 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE or $msg = $cancelbutton Then ExitLoop
    Select
    Case $msg = $combozone
        GUICtrlDelete($comboCatacombs)
            GUICtrlDelete($comboTalorn)
        
        
            If GUICtrlRead($combozone) = "Ta'lorn" Then
                IniWrite($dir,"Zone","Zone","1")  
                $comboTalorn = GUICtrlCreateCombo($SelectaMob,10, 350, 200,-1)
                GUICtrlSetData($comboTalorn,$TalornData,$SelectaMob)
        EndIf
        
            If GUICtrlRead($combozone) = "Catacombs" Then
                IniWrite($dir,"Zone","Zone","2")
                $comboCatacombs = GUICtrlCreateCombo($SelectaMob,10, 350, 200,-1)
                GUICtrlSetData($comboCatacombs,$CatacombsData,$SelectaMob)
        EndIf
        
        
        
    Case $msg = $comboTalorn  
            $Pick = _GUICtrlComboGetCurSel($comboTalorn)
            If $Pick > 0 Then
                IniWrite($dir,"Zone","Mob",$Pick)
            EndIf
        
    Case $msg = $comboCatacombs
            $Pick = _GUICtrlComboGetCurSel($comboCatacombs)
            If $Pick > 0 Then
                IniWrite($dir,"Zone","Mob",$Pick)
            EndIf
            
            
       EndSelect
WEnd
Edited by HardCopy

Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad

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
Sign in to follow this  
Followers 0