RaDiVaX Posted June 5, 2008 Share Posted June 5, 2008 Hello, i been trying to make this bot work. I have this settings.ini and it should save to it But in settings.ini it's only: Coord_x=37 Coord_y=39 !? Func set_coords_ball() WinSetOnTop($form2, "", 0) WinActivate($handle) Sleep(Random(50, 75)) ControlSend($handle, "", 0, "{enter}") Sleep(Random(50, 75)) Send("/ohlawl on") ControlSend($handle, "", 0, "{enter}") ToolTip("Move your mouse OVER the square and press SPACE", 20, 3) While Not _IsPressed("20", $dll) Sleep(10) WEnd $posc = MouseGetPos() GUICtrlSetData($square_x, $posc[0]) GUICtrlSetData($square_y, $posc[1]) ToolTip("") MsgBox(64, "Oh lawl Bot", "Coords set", 3) IniWrite("settings.ini", "Settings", "Coord_x", $square_x) IniWrite("settings.ini", "Settings", "Coord_y", $square_y) GUICtrlSetState($button6, $GUI_ENABLE) $square_x = IniRead ("settings.ini", "Settings", "Coord_x", "default" ) $square_y = IniRead ("settings.ini", "Settings", "Coord_y", "default" ) WinActivate($form2) EndFunc ;==>set_coords_ball Well, that SHOULD work, but it doesn't? Let's take a example, the value is. 537, 345. But in the settings.ini It's still Coord_x=37 Coord_y=39 Any tips? Link to comment Share on other sites More sharing options...
jwseek Posted June 5, 2008 Share Posted June 5, 2008 Hello, i been trying to make this bot work. I have this settings.ini and it should save to it But in settings.ini it's only: Coord_x=37 Coord_y=39 !? Func set_coords_ball() WinSetOnTop($form2, "", 0) WinActivate($handle) Sleep(Random(50, 75)) ControlSend($handle, "", 0, "{enter}") Sleep(Random(50, 75)) Send("/ohlawl on") ControlSend($handle, "", 0, "{enter}") ToolTip("Move your mouse OVER the square and press SPACE", 20, 3) While Not _IsPressed("20", $dll) Sleep(10) WEnd $posc = MouseGetPos() GUICtrlSetData($square_x, $posc[0]) GUICtrlSetData($square_y, $posc[1]) ToolTip("") MsgBox(64, "Oh lawl Bot", "Coords set", 3) IniWrite("settings.ini", "Settings", "Coord_x", $square_x) IniWrite("settings.ini", "Settings", "Coord_y", $square_y) GUICtrlSetState($button6, $GUI_ENABLE) $square_x = IniRead ("settings.ini", "Settings", "Coord_x", "default" ) $square_y = IniRead ("settings.ini", "Settings", "Coord_y", "default" ) WinActivate($form2) EndFunc ;==>set_coords_ball Well, that SHOULD work, but it doesn't? Let's take a example, the value is. 537, 345. But in the settings.ini It's still Coord_x=37 Coord_y=39 Any tips? IniWrite returns a 0 value if the file is read-only and only returns a 1 if it writes successfully. Why don't you try sending the output of the function to a variable/msgbox and see what's happening there. Also, why are you sending "default" to the iniRead function? $square_x = IniRead ("settings.ini", "Settings", "Coord_x", "default" ) $square_y = IniRead ("settings.ini", "Settings", "Coord_y", "default" ) It's not super important, but I'm kinda curious. Seems like that might cause problems later... Link to comment Share on other sites More sharing options...
aNewLyfe Posted June 5, 2008 Share Posted June 5, 2008 (edited) As i see, Try : IniWrite("settings.ini", "Settings", "Coord_x", $posc[0]) IniWrite("settings.ini", "Settings", "Coord_y", $posc[1]) or update your variables like : $squareX = $posc[0] after write it to ini also u dont need to enter "default" just leave it "" on iniread Edited June 5, 2008 by mistakilla ~ Every Living Thing is a Code Snippet of World Application ~ Link to comment Share on other sites More sharing options...
RaDiVaX Posted June 5, 2008 Author Share Posted June 5, 2008 IniWrite returns a 0 value if the file is read-only and only returns a 1 if it writes successfully. Why don't you try sending the output of the function to a variable/msgbox and see what's happening there. Also, why are you sending "default" to the iniRead function? $square_x = IniRead ("settings.ini", "Settings", "Coord_x", "default" ) $square_y = IniRead ("settings.ini", "Settings", "Coord_y", "default" ) It's not super important, but I'm kinda curious. Seems like that might cause problems later... As i see, Try : IniWrite("settings.ini", "Settings", "Coord_x", $posc[0]) IniWrite("settings.ini", "Settings", "Coord_y", $posc[1]) or update your variables like : $squareX = $posc[0] after write it to ini also u dont need to enter "default" just leave it "" on inireadAh, thanks for the tips. IniWrite("settings.ini", "Settings", "Coord_x", $posc[0]) IniWrite("settings.ini", "Settings", "Coord_y", $posc[1]) Works. Replaced all "default" with "". No idea why i had that, thanks ^^! Link to comment Share on other sites More sharing options...
jwseek Posted June 5, 2008 Share Posted June 5, 2008 (edited) As i see, Try : IniWrite("settings.ini", "Settings", "Coord_x", $posc[0]) IniWrite("settings.ini", "Settings", "Coord_y", $posc[1]) or update your variables like : $squareX = $posc[0] after write it to ini also u dont need to enter "default" just leave it "" on iniread Yeah...that's a really good point. First you use a GUISetCtrlData to store values in $squarex and $squarey and then you just send values to them. Inconsistency like that in programming will get you eaten by vicious penguins. Edited June 5, 2008 by jwseek Link to comment Share on other sites More sharing options...
RaDiVaX Posted June 5, 2008 Author Share Posted June 5, 2008 Well, i sort of got a new problem :/ $pixelcurrently = Hex(PixelGetColor($coord_y, $coord_x)) sleep(20) If $act = true Then If $pixelcurrently = 0xFFFFFF Then MsgBox(0,"White","White") $pixelact = 0xFFFFFF $act = false EndIf If $pixelcurrently = 0x000080 Then MsgBox(0,"Dark blue","Dark blue") $pixelact = 0x000080 $act = false EndIf If $pixelcurrently = 0x0000FF Then MsgBox(0,"Light blue","lLight bluel") $pixelact = 0x0000FF $act = false EndIf Endif If $act = false AND $pixelcurrently <> $pixelact Then $act = True Endif I been trying that. That is in a loop and should check the pixels at a certain position and if it's that color it should do another action. Well, it never happens... :/ Any tips? And one problem is that i can't use my buttons in my GUI while that loop is running, is there any possible to do so that works? or not? Link to comment Share on other sites More sharing options...
RaDiVaX Posted June 6, 2008 Author Share Posted June 6, 2008 bump Link to comment Share on other sites More sharing options...
aNewLyfe Posted June 6, 2008 Share Posted June 6, 2008 Are you sure act is true before script executes this line ? $pixelcurrently = Hex(PixelGetColor($coord_y, $coord_x)) ~ Every Living Thing is a Code Snippet of World Application ~ Link to comment Share on other sites More sharing options...
RaDiVaX Posted June 6, 2008 Author Share Posted June 6, 2008 Yup, i'm sure. Anyway, i think i got it working. But it doesn't want to loop :/? What do i do wrong.. I want the "While" function to loop.. ;[Function] ;[Function_Hide] Func hide() Global $Show = 0 Global $act = true Global $handle = WinGetHandle("classname=GxWindowClassD3d") bot_onmessage() SoundPlay(@ScriptDir & "\sound\start.wav",0) sleep(200) If @error Then ;blabalinsertcodewhenerror Else sleep(1000) $pixelcurrently = PixelGetColor(GUICtrlRead($coord_x), GUICtrlRead($coord_y)) While 1 $unique = Random(1, 4, 1) If $unique = 1 Then WinActivate("World Of Warcraft", "") If $factionconfig = "Alliance" Then ;[Alliance_Waypoint] Sleep(1000) If $act = true Then If $pixelcurrently = 0xFFFFFF Then SoundPlay(@ScriptDir & "\sound\start.wav",0) ToolTip("Vit", 0, 0) sleep(1000) $pixelact = 0xFFFFFF $act = false EndIf If $pixelcurrently = 0x000080 Then ToolTip("Mörkblå", 0, 0) sleep(1000) $pixelact = 0x000080 $act = false EndIf If $pixelcurrently = 0x0000FF Then ToolTip("Blå", 0, 0) sleep(1000) $pixelact = 0x0000FF $act = false EndIf Endif EndIf ;[/Alliance_Waypoint] If $factionconfig = "Horde" Then ;[Horde_Waypoint]´ Sleep(1000) If $act = true Then If $pixelcurrently = 0xFFFFFF Then SoundPlay(@ScriptDir & "\sound\start.wav",0) ToolTip("Vit", 0, 0) sleep(1000) $pixelact = 0xFFFFFF $act = false EndIf If $pixelcurrently = 0x000080 Then ToolTip("Mörkblå", 0, 0) sleep(1000) $pixelact = 0x000080 $act = false EndIf If $pixelcurrently = 0x0000FF Then ToolTip("Blå", 0, 0) sleep(1000) $pixelact = 0x0000FF $act = false EndIf Endif ;[/Horde_Waypoint] EndIf If $act = false AND $pixelcurrently <> $pixelact Then $act = True Endif EndIf If $Show > 0 Then ExitLoop ;[/botting_Function] WEnd EndIf EndFunc ;[/Function] ;[/Function_Hide] 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