GodForsakenSoul Posted January 2, 2010 Share Posted January 2, 2010 expandcollapse popup#include "Include\GuiConstants.au3" #include "Include\GuiConstantsEx.au3" #include "Include\ButtonConstants.au3" #include "Include\EditConstants.au3" #include "Include\StaticConstants.au3" #include "FUNCMainFunc.au3" Func GUIMainGui() GUICreate("Japanese basic training",350,250) Opt("GuiCoordMode",0) $mbutton1=GUICtrlCreateButton("Practice Kana",50,50,100,20) $mbutton2=GUICtrlCreateButton("Practice Conjucation",0,30,150,20) $mbutton3=GUICtrlCreateButton("Options",0,30,150,20) $mbutton4=GUICtrlCreateButton("Exit",0,100,150,20) GUISetState() while 1=1 $mgmsg=GUIGetMsg() Select Case $mgmsg=$mbutton1 IniWrite("Data\OPT.INI","OPTIONS","BUTTONMG","1") Sleep(10) ExitLoop Case $mgmsg=$mbutton2 IniWrite("Data\OPT.INI","OPTIONS","BUTTONMG","2") Sleep(10) ExitLoop Case $mgmsg=$mbutton3 IniWrite("Data\OPT.INI","OPTIONS","BUTTONMG","3") Sleep(10) ExitLoop Case $mgmsg=$mbutton4 IniWrite("Data\OPT.INI","OPTIONS","BUTTONMG","4") Sleep(10) ExitLoop Case $mgmsg=$GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete() EndFunc Func GUIPKAN() $guipkan1=GUICreate("Japanese basic training: Kana training",200,200) Opt("GuiCoordMode",0) $pkanradio1=GUICtrlCreateRadio("Hiragana only",25,25,150,20) $pkanradio2=GUICtrlCreateRadio("Katakana only",0,20,150,20) $pkanradio3=GUICtrlCreateRadio("Both",0,20,150,20) GUICtrlCreateLabel("How many tries would you like to go through?",-20,30,200,30) $pkaninput1=GUICtrlCreateInput("100",20,30,150,20,$ES_NUMBER) $pkanbutton1=GUICtrlCreateButton("Start",40,20,75,20) GUICtrlSetState($pkanradio3,$GUI_CHECKED) GUISetState() while 1=1 $pkanmsg=GUIGetMsg() Select Case $pkanmsg=$pkanbutton1 $pkanradr1=GUICtrlRead($pkanradio1) $pkanradr2=GUICtrlRead($pkanradio2) $pkanradr3=GUICtrlRead($pkanradio3) Select Case $pkanradr1=$GUI_CHECKED IniWrite("Data\OPT.INI","OPTIONS","KANASET","1") Case $pkanradr2=$GUI_CHECKED IniWrite("Data\OPT.INI","OPTIONS","KANASET","2") Case $pkanradr3=$GUI_CHECKED IniWrite("Data\OPT.INI","OPTIONS","KANASET","3") EndSelect $pkaninr=GUICtrlRead($pkaninput1) IniWrite("Data\OPT.INI","OPTIONS","LOOPS",$pkaninr) PKANSPLASH() ExitLoop Case $pkanmsg=$GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete() EndFunc Func PKANSPLASH() $guipkan2=GUICreate("Japanese basic training: Kana training",350,150) Opt("GuiCoordMode",0) GUICtrlCreateLabel("In this training mode, A letter will show in the next window",10,15) GUICtrlCreateLabel("Input the correct romaji and hit ''next''",0,15) GUICtrlCreateLabel("After a while, you should uncheck ''Show images in Kana training''",0,15) GUICtrlCreateLabel("from the options to practice your memory",0,15) $pkansbut1=GUICtrlCreateButton("Start",50,50,50,20) GUISetState() while 1=1 $pkansmsg=GUIGetMsg() Select Case $pkansmsg=$pkansbut1 PKANTRAIN() Case $pkansmsg=$GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete() EndFunc Func PKANTRAIN() $pkantw=0 FUNCKanaPick() $pkantpic=IniRead("Data\OPT.ini","OPTIONS","FILENAME","0") GUICreate("Japanese basic training: Kana training",250,300) Opt("GuiCoordMode",0) $kanoptkan=IniRead("Data\OPT.INI","OPTIONS","KANASETTING","0") GUICtrlCreatePic($pkantpic,50,10,150,150) GUICtrlCreateLabel("Please input the correct letter",0,200,150,20) $pkantin=GUICtrlCreateInput("",25,30,100,20,$ES_UPPERCASE) $pkantbut=GUICtrlCreateButton("Next",25,30,50,20) GUISetState() While 1=1 $pkantmsg=GUIGetMsg() Select Case $pkantmsg=$pkantbut $pkantinr=GUICtrlRead($pkantin) IniWrite("Data\OPT.INI","ANSWERS","YA",$pkantinr) GUIDelete() FUNCCheckAnswer() Case $pkantmsg=$GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete() EndFunc expandcollapse popupFunc FUNCKanaPick() $kanafile=FileOpen("Data\KANA.ini",0) $kanawrite=FileOpen("Data\KANA.ini",2) if $kanafile=-1 Then MsgBox(0,"Error","Error: 001") Exit EndIf $rankan1=Random(1,46,1) $rankan2=Random(1,2,1) If $rankan2=1 Then $rankan2="H" ElseIf $rankan2=2 Then $rankan2="K" EndIf IniWrite("Data\OPT.ini","OPTIONS","FILENAME","Data\Graphics\"&$rankan2&$rankan1&".bmp") $kanpick=IniRead("KANA","KANA",$rankan1,"0") IniWrite("Data\OPT.INI","ANSWERS","CA",$kanpick) EndFunc Func FUNCCheckAnswer() $ans1=IniRead("Data\OPT.INI","ANSWERS","CA","0") $ans2=IniRead("Data\OPT.INI","ANSWERS","YA","0") If $ans1=$ans2 Then IniWrite("Data\OPT.INI","ANSWERS","RESULT","CORRECT") $score=IniRead("Data\OPT.INI","ANSWERS","SCORE","0") $score=$score+1 IniWrite("Data\OPT.INI","ANSWERS","SCORE",$score) Else $score=IniRead("Data\OPT.INI","ANSWERS","SCORE","0") IniWrite("Data\OPT.INI","ANSWERS","RESULT","INCORRECT") IniWrite("Data\OPT.INI","ANSWERS","SCORE",$score) EndIf $fcloopnum=IniRead("Data\OPT.INI","OPTIONS","CLOOP","0") $fcloopnum=$fcloopnum+1 IniWrite("Data\OPT.INI","OPTIONS","CLOOP",$fcloopnum) FUNCLoopUntil() EndFunc Func FUNCLoopUntil() $fllooptotal=IniRead("Data\OPT.INI","OPTIONS","LOOPS","1") $flloopcur=IniRead("Data\OPT.INI","OPTIONS","CLOOP","0") If $fllooptotal=$flloopcur Then Else ;GUICURSCORE() EndIf EndFunc Func FUNCResetIni() IniWrite("Data\OPT.INI","OPTIONS","BUTTON","0") IniWrite("Data\OPT.INI","OPTIONS","KANASET","0") IniWrite("Data\OPT.INI","OPTIONS","KANASETTING","0") IniWrite("Data\OPT.INI","OPTIONS","LOOPS","0") IniWrite("Data\OPT.INI","OPTIONS","FILENAME","0") IniWrite("Data\OPT.INI","OPTIONS","CLOOP","0") IniWrite("Data\OPT.INI","ANSWERS","CA","0") IniWrite("Data\OPT.INI","ANSWERS","YA","0") IniWrite("Data\OPT.INI","ANSWERS","RESULT","0") IniWrite("Data\OPT.INI","ANSWERS","SCORE","0") EndFunc Func FUNCKanaPick() $kanafile=FileOpen("Data\KANA.ini",0) $kanawrite=FileOpen("Data\KANA.ini",2) if $kanafile=-1 Then MsgBox(0,"Error","Error: 001") Exit EndIf $rankan1=Random(1,46,1) $rankan2=Random(1,2,1) If $rankan2=1 Then $rankan2="H" ElseIf $rankan2=2 Then $rankan2="K" EndIf IniWrite("Data\OPT.ini","OPTIONS","FILENAME","Data\Graphics\"&$rankan2&$rankan1&".bmp") $kanpick=IniRead("KANA","KANA",$rankan1,"0") IniWrite("Data\OPT.INI","ANSWERS","CA",$kanpick) EndFunc Func FUNCCheckAnswer() $ans1=IniRead("Data\OPT.INI","ANSWERS","CA","0") $ans2=IniRead("Data\OPT.INI","ANSWERS","YA","0") If $ans1=$ans2 Then IniWrite("Data\OPT.INI","ANSWERS","RESULT","CORRECT") $score=IniRead("Data\OPT.INI","ANSWERS","SCORE","0") $score=$score+1 IniWrite("Data\OPT.INI","ANSWERS","SCORE",$score) Else $score=IniRead("Data\OPT.INI","ANSWERS","SCORE","0") IniWrite("Data\OPT.INI","ANSWERS","RESULT","INCORRECT") IniWrite("Data\OPT.INI","ANSWERS","SCORE",$score) EndIf $fcloopnum=IniRead("Data\OPT.INI","OPTIONS","CLOOP","0") $fcloopnum=$fcloopnum+1 IniWrite("Data\OPT.INI","OPTIONS","CLOOP",$fcloopnum) FUNCLoopUntil() EndFunc Func FUNCLoopUntil() $fllooptotal=IniRead("Data\OPT.INI","OPTIONS","LOOPS","1") $flloopcur=IniRead("Data\OPT.INI","OPTIONS","CLOOP","0") If $fllooptotal=$flloopcur Then Else ;GUICURSCORE() EndIf EndFunc Func FUNCResetIni() IniWrite("Data\OPT.INI","OPTIONS","BUTTON","0") IniWrite("Data\OPT.INI","OPTIONS","KANASET","0") IniWrite("Data\OPT.INI","OPTIONS","KANASETTING","0") IniWrite("Data\OPT.INI","OPTIONS","LOOPS","0") IniWrite("Data\OPT.INI","OPTIONS","FILENAME","0") IniWrite("Data\OPT.INI","OPTIONS","CLOOP","0") IniWrite("Data\OPT.INI","ANSWERS","CA","0") IniWrite("Data\OPT.INI","ANSWERS","YA","0") IniWrite("Data\OPT.INI","ANSWERS","RESULT","0") IniWrite("Data\OPT.INI","ANSWERS","SCORE","0") EndFunc allright, this time i have TWO files. i'm sure this one sits in FUNCLoopUntil(). It doesn't actually stop the loop. imagine the function in the comment exists for a second. FUNCLoopUntil() doesn't actually send you to it when LOOPS and CLOOP become equal. I'm not sure why. Also, the include seems to be working only one way, and if i try to include file1 in file2, i get an include loop and all hell is breaking loose. ok, it just crashes, but it's still not very nice. i had another problem, but i seem to have lost it.... stay tuned. Link to comment Share on other sites More sharing options...
bogQ Posted January 2, 2010 Share Posted January 2, 2010 Can you explain why do you have 2 functions with the same code with the same name?!!Can you show where do you call FUNCLoopUntil() from first script?Did you try to see on what line script is standing?Opt("TrayIconDebug", 1) ;0=no info, 1=debug line info TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
GodForsakenSoul Posted January 2, 2010 Author Share Posted January 2, 2010 oh... crap, must have pressed ctrl v twice on the second one FUNCCheckAnswer() calls FUNCLoopUntil() in the end. also, i don't get that line of code. ._.;; clarify? Link to comment Share on other sites More sharing options...
GodForsakenSoul Posted January 2, 2010 Author Share Posted January 2, 2010 ok, i sorta fixed it.... for some retarded reason, it decided it's ok if i retype FUNCCheckAnswer(). like, literally, retype that line. the function is ok. it was also ok earlier because it DID go into the function.... i'm... very not sure what exactly happened here, not do i wish to dig in to find out.... 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