Mike :) Posted December 27, 2005 Share Posted December 27, 2005 (edited) Hi Everyone I'm new to this forum, but i'm trying to learn AutoIt as hard as I can Well, what I'm doing now is script for a game which would basically play for me And, I have problems with GUICtrlSetState function. I'm trying to make this script create config.ini and save some informations inside to read them later and paste into correct places. It worked for input box, though I have problems with Radio boxes. Please take a look at this: GUICtrlCreateGroup ("", 4, 1, 100, 107) GUICtrlCreateLabel("Game resolution", 10, 9) GUICtrlSetColor(-1, 0xFFFFFF) $res1 = GUICtrlCreateRadio ("640x480", 10, 24, 90) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent ( $res1, "GUI_CHECKED" ) $res2 = GUICtrlCreateRadio ("800x600", 10, 44, 90) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent ( $res2, "GUI_CHECKED" ) $res3 = GUICtrlCreateRadio ("1024x768", 10, 64, 90) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent ( $res3, "GUI_CHECKED" ) $res4 = GUICtrlCreateRadio ("1280x1024", 10, 84, 90) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent ( $res4, "GUI_CHECKED" ) $resauto = IniRead ("config.ini", "Config", "Res", "$res2") GUICtrlSetState($resauto, $GUI_CHECKED) GUICtrlCreateGroup ("",-99,-99,1,1) Here's part of gui with "spaced out" part where problem occurs. Here's the part saving config.ini: $file = IniWrite("config.ini", "Config", "Sleep", GUICtrlRead($sleep1)) If GUICtrlRead($res1) = $GUI_CHECKED Then IniWrite("config.ini", "Config", "Res", "$res1") ElseIf GUICtrlRead($res2) = $GUI_CHECKED Then IniWrite("config.ini", "Config", "Res", "$res2") ElseIf GUICtrlRead($res3) = $GUI_CHECKED Then IniWrite("config.ini", "Config", "Res", "$res3") ElseIf GUICtrlRead($res4) = $GUI_CHECKED Then IniWrite("config.ini", "Config", "Res", "$res4") EndIf If $file = -1 Then MsgBox(0, "Error", "Cannot open log file.") EndIf I know it's not really a good code, but it should really work O_o. I wonder if GUICtrlSetState is trying to $GUI_CHECKED on $resauto instead of reading it? Can anyone help? Please, I was trying to fix that for hours and no success Also checked $resauto, and it has the right variable inside ($res2) Well, If you don't understand what I wrote here (it's pretty complicated i guess) I'll try to explain the whole idea. This part of code is Radio group of resolution choice, and in closing gui event it's writting name of radio which was previously checked to config.ini file. Then, when i open it again, it's reading from config again and it SHOULD CHECK THE RIGHT RADIO but it doesn't T_T. Ok, one more question: I'm trying to declare a variable like this: $loot = Send("{SPACE}") then use just $loot inside the code to "call" it, and I try to run the script it tells me that the line cannot be parsed. Should I use string or something? Ok, here's the whole code of my script (sorry for length), also sorry for my bad english ^^: expandcollapse popup#include <GUIConstants.au3> Break(0) Opt("GUIOnEventMode", 1); Change to OnEvent mode $mainwindow = GUICreate("MU Afk Complex", 615, 220) GUISetBkColor (0x51606C) $menu = GUICtrlCreateMenu ( "Menu") $about = GUICtrlCreateMenuitem ("About", $menu) GUICtrlSetOnEvent ( $about, "About" ) $quit = GUICtrlCreateMenuitem ("Exit", $menu) GUICtrlSetOnEvent ( $quit, "CLOSEClicked" ) GUISetState() GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") ;@@@@@@@@@@@@@ Resolution Box @@@@@@@@@@@@@@@@@@ GUICtrlCreateGroup ("", 4, 1, 100, 107) GUICtrlCreateLabel("Game resolution", 10, 9) GUICtrlSetColor(-1, 0xFFFFFF) $res1 = GUICtrlCreateRadio ("640x480", 10, 24, 90) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent ( $res1, "GUI_CHECKED" ) $res2 = GUICtrlCreateRadio ("800x600", 10, 44, 90) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent ( $res2, "GUI_CHECKED" ) $res3 = GUICtrlCreateRadio ("1024x768", 10, 64, 90) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent ( $res3, "GUI_CHECKED" ) $res4 = GUICtrlCreateRadio ("1280x1024", 10, 84, 90) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent ( $res4, "GUI_CHECKED" ) $resauto = IniRead ("config.ini", "Config", "Res", "$res2") GUICtrlSetState($resauto, $GUI_CHECKED) GUICtrlCreateGroup ("",-99,-99,1,1) ;@@@@@@@@@@@@@@@@@Afk box @@@@@@@@@@@@@@ GUICtrlCreateGroup ("", 4, 110, 240, 87) GUICtrlCreateLabel ("Choose your AFK mode.", 10, 118) GUICtrlSetColor(-1, 0xFFFFFF) $afk1 = GUICtrlCreateRadio ("Autobuff with SmartHealing (800x600 only)", 10, 133, 230) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent ( $afk1, "Opt_Check" ) $afk2 = GUICtrlCreateRadio ("Autobuff", 10, 153, 80) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent ( $afk2, "Opt_Check" ) GUICtrlCreateGroup ("",-99,-99,1,1) ;@@@@@@@@@@@@@@@@@Pickup and vpc box@@@@@@@@@@@@@ $autoloot = GUICtrlCreateCheckbox ("Auto PickUp", 255, 115) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent ( $autoloot, "GUI_CHECKED" ) GUICtrlCreateLabel ("Number of people in party:", 255, 150) GUICtrlSetColor( -1, 0xFFFFFF) $number = GUICtrlCreateCombo ("", 255,170) GUICtrlSetData(-1,"2|3|4|5") GUICtrlSetColor($number, 0xFFFFFF) ;@@@@@@@@@@@@@@@@@@@Buff time box@@@@@@@@@@@@@@@@@@ GUICtrlCreateLabel ("Input the gap time between Buff cycles (in ms):", 130, 4) GUICtrlSetColor(-1, 0xFFFFFF) $sleep1 = GUICtrlCreateInput ("", 140, 25, 200, 20) GUICtrlSetLimit(-1,5) $sleepdef = IniRead("config.ini", "Config", "Sleep", "0") GUICtrlSetData ( $sleep1, $sleepdef ) $button2 = GUICtrlCreateButton ("", 120, 50, 270, 50, $BS_ICON) GUICtrlSetImage (-1, "shell32.dll",146) GUICtrlSetOnEvent ( $button2, "Button" ) ;@@@@@@@@@@@@@@@@@@@@Buff types #1@@@@@@@@@@@@@@@@@@@@@ GUICtrlCreateGroup ("Party Member #1", 400, 1, 100, 80) $def1 = GUICtrlCreateCheckbox ("Defense Buff", 408, 15) GUICtrlSetColor(-1, 0xFFFFFF) $att1= GUICtrlCreateCheckbox ("Attack Buff", 408, 35) GUICtrlSetColor(-1, 0xFFFFFF) $heal1= GUICtrlCreateCheckbox ("Heal", 408, 55) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlCreateGroup ("",-99,-99,1,1) ;@@@@@@@@@@@@@@@@@@@@Buff types #2@@@@@@@@@@@@@@@@@@@@@ GUICtrlCreateGroup ("Party Member #2", 400, 85, 100, 80) $def2 = GUICtrlCreateCheckbox ("Defense Buff", 408, 99) GUICtrlSetColor(-1, 0xFFFFFF) $att2= GUICtrlCreateCheckbox ("Attack Buff", 408, 113) GUICtrlSetColor(-1, 0xFFFFFF) $heal2= GUICtrlCreateCheckbox ("Heal", 408, 127) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlCreateGroup ("",-99,-99,1,1) ;@@@@@@@@@@@@@@@@@@@@Buff types #3@@@@@@@@@@@@@@@@@@@@@ GUICtrlCreateGroup ("Party Member #3", 400, 150, 100, 80) $def3 = GUICtrlCreateCheckbox ("Defense Buff", 408, 164) GUICtrlSetColor(-1, 0xFFFFFF) $att3= GUICtrlCreateCheckbox ("Attack Buff", 408, 178) GUICtrlSetColor(-1, 0xFFFFFF) $heal3= GUICtrlCreateCheckbox ("Heal", 408, 192) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlCreateGroup ("",-99,-99,1,1) ;@@@@@@@@@@@@@@@@@@@@Buff types #4@@@@@@@@@@@@@@@@@@@@@ GUICtrlCreateGroup ("Party Member #3", 505, 1, 100, 80) $def4 = GUICtrlCreateCheckbox ("Defense Buff", 513, 15) GUICtrlSetColor(-1, 0xFFFFFF) $att4= GUICtrlCreateCheckbox ("Attack Buff", 513, 29) GUICtrlSetColor(-1, 0xFFFFFF) $heal4= GUICtrlCreateCheckbox ("Heal", 513, 43) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlCreateGroup ("",-99,-99,1,1) ;@@@@@@@@@@@@@@@@@@@@Buff types #5@@@@@@@@@@@@@@@@@@@@@ GUICtrlCreateGroup ("Party Member #3", 505, 85, 100, 80) $def5 = GUICtrlCreateCheckbox ("Defense Buff", 513, 99) GUICtrlSetColor(-1, 0xFFFFFF) $att5= GUICtrlCreateCheckbox ("Attack Buff", 513, 113) GUICtrlSetColor(-1, 0xFFFFFF) $heal5= GUICtrlCreateCheckbox ("Heal", 513, 127) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlCreateGroup ("",-99,-99,1,1) Func CLOSEClicked1() GUIDelete() EndFunc Func CLOSEClicked() $file = IniWrite("config.ini", "Config", "Sleep", GUICtrlRead($sleep1)) If GUICtrlRead($res1) = $GUI_CHECKED Then IniWrite("config.ini", "Config", "Res", "$res1") ElseIf GUICtrlRead($res2) = $GUI_CHECKED Then IniWrite("config.ini", "Config", "Res", "$res2") ElseIf GUICtrlRead($res3) = $GUI_CHECKED Then IniWrite("config.ini", "Config", "Res", "$res3") ElseIf GUICtrlRead($res4) = $GUI_CHECKED Then IniWrite("config.ini", "Config", "Res", "$res4") EndIf If $file = -1 Then MsgBox(0, "Error", "Cannot open log file.") EndIf Exit EndFunc Func GUI_CHECKED() If GUICtrlRead ( $res2 ) = $GUI_CHECKED Then Global $buff1x = 775 Global $buff1y = 42 Global $buff2x = 775 Global $buff2y = 72 Global $buff3x = 775 Global $buff3y = 92 Global $buff4x = 775 Global $buff4y = 115 Global $buff5x = 775 Global $buff5y = 140 Global $buffx = 799 Global $buffy = 599 Global $afkx = 400 Global $afky = 300 ElseIf GUICtrlRead ( $res1 ) = $GUI_CHECKED Then Global $buff1x = 620 Global $buff1y = 32 Global $buff2x = 620 Global $buff2y = 62 Global $buff3x = 620 Global $buff3y = 82 Global $buff4x = 620 Global $buff4y = 105 Global $buff5x = 620 Global $buff5y = 130 Global $buffx = 620 Global $buffy = 450 Global $afkx = 320 Global $afky = 240 ElseIf GUICtrlRead ( $res3 ) = $GUI_CHECKED Then Global $buff1x = 999 Global $buff1y = 52 Global $buff2x = 999 Global $buff2y = 83 Global $buff3x = 999 Global $buff3y = 102 Global $buff4x = 999 Global $buff4y = 125 Global $buff5x = 999 Global $buff5y = 150 Global $buffx = 999 Global $buffy = 578 Global $afkx = 512 Global $afky = 384 ElseIf GUICtrlRead ( $res4 ) = $GUI_CHECKED Then Global $buff1x = 1260 Global $buff1y = 62 Global $buff2x = 1260 Global $buff2y = 93 Global $buff3x = 1260 Global $buff3y = 112 Global $buff4x = 1260 Global $buff4y = 135 Global $buff5x = 1260 Global $buff5y = 160 Global $buffx = 1260 Global $buffy = 1200 Global $afkx = 640 Global $afky = 512 EndIf EndFunc Func Opt_Check() If GUICtrlRead ( $afk1 ) = $GUI_CHECKED Then Global $afkmode = "Autobuff" ElseIf GUICtrlRead ( $afk2 ) = $GUI_CHECKED Then Global $afkmode = "Autobuff2" EndIf EndFunc Func Pick() Send("{SPACE}") EndFunc Func HK_STOP() while 1 = 1 Sleep(1000) wend EndFunc Func Button() WinMinimizeAll() HotKeySet("{F5}", "HK_STOP") HotKeySet("{F6}", $afkmode) TrayTip("", "To run script press F6. To stop it, press F5", 5, 1) EndFunc Func About() GUICreate ("About", 300, 170) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked1") GUICtrlCreateLabel ("MU AFK Complex is a script written in AutoIt language to help MATIRA guild people leave AFK. Current options:", 2, 2, 295, 40) GUICtrlCreateLabel ("- Multi Resolution", 40, 50, 240, 250) GUICtrlCreateLabel ("- Autobuff with SmartHealing", 40, 65, 240, 250) GUICtrlCreateLabel ("- Auto PickUp", 40, 80, 240, 250) GUICtrlCreateLabel ("Current version is: 0.59. If you encounter any problems e-mail me and I'll try to fix the problem: gokkkkuuuu@poczta.fm", 2, 118, 295, 250) GUISetState() EndFunc While 1 Sleep(1000) WEnd Func Autobuff() While(1) Call ("Auto") Call ("SmartHeal") MouseMove ( $buffx,$buffy ,1 ) Sleep($sleep1 / 2) Send("1") MouseMove ( 400,300 ,1 ) MouseClick("Right", 400,300) Sleep($sleep1 / 2) Wend Endfunc Func Autobuff2() While (1) Call ("Autobuff1") Call ("HealF") $x = mod(GUICtrlRead($sleep1), 2) MouseMove ( $buffx,$buffy ,1 ) Sleep($x) Send("1") MouseMove ( 400,300 ,1 ) MouseClick("Right", 400,300) Sleep($x) Wend EndFunc ;@@@@@@@@@@@@@@@@@@@@@@@@ Resources @@@@@@@@@@@@@@@@@ ;Autobuff with checking frame Func Auto() Opt("MouseClickDownDelay", 1) Opt("MouseCoordMode", 1) Opt("SendKeyDownDelay", 70) MsgBox ( 0, "loading", "loading", 1) Opt("SendKeyDelay", 1) Opt("SendKeyDownDelay", 1) ;@@@@@@@@@@@STARTS def buff @@@@@@@@@@@ Send("2") Sleep(50) If GUICtrlRead ( $def1 ) = 1 OR 0 Then MouseMove ( $buff1x,$buff1y ,1 ) MouseClick("Right",$buff1x,$buff1y) MsgBox ( 0, "loading", "loading", 1) GUICtrlRead ( $loot ) Else MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) EndIf MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) Send("2") ;@@@@@@@@@@@@DEF 2ND PLAYER@@@@@@@@@@@@ Send("2") If GUICtrlRead ( $def2 ) = 1 OR 0 Then MouseMove ( $buff2x,$buff2y ,1 ) MouseClick("Right",$buff2x,$buff2y) MsgBox ( 0, "loading", "loading", 1) GUICtrlRead ( $loot ) Else MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) EndIf MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) ;@@@@@@@@@@@@DEF 3RD PLAYER@@@@@@@@@@@@ Send("2") If GUICtrlRead ( $def3 ) = 1 OR 0 Then MouseMove ( $buff3x,$buff3y ,1 ) MouseClick("Right",$buff3x,$buff3y) MsgBox ( 0, "loading", "loading", 1) GUICtrlRead ( $loot ) Else MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) EndIf MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) ;@@@@@@@@@@@@DEF 4TH PLAYER@@@@@@@@@@@@ Send("2") If GUICtrlRead ( $def4 ) = 1 OR 0 Then MouseClick("Right",$buff4x,$buff4y) MsgBox ( 0, "loading", "loading", 1) GUICtrlRead ( $loot ) Else MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) EndIf MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) ;@@@@@@@@@@@@DEF 5TH PLAYER@@@@@@@@@@@@ Send("2") If GUICtrlRead ( $def5 ) = 1 OR 0 Then MouseMove ( $buff5x,$buff5y ,1 ) MouseClick("Right",$buff5x,$buff5y) MsgBox ( 0, "loading", "loading", 1) GUICtrlRead ( $loot ) Else MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) EndIf MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) ;@@@@@@@@@@@ATT 1ST PLAYER@@@@@@@@@@@@@ If GUICtrlRead ( $att1 ) = 1 OR 0 Then Send("3") MouseMove ( $buff1x,$buff1y ,1 ) MouseMove ( $buff1x,$buff1y ,1 ) MouseClick("Right",$buff1x,$buff1y) MsgBox ( 0, "loading", "loading", 1) GUICtrlRead ( $loot ) Else MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) EndIf MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) ;@@@@@@@@@@@@ATT 2ND PLAYER@@@@@@@@@@@@ Send("3") If GUICtrlRead ( $att2 ) = 1 OR 0 Then Send("3") MouseMove ( $buff2x,$buff2y ,1 ) MouseClick("Right",$buff2x,$buff2y) MsgBox ( 0, "loading", "loading", 1) GUICtrlRead ( $loot ) Else MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) EndIf MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) ;@@@@@@@@@@@@ATT 3RD PLAYER@@@@@@@@@@@@ Send("3") If GUICtrlRead ( $att3 ) = 1 OR 0 Then Send("3") MouseMove ( $buff3x,$buff3y ,1 ) MouseClick("Right",$buff3x,$buff3y) MsgBox ( 0, "loading", "loading", 1) GUICtrlRead ( $loot ) Else MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) EndIf MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) ;@@@@@@@@@@@@ATT 4TH PLAYER@@@@@@@@@@@@ Send("3") If GUICtrlRead ( $att4 ) = 1 OR 0 Then Send("3") MouseMove ( $buff4x,$buff4y ,1 ) MouseClick("Right",$buff4x,$buff4y) MsgBox ( 0, "loading", "loading", 1) GUICtrlRead ( $loot ) Else MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) EndIf MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) ;@@@@@@@@@@@@ATT 5TH PLAYER@@@@@@@@@@@@ Send("3") If GUICtrlRead ( $att5 ) = 1 OR 0 Then MouseMove ( $buff5x,$buff5y ,1 ) MouseClick("Right",$buff5x,$buff5y) MsgBox ( 0, "loading", "loading", 1) GUICtrlRead ( $loot ) Else MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) EndIf Send("3") MouseMove ( $buffx,$buffy ,1 ) MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) EndFunc ;SmartHealing Func SmartHeal() $kolor1 = PixelGetColor( 785,48 ) $kolor2 = PixelGetColor( 785,72 ) $kolor3 = PixelGetColor( 785,96 ) $kolor4 = PixelGetColor( 785,118 ) $kolor5 = PixelGetColor( 785,121 ) If $kolor1 < 10000000 Then Send("1") Sleep(300) MouseMove ( 770,48 ,1 ) MouseClick("Right", 770,48) TrayTip("Healed", "Party member #1 - Healed", 5) TrayTip("Healed", "", 2) MsgBox ( 0, "loading", "loading", 1) MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) ElseIf $kolor1 > 10000000 Then TrayTip("Healed", "Party member #1 - No need heal", 5) TrayTip("Healed", "", 2) Sleep(300) GUICtrlRead ( $loot ) EndIf If $kolor2 < 10000000 Then Send("1") Sleep(300) MouseMove ( 770,72 ,1 ) MouseClick("Right", 770,72) TrayTip("Healed", "Party member #2 - Healed", 2) TrayTip("Healed", "", 2) MsgBox ( 0, "loading", "loading", 1) MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) ElseIf $kolor2 > 10000000 Then TrayTip("Healed", "Party member #2 - No need heal", 2) TrayTip("Healed", "", 2) Sleep(300) GUICtrlRead ( $loot ) EndIf If $kolor3 < 10000000 AND $number = 3 OR 4 OR 5 Then Send("1") Sleep(300) MouseMove ( 770,98 ,1 ) MouseClick("Right", 770,98) TrayTip("Healed", "Party member #3 - Healed", 2) TrayTip("Healed", "", 2) MsgBox ( 0, "loading", "loading", 1) MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) ElseIf $kolor3 > 10000000 AND $number >= 3 Then TrayTip("Healed", "Party member #3 - No need heal", 2) TrayTip("Healed", "", 2) Sleep(300) GUICtrlRead ( $loot ) ElseIf $number = 2 Then Sleep (1) EndIf If $kolor4 < 10000000 AND $number = 4 OR $number = 5 Then Send("1") Sleep(300) MouseMove ( 770,120 ,1 ) MouseClick("Right", 770,120) TrayTip("Healed", "Party member #4 - Healed", 2) TrayTip("Healed", "", 2) MsgBox ( 0, "loading", "loading", 1) MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) ElseIf $kolor4 > 10000000 AND $number = 4 Then TrayTip("Healed", "Party member #4 - No need heal", 2) TrayTip("Healed", "", 2) Sleep(300) GUICtrlRead ( $loot ) ElseIf $number < 4 Then GUICtrlRead ( $loot ) Else GUICtrlRead ( $loot ) EndIf If $kolor5 < 10000000 AND $number = 5 Then Send("1") Sleep(300) MouseMove ( 770,144 ,1 ) MouseClick("Right", 770,144) TrayTip("Healed", "Party member #5 - Healed", 2) MsgBox ( 0, "loading", "loading", 1) MouseMove ( $buffx,$buffy ,1 ) ElseIf $kolor5 > 10000000 AND $number = 5 Then TrayTip("clearing","",0) TrayTip("Healed", "Party member #5 - No need heal", 2) Sleep(300) GUICtrlRead ( $loot ) ElseIf $number < 5 Then GUICtrlRead ( $loot ) Else GUICtrlRead ( $loot ) EndIf EndFunc ;Healing with check frame Func HealF() ;@@@@@@@@@@@@@@@@@AUTO HEAL@@@@@@@@@@ MsgBox ( 0, "loading", "loading", 1) ;@@@@@@@@@@@HEAL 1ST PLAYER@@@@@@@@@@@@@ If GUICtrlRead ( $heal1 ) = 1 OR 0 Then Send("1") MouseMove ( $buff1x,$buff1y ,1 ) MouseClick("Right",$buff1x,$buff1y) MsgBox ( 0, "loading", "loading", 1) GUICtrlRead ( $loot ) Else MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) EndIf Send("1") MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) ;@@@@@@@@@@@@HEAL 2ND PLAYER@@@@@@@@@@@@ If GUICtrlRead ( $heal2 ) = 1 OR 0 Then Send("1") MouseMove ( $buff2x,$buff2y ,1 ) MouseClick("Right",$buff2x,$buff2y) MsgBox ( 0, "loading", "loading", 1) GUICtrlRead ( $loot ) Else MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) EndIf Send("1") MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) ;@@@@@@@@@@@@HEAL 3RD PLAYER@@@@@@@@@@@@ If GUICtrlRead ( $heal3 ) = 1 OR 0 Then Send("1") MouseMove ( $buff3x,$buff3y ,1 ) MouseClick("Right",$buff3x,$buff3y) MsgBox ( 0, "loading", "loading", 1) GUICtrlRead ( $loot ) Else MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) EndIf Send("1") MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) ;@@@@@@@@@@@@HEAL 4TH PLAYER@@@@@@@@@@@@ If GUICtrlRead ( $heal4 ) = 1 OR 0 Then Send("1") MouseMove ( $buff4x,$buff4y ,1 ) MouseClick("Right",$buff4x,$buff4y) MsgBox ( 0, "loading", "loading", 1) GUICtrlRead ( $loot ) Else MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) EndIf Send("1") MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) ;@@@@@@@@@@@@HEAL 5TH PLAYER@@@@@@@@@@@@ If GUICtrlRead ( $heal5 ) = 1 OR 0 Then Send("1") MouseMove ( $buff5x,$buff5y ,1 ) MouseClick("Right",$buff5x,$buff5y) Msgbox ( 0, "loading", "loading", 1) GUICtrlRead ( $loot ) Else MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) EndIf Send("1") MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) EndFunc Edited December 27, 2005 by Mike :) Link to comment Share on other sites More sharing options...
Mike :) Posted December 27, 2005 Author Share Posted December 27, 2005 Oh yeah, and don't look at these GUICtrlRead ( $loot ), I was just trying many different things to make it work and none really helped :/ Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 27, 2005 Moderators Share Posted December 27, 2005 (edited) IniWrite("config.ini", "Config", "Res", "$res1") Try taking the quotes off of $res and using the value of $res with GUICtrlRead() IniWrite("config.ini", "Config", "Res", GUICtrlRead($res1)) Edit: You also are going to run into problems probably assigning 4 check box values to one 'Key' . Try to make your ini like this: [Config] Res1= Res2= Res3= Res4= That way each of the $Res1,2,3,4 have their own perspective location to look at, and input data. Edited December 27, 2005 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Mike :) Posted December 27, 2005 Author Share Posted December 27, 2005 IniWrite("config.ini", "Config", "Res", "$res1") Try taking the quotes off of $res and using the value of $res with GUICtrlRead() IniWrite("config.ini", "Config", "Res", GUICtrlRead($res1)) Edit: You also are going to run into problems probably assigning 4 check box values to one 'Key' . Try to make your ini like this: [Config] Res1= Res2= Res3= Res4= That way each of the $Res1,2,3,4 have their own perspective location to look at, and input data. Okay, thanks alot. I think I'll try this before: If $resauto = $res1 Then GUICtrlSetState($res1, $GUI_CHECKED) ElseIf $resauto = $res2 Then GUICtrlSetState($res2, $GUI_CHECKED) ElseIf $resauto = $res3 Then GUICtrlSetState($res3, $GUI_CHECKED) ElseIf $resauto = $res4 Then GUICtrlSetState($res4, $GUI_CHECKED) What I think about it is that the GUICtrlSetState doesn't read what is inside $resauto and it just tries to change it, that's why i'm going to replace it with this code. I think it's more clear and it doesn't make program write alot when quitting (nice on slower pcs). Anyway thanks alot for help, you gave me great ideas. Am I right, or should I rather use your code? (i'm still noob to this all) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 27, 2005 Moderators Share Posted December 27, 2005 I'm not suggesting how you should do 'your' program, I only offered a suggestion to fix what was currently broken in the area you were looking in. To be honest, that's the only place I looked, and no further. I didn't look to see what your script does at all. What I wrote, will in fact help, but I don't know if it is a fix for all. Good Luck. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
LxP Posted December 28, 2005 Share Posted December 28, 2005 Welcome to the forums Mike! I'm trying to declare a variable like this: $loot = Send("{SPACE}") then use just $loot inside the code to "call" it, and I try to run the script it tells me that the line cannot be parsed. Should I use string or something?You can't use a variable in this fashion, however you can create a function that does this: Func Loot() Send('{SPACE}') EndFunc ··· Loot() P.S. Your English is fantastic so there's no need to apologise. Link to comment Share on other sites More sharing options...
Mike :) Posted December 28, 2005 Author Share Posted December 28, 2005 (edited) I'm not suggesting how you should do 'your' program, I only offered a suggestion to fix what was currently broken in the area you were looking in. To be honest, that's the only place I looked, and no further. I didn't look to see what your script does at all. What I wrote, will in fact help, but I don't know if it is a fix for all. Good Luck. Thanks alot, I didn't really expect you to read the whole script either, thanks alot for help with my bloody problem, I'm going to fix that now. Thanks again! Welcome to the forums Mike! You can't use a variable in this fashion, however you can create a function that does this: Func Loot() Send('{SPACE}') EndFunc ··· Loot() P.S. Your English is fantastic so there's no need to apologise. It's a good feeling to be welcomed by Great Member (I'm sorry but 1500 posts is something ) on such big forum, I'm very pleased . Function? Great Idea, but how to make it vary on if I check the checkbox or not? I mean, f.ex. should i use: If $button = $GUI_CHECKED (i know it's not the same command for checkbox but let's say it's ok) Then Func Loot() Send('{SPACE}') EndFunc ElseIf $button = $GUI_UNCHECKED Then Func Loot() Sleep(1) EndFunc() EndIf Well, from my few-month experience I can say it's impossible, I discovered some problems with defining functions inside If statement before (error: autoit can't find EndIf, sometimes EndFunc too), so how should I do that? That's why I thought there could be another way of doing this, like strings, variables or anything else, but I couldn't find anything that fit. What should I use then? Oh yeah, I tried Select too, it doesn't work either. My english is actually bad, you'll find out this later PS. Is there any way to control packets using AutoIt commands? I mean... create a simple software proxy modifying packets sent to specifical server. Is that possible or I have to write it in C++ already? Edited December 28, 2005 by Mike :) Link to comment Share on other sites More sharing options...
NegativeNrG Posted December 28, 2005 Share Posted December 28, 2005 take a look at this example: Dim $x = 12 Dim $y = 13 if $x > $y Then _msg() Elseif $x < $y Then _msg2() Endif Func _msg() Msgbox(0,"",$x & " is higher Than " & $y) EndFUnc Func _msg2() Msgbox(0,"",$x & " is lower Then " & $y) EndFunc [size=20]My File Upload[/size]Register at my site and upload. Link to comment Share on other sites More sharing options...
Mike :) Posted December 28, 2005 Author Share Posted December 28, 2005 Oh yeah, It's really nice idea, but if I had to put sth like if $x > $y Then _msg() Elseif $x < $y Then _msg2() Endif 100 times in my script (and I have to do that) it would be long and done by noobie way, so... any other ideas? Or maybe I misunderstood you? Link to comment Share on other sites More sharing options...
NegativeNrG Posted December 28, 2005 Share Posted December 28, 2005 what exactly are you trying to do? and you can do a DO..UNTIL loop. [size=20]My File Upload[/size]Register at my site and upload. Link to comment Share on other sites More sharing options...
Mike :) Posted December 28, 2005 Author Share Posted December 28, 2005 Exactly I'm trying to set CheckBox called AutoPickUp which would (when clicked) set a func, variable, string or whatever to have Send('{SPACE}') inside (if not clicked it would be Sleep(1) ), and next in code i need to put something like Call(Loot) or $loot or anything around 20 - 30 times so it would click Space in specifical moments ONLY if the checkbox was checked.Hmm, let's look at thisexpandcollapse popup;@@@@@@@@@@@STARTS def buff @@@@@@@@@@@ Send("2") Sleep(50) If GUICtrlRead ( $def1 ) = 1 OR 0 Then MouseMove ( $buff1x,$buff1y ,1 ) MouseClick("Right",$buff1x,$buff1y) MsgBox ( 0, "loading", "loading", 1) GUICtrlRead ( $loot ) Else MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) EndIf MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) Send("2") ;@@@@@@@@@@@@DEF 2ND PLAYER@@@@@@@@@@@@ Send("2") If GUICtrlRead ( $def2 ) = 1 OR 0 Then MouseMove ( $buff2x,$buff2y ,1 ) MouseClick("Right",$buff2x,$buff2y) MsgBox ( 0, "loading", "loading", 1) GUICtrlRead ( $loot ) Else MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) EndIf MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) ;@@@@@@@@@@@@DEF 3RD PLAYER@@@@@@@@@@@@ Send("2") If GUICtrlRead ( $def3 ) = 1 OR 0 Then MouseMove ( $buff3x,$buff3y ,1 ) MouseClick("Right",$buff3x,$buff3y) MsgBox ( 0, "loading", "loading", 1) GUICtrlRead ( $loot ) Else MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) EndIf MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) ;@@@@@@@@@@@@DEF 4TH PLAYER@@@@@@@@@@@@ Send("2") If GUICtrlRead ( $def4 ) = 1 OR 0 Then MouseClick("Right",$buff4x,$buff4y) MsgBox ( 0, "loading", "loading", 1) GUICtrlRead ( $loot ) Else MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) EndIf MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) ;@@@@@@@@@@@@DEF 5TH PLAYER@@@@@@@@@@@@ Send("2") If GUICtrlRead ( $def5 ) = 1 OR 0 Then MouseMove ( $buff5x,$buff5y ,1 ) MouseClick("Right",$buff5x,$buff5y) MsgBox ( 0, "loading", "loading", 1) GUICtrlRead ( $loot ) Else MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot ) EndIf MouseMove ( $buffx,$buffy ,1 ) GUICtrlRead ( $loot )This is part of script which automatically gives Defense aura to all party members in MU Online game. I must insert the function into the code everywhere you see GUICtrlRead ($loot), so I need it to be short, the function may be defined later. So, any ideas? Do..Until won't do it, it's a loop Link to comment Share on other sites More sharing options...
NegativeNrG Posted December 28, 2005 Share Posted December 28, 2005 you can try: if $radio = $GUI_CHECKED Then DO ;stuff here Until $radio = $GUI_UNCHECKED Endif [size=20]My File Upload[/size]Register at my site and upload. Link to comment Share on other sites More sharing options...
NegativeNrG Posted December 28, 2005 Share Posted December 28, 2005 Or you can look at Hotkeyset() to use it anytime you want. [size=20]My File Upload[/size]Register at my site and upload. Link to comment Share on other sites More sharing options...
Mike :) Posted December 28, 2005 Author Share Posted December 28, 2005 you can try: if $radio = $GUI_CHECKED Then DO ;stuff here Until $radio = $GUI_UNCHECKED Endif Yeah, but you still miss the point, because it won't click the space in the right time when I want, and also, it will stop the script (it will do the loop forever 'cause it always has to click the space). By doing this I will prevent my script from continuing auto-aura proggress. Oh well, maybe if I put something like this on end of script and it would loop it 2 times then go back to beggining it could work, but it need to press space WHILE the auto-aura is running . Anyway, I think you helped me enough NegativeNrG, don't waste you're time on me Thanks Alot Or you can look at Hotkeyset() to use it anytime you want. Sure, I'm using this function ^^ but I don't need it to run with space, I want space to work in background Link to comment Share on other sites More sharing options...
NegativeNrG Posted December 28, 2005 Share Posted December 28, 2005 man, im totally lost , i have no idea what your talking about.. [size=20]My File Upload[/size]Register at my site and upload. Link to comment Share on other sites More sharing options...
Mike :) Posted December 28, 2005 Author Share Posted December 28, 2005 Just run this one, you'll see what i mean. I know that what it does might confuse you, but it's for a game. Every time the mouse goes up the screen and clicks with RMB, right after the loading MsgBox I need space to be clicked (or not, if the PickUp checkbox wasn't clicked). Just run it and see scriptie.au3 Link to comment Share on other sites More sharing options...
NegativeNrG Posted December 28, 2005 Share Posted December 28, 2005 (edited) i see, so after the "Loading Msgbox" Space will be clicked for ever BUT if pickup checkbox isnt checked, it wont click space?. maybe you can use: $msgbox = your msgbox here if $msgbox = 1 Then $read = GUIctrlread($checkbox) if $read = $GUI_CHECKED Then Send("{SPACE}") Elseif $read = $GUI_UNCHECKED Then ;;;Do Stuff Endif endif and i have a question, how would you want the user to STOP the space pressing? Edited December 28, 2005 by NegativeNrG [size=20]My File Upload[/size]Register at my site and upload. Link to comment Share on other sites More sharing options...
Mike :) Posted December 28, 2005 Author Share Posted December 28, 2005 (edited) So you mean that I would put that in loop so it checks everytime? Nice idea, thanks User will pause the whole script using F5 hotkey, it's defined in script . Thanks alot again Oh, but then again, doing the loop over and over will pause the script, won't it? Edited December 28, 2005 by Mike :) Link to comment Share on other sites More sharing options...
NegativeNrG Posted December 28, 2005 Share Posted December 28, 2005 im not too sure, i dont have the game MU online, so i wouldnt know. [size=20]My File Upload[/size]Register at my site and upload. Link to comment Share on other sites More sharing options...
Mike :) Posted December 28, 2005 Author Share Posted December 28, 2005 Oh, it's not what I mean, the game doesn't have anything to do with that. I was just wondering if loop can work while rest of script is executing or if it just stops it, though I think i understand now Thanks 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