Jump to content
Sign in to follow this  
WhoElse

Parameters are not getting passed to next function

Recommended Posts

WhoElse

Greetings fellow newbies and pros!

So I've been looking for answers the whole evening, but couldn't find any that fit my problem.

Basically it is pretty basic, but somehow I can't get it to work.

Anyway, here it goes:

My parameters $Location, $Infection and $Difficulty are specified in ComboBoxes in the first Function. When

the button is pressed I want to pass them to the next Function. They are however not passed as far as i can tell.

Heres my code, and I appreciate every helpful comment :sorcerer:

Go nuts!

Choose()
Func Choose()

$gui = GUICreate("StartUp", 120, 220, 750, 300)

$label_combo_infection = GUICtrlCreateLabel("Choose Infection:", 11, 25, 100, 20)
$combo_choose_infection = GUICtrlCreateCombo("Bacteria", 10, 45, 100, 0,$CBS_DROPDOWNlist + $CBS_AUTOHSCROLL)
$combo_populate_choose_infection = GUICtrlSetData($combo_choose_infection, "Virus|Fungus|Nano Bots|Bio Weapon|Parasite|Alien Worm")

$label_combo_difficulty = GUICtrlCreateLabel("Choose Difficulty:", 11, 75, 100, 20)
$combo_choose_difficulty = GUICtrlCreateCombo("Casual", 10, 95, 100, 0, $CBS_DROPDOWNlist + $CBS_AUTOHSCROLL)
$combo_populate_choose_difficulty = GUICtrlSetData($combo_choose_difficulty, "Normal|Hard|Apocalyptic|Mastermind")

$label_combo_location = GUICtrlCreateLabel("Choose Location:", 11, 125, 100, 20)
$combo_choose_location = GUICtrlCreateCombo("Afghanistan", 10, 145, 100, 0, $CBS_DROPDOWNlist + $CBS_AUTOHSCROLL)
$combo_populate_choose_location = GUICtrlSetData($combo_choose_location, $locations)

$button_start = GUICtrlCreateButton("Begin", 10, 175, 100, 30)


GUISetState(@SW_SHOW, $gui)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $button_start
$Infection = _GUICtrlComboBox_GetEditText($combo_choose_infection)
$Difficulty = _GUICtrlComboBox_GetEditText($combo_choose_difficulty)
$Location = _GUICtrlComboBox_GetEditText($combo_choose_location)
Game($Infection, $Difficulty, $Location)
GUIDelete($gui)
EndSwitch
WEnd
EndFunc


Func Game($Infection, $Difficulty, $Location)
$gui_game = GUICreate("Pandemic", 1300, 900, 200, 50)
$preferences_label = GUICtrlCreateLabel($Infection & " | " & $Location & " | " & $Difficulty, 10, 5, 400, 20)

GUISetState(@SW_SHOW, $gui_game)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
EndFunc

Share this post


Link to post
Share on other sites
Melba23

Comraw,

Welcome to the AutoIt forum. :)

You need to use GUICtrlRead to read the combos - just replace the current _GUICtrlComboBox_GetEditText function and the code works. ;)

But I note your use of the G word throughout the script - please read the Forum rules (the link is also at bottom right of each page) - particularly the bit about not discussing game automation - before you post again. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
WhoElse

Wow, many thanks for the fast and working(!) help.

I assume you meant the G*me part? I'm sorry if it looked like I wanted to modify or break a game with my "programm".

Actually I'm just ripping off someones game idea (so a new game and not a modification of something existing) for my own personal autoit learning satisfaction ( :pirate: ).

However I wouldn't dream of publishing it and since I know myself, I can also safely assume that I won't finish it.

Thank you again for your help, it worked. Be ready for some more questions that wouldn't stagger a 3 year-old :bye:

Share this post


Link to post
Share on other sites
Melba23

Comraw,

Happy to help with the questions - I might be able to answer them! :D

But please do read those rules - we enforce them rigidly. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
WhoElse

You mean this part, don't you?

"Launching, automation or script interaction with games or game servers, regardless of the game."

Share this post


Link to post
Share on other sites
Melba23

Comraw,

I mean all of them - but that is the bit I particularly wanted you to note. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
WhoElse

I will include them into my evening prayers for you :sorcerer:

I read them all and I will off course try and follow them to the best of my abilites.

Keep it real, yo yo!

Share this post


Link to post
Share on other sites
Melba23

Comraw,

I will include them into my evening prayers for you

If you wish. :huh:

I will off course try and follow them

Delighted to hear it - it will make my life much easier. :)

to the best of my abilites

Be assured that I will keep an eye open to make sure that your abilities are up to the task. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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  

×