GodForsakenSoul Posted January 2, 2010 Posted January 2, 2010 allright, i did my best to optimize this damn function. it works ALMOST perfectly. ALMOST. expandcollapse popupFunc PKANSCORE() $pkanscore1=IniRead("OPT.INI","ANSWERS","SCORE","0") $pkanscore2=StringSplit($pkanscore1,"") If $pkanscore2[0]<5 Or $pkanscore2[0]>5 Then ReDim $pkanscore2[6] Select Case $pkanscore2[1]="" $pkanscore2[1]=0 Case $pkanscore2[2]="" $pkanscore2[2]=0 Case $pkanscore2[3]="" $pkanscore2[3]=0 Case $pkanscore2[4]="" $pkanscore2[4]=0 Case $pkanscore2[5]="" $pkanscore2[5]=0 EndSelect EndIf GUICreate("Japanese basic training: Kana training",300,250) Opt("GuiCoordMode",0) GUICtrlCreatePic("Data\Graphics\MGO1.bmp",25,25,250,100) GUICtrlCreateLabel("Congratulations! Your score is...",0,120,250,20) GUICtrlCreatePic("Data\Graphics\MGN"&$pkanscore2[5]&".bmp",0,150,50,50) GUICtrlCreatePic("Data\Graphics\MGN"&$pkanscore2[4]&".bmp",25,0,50,50) GUICtrlCreatePic("Data\Graphics\MGN"&$pkanscore2[3]&".bmp",25,0,50,50) GUICtrlCreatePic("Data\Graphics\MGN"&$pkanscore2[2]&".bmp",25,0,50,50) GUICtrlCreatePic("Data\Graphics\MGN"&$pkanscore2[1]&".bmp",25,0,50,50) GUISetState() While 1=1 $pkansc=GUIGetMsg() Select case $pkansc=$GUI_EVENT_CLOSE GUIDelete() GUIMainGui() EndSelect Sleep(5000) GUIDelete() GUIMainGui() WEnd EndFunc the numbers, aren't showing. where did i mess up?
JohnOne Posted January 2, 2010 Posted January 2, 2010 (edited) Not sure if this is the problem but your array already has 6 elements when you redim 0-5 = 6, you might wat to try 7 EDIT: I could be wrong but you may have to use dim first in order to use redim Edited January 2, 2010 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
somdcomputerguy Posted January 2, 2010 Posted January 2, 2010 (edited) I just made a mistake in another post by not testing first, but I think Data\Graphics\MGN should be Data\Graphics\MGN\ Edited January 2, 2010 by snowmaker - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
martin Posted January 2, 2010 Posted January 2, 2010 (edited) @GodForsakenSoul Apart from any other parts of your script, such as snowmaker's comment, this bit looks all wrong to me. I know it's not what you are having a problem with but .. While 1=1 $pkansc=GUIGetMsg() Select;<--------------why have this select or have GuiGetMsg because even if not $GUI_EVENT_CLOSE then GUIMainGui will be called. case $pkansc=$GUI_EVENT_CLOSE GUIDelete() GUIMainGui() EndSelect Sleep[/url](5000) GUIDelete();<why delete the gui every 5 seconds? GUIMainGui();this means you will call GUIMainGui every 5 seconds WEnd Secondly, this construction below is designed to fail If $pkanscore2[0] < 5 Or > 5 Then ReDim $pkanscore2[6] Select Case $pkanscore2[1] = "" $pkanscore2[1] = 0 Case $pkanscore2[2] = "" $pkanscore2[2] = 0 Case $pkanscore2[3] = "" $pkanscore2[3] = 0 Case $pkanscore2[4] = "" $pkanscore2[4] = 0 Case $pkanscore2[5] = "" $pkanscore2[5] = 0 EndSelect EndIf If you have a select or a switch statement then the first case which satisfies the condition will be executed. If you have more than one element which is set to "" then you want to sett more than one to 0 presumably. So I would think this is better, (though I have no idea what you are trying to do.) If $pkanscore2[0] <> 5 Then ReDim $pkanscore2[6] For $n = 1 To 5 If $pkanscore2[$n] = "" Then $pkanscore2[$n] = 0 Next EndIf Edited January 2, 2010 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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