TwistedXion

GUICtrlCreateInput Help

17 posts in this topic

#1 ·  Posted (edited)

I'm trying to make a game in AutoIt (Just for fun and practice) anyway I have a form that asks for username and character name then should write both to an ini file, but it only writes one to the ini file and then exits out of the program.

Any help would be awesome.

(note this is only a portion of my code if you need to see it all I can post it )

Global $fPath = @ScriptDir & "\Data\Path"


Func gamestart()

#Region ### START mm GUI section ### Form=
$mm = GUICreate("MainMenu", 238, 199, 337, 189)
$tName = GUICtrlCreateInput("", 64, 64, 113, 21)
$uName = GUICtrlCreateInput("", 64, 120, 113, 21)
GUICtrlCreateLabel("ToonName", 90, 40, 57, 17)
GUICtrlCreateLabel("UserName", 91, 96, 54, 17)
$Enter = GUICtrlCreateButton("Enter", 90, 151, 57, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END mm GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUIDelete($mm)
         Case $Enter
            $iniTName = GUICtrlRead($tName)
            $iniUName = GUICtrlRead($uName)
            MsgBox(1,"test", $iniTName & @LF & $iniUName)
            DirCreate($fPath)
            IniWrite($fPath & "\" & "InFo","Name","ToonName",$iniTName)
            MsgBox(1,"","wrote" & " " & $iniTName);for debugging
            IniWrite(fPath & "\" & "InFo","Name","UserName",$iniUName)
            MsgBox(1,"","wrote" & " " & $iniUName);for debugging
EndFunc

    EndSwitch
WEnd

 

 

Edited by TwistedXion

Share this post


Link to post
Share on other sites



#2 ·  Posted

Hi @TwistedXion,

I think you've missed to check our forum rules in your way when posting game automation.:sweating:

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

1 minute ago, KickStarter15 said:

Hi @TwistedXion,

I think you've missed to check our forum rules in your way when posting game automation.:sweating:

No, I'm creating a game not automating one. If you read what I posted I actually stated that at the very start of my post. 

Edited by TwistedXion

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

TwistedXion,

Move the EndFunc line to after the WEnd - at the moment you end the function immediately you write the first set of ini elements.

Might I suggest installing the SciTE4AutoIt3 package (look under the "AutoIt Resources" menu) - that way you automatically get a whole slew of utilities to help you code, including Au3Check which would have picked up on this error.

M23

Edit: There is no problem with this thread as the OP has stated that the game is being created and coded in AutoIt, something which we actively encourage.

Edited by Melba23

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

#5 ·  Posted

Not sure if that make's any difference.

Share this post


Link to post
Share on other sites

#6 ·  Posted

Yes have fixed that already and still no dice

Share this post


Link to post
Share on other sites

#7 ·  Posted

KickStarter15,

See my edit above.

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

#8 ·  Posted

 

1 minute ago, Melba23 said:

TwistedXion,

Move the EndFunc line to after the WEnd - at the moment you end the function immediately you write the first set of ini elements.

Might I suggest installing the SciTE4AutoIt3 package (look under the "AutoIt Resources" menu) - that way you automatically get a whole slew of utilities to help you code, including Au3Check which would have picked up on this error.

M23

Okay, that make's sense.:D

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

3 minutes ago, KickStarter15 said:

Not sure if that make's any difference.

It does but did not help.

Edited by TwistedXion

Share this post


Link to post
Share on other sites

#10 ·  Posted

5 minutes ago, Melba23 said:

TwistedXion,

Move the EndFunc line to after the WEnd - at the moment you end the function immediately you write the first set of ini elements.

1

I had actually picked up on that myself but it still terminates after the first iniwrite  

Share this post


Link to post
Share on other sites

#11 ·  Posted

TwistedXion,

So post what you have now.

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

#12 ·  Posted

If I need it I can post everything I have so far

but here is everything pertaining to the func and the ini file

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#RequireAdmin

Global $fPath = @ScriptDir & "\Data\Path"
gamestart()

Func gamestart()

#Region ### START mm GUI section ### Form=
$mm = GUICreate("MainMenu", 238, 199, 337, 189)
$tName = GUICtrlCreateInput("", 64, 64, 113, 21)
$uName = GUICtrlCreateInput("", 64, 120, 113, 21)
GUICtrlCreateLabel("ToonName", 90, 40, 57, 17)
GUICtrlCreateLabel("UserName", 91, 96, 54, 17)
$Enter = GUICtrlCreateButton("Enter", 90, 151, 57, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END mm GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUIDelete($mm)
         Case $Enter
            $iniTName = GUICtrlRead($tName)
            $iniUName = GUICtrlRead($uName)
            MsgBox(1,"test", $iniTName & @LF & $iniUName)
            DirCreate($fPath)
            IniWrite($fPath & "\" & "InFo","Name","ToonName",$iniTName)
            Sleep(1000)
            MsgBox(1,"","wrote" & " " & $iniTName)
            IniWrite(fPath & "\" & "InFo","Name","UserName",$iniUName)
            Sleep(1000)
            MsgBox(1,"","wrote" & " " & $iniUName)


    EndSwitch
WEnd
EndFunc

 

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

the msg boxes are only for debugging so I could see how far the script was getting and if it was actually getting the input or not, it's getting all the info and displaying it in the msg box it just does not write the 2ed iniwrite to the inifile but it does the 1st one 

Edited by Melba23
Removed quote

Share this post


Link to post
Share on other sites

#14 ·  Posted

TwistedXion,

Try adding a leading $ to the path in the second IniWrite. Again a problem that would have been picked up by Au3Check (as it was for me just now)

And when you reply, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button which just pads the thread unnecessarily.

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

#15 ·  Posted (edited)

Thanks so much @Melba23 I feel like a noob now haha. Also, I went and got the program you mentioned.:D

Edited by TwistedXion

Share this post


Link to post
Share on other sites

#16 ·  Posted

TwistedXion,

So go and download SciTE4AutoIt3 - it saves a lot of those kind of moments......

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

#17 ·  Posted

I did get it as I mentioned in my last reply :p

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