eXXe Posted September 3, 2008 Share Posted September 3, 2008 (edited) Hello Forum, Im using since some days autoit v3 and try to make an good programm for me but : I need 2 whiles workign at the same time, but how? My code where i need it : $count1 = 0 $count2 = 0 $count3 = 0 $count4 = 0 $count5 = 0 HotKeySet( "{F4}" , "_Train") Func _Train() While 1 If GuiCtrlRead($Checkbox1) = $GUI_CHECKED Then While 2 $count1 = $count1 + 1 $count2 = $count2 + 1 $count3 = $count3 + 1 $count4 = $count4 + 1 $count5 = $count5 + 1 Sleep(1000) WEnd EndIf If $count1 = (GUICtrlRead($Down1)) Then ;do something EndIf If $count2 = (GUICtrlRead($Down2)) Then ;do something EndIf If $count3 = (GUICtrlRead($Down3)) Then ;do something EndIf ;and much more WEnd EndFunc It shall do a countup till the down input, if the count is the same like the input, it shall do another thing. and all that with 6 things on one time. The countup doesn't have to be in the funtion. But it must run up +1 each second, and the other code must workign at the same time. Maybe my english is a bit bad, and i cant explain good, but please try to help me If you didn't understood, just ask me Ps. I used the documenation and the search function and google already Edited September 3, 2008 by eXXe Link to comment Share on other sites More sharing options...
evilertoaster Posted September 3, 2008 Share Posted September 3, 2008 I don't understand what you're trying to do exactly. If you use this code- $count1 = 0 $count2 = 0 $count3 = 0 $count4 = 0 $count5 = 0 HotKeySet( "{F4}" , "_Train") Func _Train() While 1 If GuiCtrlRead($Checkbox1) = $GUI_CHECKED Then $count1 = $count1 + 1 $count2 = $count2 + 1 $count3 = $count3 + 1 $count4 = $count4 + 1 $count5 = $count5 + 1 Sleep(1000) EndIf If $count1 = (GUICtrlRead($Down1)) Then ;do something EndIf If $count2 = (GUICtrlRead($Down2)) Then ;do something EndIf If $count3 = (GUICtrlRead($Down3)) Then ;do something EndIf ;and much more WEnd EndFunc What does lack that you want? Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 3, 2008 Share Posted September 3, 2008 Hello Forum, Im using since some days autoit v3 and try to make an good programm for me but : I need 2 whiles workign at the same time, but how? My code where i need it : $count1 = 0 $count2 = 0 $count3 = 0 $count4 = 0 $count5 = 0 HotKeySet( "{F4}" , "_Train") Func _Train() While 1 If GuiCtrlRead($Checkbox1) = $GUI_CHECKED Then While 2 $count1 = $count1 + 1 $count2 = $count2 + 1 $count3 = $count3 + 1 $count4 = $count4 + 1 $count5 = $count5 + 1 Sleep(1000) WEnd EndIf If $count1 = (GUICtrlRead($Down1)) Then ;do something EndIf If $count2 = (GUICtrlRead($Down2)) Then ;do something EndIf If $count3 = (GUICtrlRead($Down3)) Then ;do something EndIf ;and much more WEnd EndFunc It shall do a countup till the down input, if the count is the same like the input, it shall do another thing. and all that with 6 things on one time. The countup doesn't have to be in the funtion. But it must run up +1 each second, and the other code must workign at the same time. Maybe my english is a bit bad, and i cant explain good, but please try to help me If you didn't understood, just ask me Ps. I used the documenation and the search function and google already More like this (removed references to GUI inputs we don't have): Global $count1 = 0, $count2 = 0, $count3 = 0, $count4 = 0, $count5 = 0 HotKeySet("{F4}", "_Train") HotKeySet("{ESC}", "_Quit") While 1 Sleep(20) WEnd Func _Train() AdlibEnable("_Increment", 1000) While 1 If $count1 = 5 Then MsgBox(64, "Five", "Five seconds", 2) If $count3 = 10 Then MsgBox(64, "Ten", "Ten seconds", 2) If $count5 = 15 Then MsgBox(64, "Fifteen", "Fifteen seconds", 2) If $count2 = 20 Then Exit WEnd EndFunc ;==>_Train Func _Increment() $count1 += 1 $count2 += 1 $count3 += 1 $count4 += 1 $count5 += 1 EndFunc ;==>_Increment Func _Quit() Exit EndFunc ;==>_Quit Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
eXXe Posted September 4, 2008 Author Share Posted September 4, 2008 (edited) That dont really slove my problem: what i would need is a while that is working, while another is working at the same time, like this: While 1 While 2 ;Count up all time here $count1 = $count1 + 1 $count2 = $count2 + 1 $count3 = $count3 + 1 $count4 = $count4 + 1 $count5 = $count5 + 1 Sleep(1000) Wend ;And while its counting up it shall do other things, ;More than just use the counts Wend ok i think you dont understand this better I post all my code here that you know what i mean expandcollapse popupFunc _example() While 1 While 2 $count1 = $count1 + 1 $count2 = $count2 + 1 $count3 = $count3 + 1 $count4 = $count4 + 1 $count5 = $count5 + 1 Sleep(1000) WEnd If GuiCtrlRead($Checkbox1) < $GUI_CHECKED Then;Skill1 ;~ If $count1 = (GUICtrlRead($Down1)) Then If GuiCtrlRead($Autoloot) = $GUI_CHECKED Then;Autoloot Sleep ( 100 ) ControlSend("Archlord", "", "","{SPACE}") Sleep ( 100 ) ControlSend("Archlord", "", "","{SPACE}") Sleep ( 100 ) Else EndIf;Autoloot Ende ControlSend("Archlord", "", "",(GUICtrlRead($Slot3)));Command senden Skill 1 ;~ $count1 = 0 Sleep ( (GUICtrlRead($Delay3)) );Sleep Skill 1 If GuiCtrlRead($Aoe) = $GUI_CHECKED Then;AoE ControlSend("Archlord", "", "","{TAB}") Sleep( 100 ) Else EndIf;AoE Ende ;~ EndIf Else EndIf Wend Endfunc ok i didnt posted all my code that are more than 400 lines there you see, When its using a skill, its sets the count = 0 and while its using another skills, it shall count up(the dowm time) and only use the skill if the count is already = or < the downtime. The bot uses skills, and just use one again if the cooltime is already down.. Hope you understood now And it doesn't have to check the downtime like this if you know another way just tell me Edited September 4, 2008 by eXXe Link to comment Share on other sites More sharing options...
BrettF Posted September 4, 2008 Share Posted September 4, 2008 Hi, AutoIt doesn't currently have multithreading capability, but it is worth having a look at AdLibEnable. Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
eXXe Posted September 4, 2008 Author Share Posted September 4, 2008 AdlibEnable("test", 1000) count1 = count1 +1 Exit Func test() While 1 ;All my code? Wend EndFunc Whoudl that Adlib count every 1 second 1 up for me? Link to comment Share on other sites More sharing options...
BrettF Posted September 4, 2008 Share Posted September 4, 2008 Wow... I don't think you even got as far as running the example. Heres another one that I hope you will apreciate. $count = 0 AdlibEnable("myadlib") While 1 If $count >= 1000 Then Exit WEnd Func myadlib() ToolTip("Tool Tip (Count is " & $count & ")") $count += 1 EndFunc ;==>myadlib Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
martin Posted September 4, 2008 Share Posted September 4, 2008 That dont really slove my problem: what i would need is a while that is working, while another is working at the same time, like this: While 1 While 2 ;Count up all time here $count1 = $count1 + 1 $count2 = $count2 + 1 $count3 = $count3 + 1 $count4 = $count4 + 1 $count5 = $count5 + 1 Sleep(1000) Wend ;And while its counting up it shall do other things, ;More than just use the counts Wend ok i think you dont understand this better I post all my code here that you know what i mean expandcollapse popupFunc _example() While 1 While 2 $count1 = $count1 + 1 $count2 = $count2 + 1 $count3 = $count3 + 1 $count4 = $count4 + 1 $count5 = $count5 + 1 Sleep(1000) WEnd If GuiCtrlRead($Checkbox1) < $GUI_CHECKED Then;Skill1 ;~ If $count1 = (GUICtrlRead($Down1)) Then If GuiCtrlRead($Autoloot) = $GUI_CHECKED Then;Autoloot Sleep ( 100 ) ControlSend("Archlord", "", "","{SPACE}") Sleep ( 100 ) ControlSend("Archlord", "", "","{SPACE}") Sleep ( 100 ) Else EndIf;Autoloot Ende ControlSend("Archlord", "", "",(GUICtrlRead($Slot3)));Command senden Skill 1 ;~ $count1 = 0 Sleep ( (GUICtrlRead($Delay3)) );Sleep Skill 1 If GuiCtrlRead($Aoe) = $GUI_CHECKED Then;AoE ControlSend("Archlord", "", "","{TAB}") Sleep( 100 ) Else EndIf;AoE Ende ;~ EndIf Else EndIf Wend Endfunc ok i didnt posted all my code that are more than 400 lines there you see, When its using a skill, its sets the count = 0 and while its using another skills, it shall count up(the dowm time) and only use the skill if the count is already = or < the downtime. The bot uses skills, and just use one again if the cooltime is already down.. Hope you understood now And it doesn't have to check the downtime like this if you know another way just tell me It looks to me like PsaltyDS has already given you the solution. You use AdlibEnable to call a function which has your counting in it but without the while 2 like this expandcollapse popupFunc _example() AdLIbEnable("Counting",1000);calls the counting function every 1000ms so same as your while 2 loop While 1 If GuiCtrlRead($Checkbox1) < $GUI_CHECKED Then;Skill1 ;~ If $count1 = (GUICtrlRead($Down1)) Then If GuiCtrlRead($Autoloot) = $GUI_CHECKED Then;Autoloot Sleep ( 100 ) ControlSend("Archlord", "", "","{SPACE}") Sleep ( 100 ) ControlSend("Archlord", "", "","{SPACE}") Sleep ( 100 ) Else EndIf;Autoloot Ende ControlSend("Archlord", "", "",(GUICtrlRead($Slot3)));Command senden Skill 1 ;~ $count1 = 0 Sleep ( (GUICtrlRead($Delay3)) );Sleep Skill 1 If GuiCtrlRead($Aoe) = $GUI_CHECKED Then;AoE ControlSend("Archlord", "", "","{TAB}") Sleep( 100 ) Else EndIf;AoE Ende ;~ EndIf Else EndIf Wend AdLibDisable() Endfunc Func Counting() $count1 = $count1 + 1 $count2 = $count2 + 1 $count3 = $count3 + 1 $count4 = $count4 + 1 $count5 = $count5 + 1 endfunc 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. Link to comment Share on other sites More sharing options...
eXXe Posted September 4, 2008 Author Share Posted September 4, 2008 (edited) Ok i think i got it now, have to try some things Thanx BrettF Edited September 4, 2008 by eXXe 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