Kyloob Posted August 2, 2008 Share Posted August 2, 2008 Hey =D I have a problem that's been bugging me a bit, I'm a 100% novice AutoIt coder so I know literally nothing apart from what I've picked up in the last hour or two. I'm making a script that hopefully goes to locations on a screen, checks the color of those locations, and if they are the correct color, it goes to another location and clicks, and this constantly loops. Simple eh? Well no, I seem to have messed it up somehow. Any advice would be greatly appreciated. While 1 If PixelGetColor ( 364, 370) = "255, 0, 0" Then MouseMove ( 290, 560) MouseClick ("left") ElseIf PixelGetColor ( 398, 372) = "255, 255, 0" Then MouseMove ( 415, 560) MouseClick ("left") ElseIf PixelGetColor ( 376, 370) = "144, 238, 144" Then MouseMove ( 555, 560) MouseClick ("left") ElseIf PixelGetColor ( 357, 370) = "144, 238, 144" Then MouseMove ( 555, 560) MouseClick ("left") EndIf WEnd The script just doesn't seem to do anything apart from lag out my PC a bit. Link to comment Share on other sites More sharing options...
Andreik Posted August 2, 2008 Share Posted August 2, 2008 Hey =D I have a problem that's been bugging me a bit, I'm a 100% novice AutoIt coder so I know literally nothing apart from what I've picked up in the last hour or two. I'm making a script that hopefully goes to locations on a screen, checks the color of those locations, and if they are the correct color, it goes to another location and clicks, and this constantly loops. Simple eh? Well no, I seem to have messed it up somehow. Any advice would be greatly appreciated. While 1 If PixelGetColor ( 364, 370) = "255, 0, 0" Then MouseMove ( 290, 560) MouseClick ("left") ElseIf PixelGetColor ( 398, 372) = "255, 255, 0" Then MouseMove ( 415, 560) MouseClick ("left") ElseIf PixelGetColor ( 376, 370) = "144, 238, 144" Then MouseMove ( 555, 560) MouseClick ("left") ElseIf PixelGetColor ( 357, 370) = "144, 238, 144" Then MouseMove ( 555, 560) MouseClick ("left") EndIf WEnd The script just doesn't seem to do anything apart from lag out my PC a bit. While 1 If "0x" & Hex(PixelGetColor(364, 370)) = 0xFF0000 Then MouseClick ("left",290,560) ElseIf "0x" & Hex(PixelGetColor(398, 372)) = 0xFFFF00 Then MouseClick ("left",415, 560) ElseIf "0x" & Hex(PixelGetColor(376, 370)) = 0x90EE90 Then MouseClick ("left",555, 560) ElseIf "0x" & Hex(PixelGetColor(357, 370)) = 0x90EE90 Then MouseClick ("left",555, 560) EndIf WEnd When the words fail... music speaks. Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 2, 2008 Share Posted August 2, 2008 PixelGetColor return the color as a decimal value (ex 13421772) and not like you have written. Try the example from the helpfile and see yourself! .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Kyloob Posted August 2, 2008 Author Share Posted August 2, 2008 Probably the most absurdly fast response I've ever seen, you're a god Andreik. Thanks so much. I checked the Help file and it only showed me the format of the function, not the format of the response. Thanks to both of you, its all working fine now, much love =D Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 2, 2008 Share Posted August 2, 2008 Probably the most absurdly fast response I've ever seen, you're a god Andreik. Thanks so much.I checked the Help file and it only showed me the format of the function, not the format of the response.Thanks to both of you, its all working fine now, much love =DI am glad that you got it to work, but you may want to read the helpfile more closely in the future, because it say in the page for PixelGetColor()Success: Returns decimal value of pixel's colorThat is clearly in singular and will only be one value. Also the format "255, 0, 0" should have risen suspicion since that isn't used anywhere. And third, you should run the examples and study them, it would have learned you the format much faster than asking on the forum. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface 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