TwistedXion Posted July 17, 2017 Share Posted July 17, 2017 (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 July 17, 2017 by TwistedXion Link to comment Share on other sites More sharing options...
KickStarter15 Posted July 17, 2017 Share Posted July 17, 2017 Hi @TwistedXion, I think you've missed to check our forum rules in your way when posting game automation. Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare. Link to comment Share on other sites More sharing options...
TwistedXion Posted July 17, 2017 Author Share Posted July 17, 2017 (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. 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 July 17, 2017 by TwistedXion Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 17, 2017 Moderators Share Posted July 17, 2017 (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 July 17, 2017 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
KickStarter15 Posted July 17, 2017 Share Posted July 17, 2017 Not sure if that make's any difference. Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare. Link to comment Share on other sites More sharing options...
TwistedXion Posted July 17, 2017 Author Share Posted July 17, 2017 Yes have fixed that already and still no dice Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 17, 2017 Moderators Share Posted July 17, 2017 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
KickStarter15 Posted July 17, 2017 Share Posted July 17, 2017 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. Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare. Link to comment Share on other sites More sharing options...
TwistedXion Posted July 17, 2017 Author Share Posted July 17, 2017 (edited) 3 minutes ago, KickStarter15 said: Not sure if that make's any difference. It does but did not help. Edited July 17, 2017 by TwistedXion Link to comment Share on other sites More sharing options...
TwistedXion Posted July 17, 2017 Author Share Posted July 17, 2017 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 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 17, 2017 Moderators Share Posted July 17, 2017 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
TwistedXion Posted July 17, 2017 Author Share Posted July 17, 2017 If I need it I can post everything I have so far but here is everything pertaining to the func and the ini file expandcollapse popup#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 Link to comment Share on other sites More sharing options...
TwistedXion Posted July 17, 2017 Author Share Posted July 17, 2017 (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 July 17, 2017 by Melba23 Removed quote Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 17, 2017 Moderators Share Posted July 17, 2017 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
TwistedXion Posted July 17, 2017 Author Share Posted July 17, 2017 (edited) Thanks so much @Melba23 I feel like a noob now haha. Also, I went and got the program you mentioned. Edited July 17, 2017 by TwistedXion Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 17, 2017 Moderators Share Posted July 17, 2017 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
TwistedXion Posted July 17, 2017 Author Share Posted July 17, 2017 I did get it as I mentioned in my last reply :p Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now