WaitPixelColor problem
Moderators: Dorian (MJT support), JRL
WaitPixelColor problem
Hi. I'm newbie and I don't speak english very well, but I want to solve my problem with someone's help. I want to use a macro to play an online game. Here is the link:http://www.gameaccount.com/toModule.do; ... ix=%2Fgolf
It is a slider in the game and it is yellow and moves up and down on the x axis. If I click on the button the slider stop. I want to stop the slider on an exact point so the script gonna wait to changing the color on the specified coordinate and than click. If someone see the game than realize to my problem.
Here is my code:
MouseMove>312,664
LClick
WaitPixelColor>65535,529,664,0
MouseMove>312,664
LClick
WaitPixelColor>65535,349,664,0
MouseMove>312,664
LClick
Sometimes it works correctly sometimes not:?
Why?
(My monitor display is 1024x768@85Hz)
Thanks and sorry for my bad english.
It is a slider in the game and it is yellow and moves up and down on the x axis. If I click on the button the slider stop. I want to stop the slider on an exact point so the script gonna wait to changing the color on the specified coordinate and than click. If someone see the game than realize to my problem.
Here is my code:
MouseMove>312,664
LClick
WaitPixelColor>65535,529,664,0
MouseMove>312,664
LClick
WaitPixelColor>65535,349,664,0
MouseMove>312,664
LClick
Sometimes it works correctly sometimes not:?
Why?
(My monitor display is 1024x768@85Hz)
Thanks and sorry for my bad english.
Last edited by buksi on Thu Sep 15, 2005 12:07 pm, edited 1 time in total.
There aren't many games players here I'm afraid. People here are generally writing scripts to automate critical business functions and they therefore take priority. Anyway, why would you want a macro to play a game!? Seems pointless to me.
MJT Net Support
[email protected]
[email protected]
OK. I understood this, but I can't realize why don't operate well my code. I think the WaitPixelColor function isn't work correctly. Please take a look for the link and you will seeing what I'm talking about. Please.support wrote:There aren't many games players here I'm afraid. People here are generally writing scripts to automate critical business functions and they therefore take priority. Anyway, why would you want a macro to play a game!? Seems pointless to me.
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Don't understand why you move the mouse three times to the same location.
What is not working, left click? How do you know?
What is supposed to happen...a pixel changes color in another location?
Some thoughtx:
1. You are using a timeout value of 0 which can make the system appear to "hang". Try using a real value and branching based on result.
2. May want to use WaitRectChanged> vs. Pixel. Pixel may be too small for checking.
3. Look at log results to see exactly what is happening in real time.
What is not working, left click? How do you know?
What is supposed to happen...a pixel changes color in another location?
Some thoughtx:
1. You are using a timeout value of 0 which can make the system appear to "hang". Try using a real value and branching based on result.
2. May want to use WaitRectChanged> vs. Pixel. Pixel may be too small for checking.
3. Look at log results to see exactly what is happening in real time.
Last edited by Bob Hansen on Fri Sep 16, 2005 4:24 am, edited 1 time in total.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
For a start there is no SetFocus command. There is nothing in this script to ensure the correct window has the focus. If you run this script manually Macro Scheduler will have the focus. You need to add something to make sure the left click lands on the right window.
MJT Net Support
[email protected]
[email protected]
Here is my new code:
SetFocus>GameAccount*
MouseMove>312,664
LClick
WaitPixelColor>65535,529,664,0
MouseMove>312,664
LClick
WaitRectChanged>348,659,348,671,1.1
//WaitPixelColor>65535,349,664,0
MouseMove>312,664
LClick
It's better than old one, but it isn't work on 100%. Sometimes miss the waitrectchanged or waitpixelcolor function. The clicks are ok, but I think the second color recognize isn't perfect (for first is ok). What do u think? Please take a a look to the game, and u will see what happen. Jah, and have u gote any idea instead of Wait>. It isn't exact.
Thx
SetFocus>GameAccount*
MouseMove>312,664
LClick
WaitPixelColor>65535,529,664,0
MouseMove>312,664
LClick
WaitRectChanged>348,659,348,671,1.1
//WaitPixelColor>65535,349,664,0
MouseMove>312,664
LClick
It's better than old one, but it isn't work on 100%. Sometimes miss the waitrectchanged or waitpixelcolor function. The clicks are ok, but I think the second color recognize isn't perfect (for first is ok). What do u think? Please take a a look to the game, and u will see what happen. Jah, and have u gote any idea instead of Wait>. It isn't exact.
Thx
Take a look to the BLOCKINPUT statement. Touching the mouse while the script is running can move the mouse cursor between statements. Blocking the input is the only way to be sure that the LCLIK executes on the correct coordinate.
Possible this does not solve your problem, but’s a good practice to block the input while using the MOUSEMOVE statement.
Greetings
Luciano
Possible this does not solve your problem, but’s a good practice to block the input while using the MOUSEMOVE statement.
Greetings
Luciano
All,
I've encountered a phenomena with respect to pixel colors
that I think is relevent to this thread - instead of starting another.
In my application I interact with the http://www.betfair.com webpage
using Macro Scheduler.
I do a Relative mouse move (MouseMoveRel) to the scroll bar -
put in a second or 2 wait and then do a "Get Pixel Color":
GetPixelColor>652,355,PC
Message>Pixel Color is : %PC%
(not my actual coodinates - the preceding is taken directly
from the Macro Scheduler help example) Instead of
using Message> I use MessageModal>
The scroll bar color differential is dark gray and light gray
similar in nature to the scroll bar in this forum window. I get
the same Pixel Color result if I'm in the light portion of the
vertical scroll bar area or in the dark section.
I don't have the exact Pixel color result but it really doesn't
matter, it just seems with the large number that comes back
there should "room" for a differentiation for all colors,
"encountered". In other words there's plenty of "room" for
a light gray and dark gray distinction or differentiation.
I know for sure that I'm solidly in the light gray area or the
dark gray area of the scroll bar when I make my Get Pixel
Color "call".
I was wondering if there is a listing of all the color number
definitions recognized or accepted by Macro Scheduler.
I hope I make sense in my question here. I've tried my best
to explain it.
I've encountered a phenomena with respect to pixel colors
that I think is relevent to this thread - instead of starting another.
In my application I interact with the http://www.betfair.com webpage
using Macro Scheduler.
I do a Relative mouse move (MouseMoveRel) to the scroll bar -
put in a second or 2 wait and then do a "Get Pixel Color":
GetPixelColor>652,355,PC
Message>Pixel Color is : %PC%
(not my actual coodinates - the preceding is taken directly
from the Macro Scheduler help example) Instead of
using Message> I use MessageModal>
The scroll bar color differential is dark gray and light gray
similar in nature to the scroll bar in this forum window. I get
the same Pixel Color result if I'm in the light portion of the
vertical scroll bar area or in the dark section.
I don't have the exact Pixel color result but it really doesn't
matter, it just seems with the large number that comes back
there should "room" for a differentiation for all colors,
"encountered". In other words there's plenty of "room" for
a light gray and dark gray distinction or differentiation.
I know for sure that I'm solidly in the light gray area or the
dark gray area of the scroll bar when I make my Get Pixel
Color "call".
I was wondering if there is a listing of all the color number
definitions recognized or accepted by Macro Scheduler.
I hope I make sense in my question here. I've tried my best
to explain it.
One thing you should do is move the window to 0,0 for example, that way the spot you're having MS read the color from is always in the same position.
MoveWindow>GameAccount*,0,0
MouseMove>312,664
LClick
WaitPixelColor>65535,529,664,0
MouseMove>312,664
LClick
WaitPixelColor>65535,349,664,0
MouseMove>312,664
LClick
You may have to change your cords for WaitPixelColor and MouseMove but once you have the correct cords you shouldn't have to mess with the script anymore.
Good Luck
MoveWindow>GameAccount*,0,0
MouseMove>312,664
LClick
WaitPixelColor>65535,529,664,0
MouseMove>312,664
LClick
WaitPixelColor>65535,349,664,0
MouseMove>312,664
LClick
You may have to change your cords for WaitPixelColor and MouseMove but once you have the correct cords you shouldn't have to mess with the script anymore.
Good Luck
I just took a look at the game and here is what I came up with for Windows XP. I had problems with WaitPixelColor since the power bar is so small. This script has 2 loops, each loop searches an area of 6 pixels and looks for the yellow and black color in the power bar.
I hope this helps.
MoveWindow>GameAccount*,0,0
MouseMove>74,351
LClick
label>loop1
GetPixelColor>265,350,c
if>{(%c%=65535)or(%c%=0)}
MouseMove>74,351
LClick
goto>loop2
endif
GetPixelColor>266,350,c
if>{(%c%=65535)or(%c%=0)}
MouseMove>74,351
LClick
goto>loop2
endif
GetPixelColor>267,350,c
if>{(%c%=65535)or(%c%=0)}
MouseMove>74,351
LClick
goto>loop2
endif
GetPixelColor>268,350,c
if>{(%c%=65535)or(%c%=0)}
MouseMove>74,351
LClick
goto>loop2
endif
GetPixelColor>267,350,c
if>{(%c%=65535)or(%c%=0)}
MouseMove>74,351
LClick
goto>loop2
endif
GetPixelColor>270,350,c
if>{(%c%=65535)or(%c%=0)}
MouseMove>74,351
LClick
goto>loop2
endif
goto>loop1
label>loop2
GetPixelColor>110,350,c
if>{(%c%=65535)or(%c%=0)}
MouseMove>74,351
LClick
goto>stop
endif
GetPixelColor>111,350,c
if>{(%c%=65535)or(%c%=0)}
MouseMove>74,351
LClick
goto>stop
endif
GetPixelColor>112,350,c
if>{(%c%=65535)or(%c%=0)}
MouseMove>74,351
LClick
goto>stop
endif
GetPixelColor>113,350,c
if>{(%c%=65535)or(%c%=0)}
MouseMove>74,351
LClick
goto>stop
endif
GetPixelColor>114,350,c
if>{(%c%=65535)or(%c%=0)}
MouseMove>74,351
LClick
goto>stop
endif
GetPixelColor>115,350,c
if>{(%c%=65535)or(%c%=0)}
MouseMove>74,351
LClick
goto>stop
endif
goto>loop2
label>stop
I hope this helps.
MoveWindow>GameAccount*,0,0
MouseMove>74,351
LClick
label>loop1
GetPixelColor>265,350,c
if>{(%c%=65535)or(%c%=0)}
MouseMove>74,351
LClick
goto>loop2
endif
GetPixelColor>266,350,c
if>{(%c%=65535)or(%c%=0)}
MouseMove>74,351
LClick
goto>loop2
endif
GetPixelColor>267,350,c
if>{(%c%=65535)or(%c%=0)}
MouseMove>74,351
LClick
goto>loop2
endif
GetPixelColor>268,350,c
if>{(%c%=65535)or(%c%=0)}
MouseMove>74,351
LClick
goto>loop2
endif
GetPixelColor>267,350,c
if>{(%c%=65535)or(%c%=0)}
MouseMove>74,351
LClick
goto>loop2
endif
GetPixelColor>270,350,c
if>{(%c%=65535)or(%c%=0)}
MouseMove>74,351
LClick
goto>loop2
endif
goto>loop1
label>loop2
GetPixelColor>110,350,c
if>{(%c%=65535)or(%c%=0)}
MouseMove>74,351
LClick
goto>stop
endif
GetPixelColor>111,350,c
if>{(%c%=65535)or(%c%=0)}
MouseMove>74,351
LClick
goto>stop
endif
GetPixelColor>112,350,c
if>{(%c%=65535)or(%c%=0)}
MouseMove>74,351
LClick
goto>stop
endif
GetPixelColor>113,350,c
if>{(%c%=65535)or(%c%=0)}
MouseMove>74,351
LClick
goto>stop
endif
GetPixelColor>114,350,c
if>{(%c%=65535)or(%c%=0)}
MouseMove>74,351
LClick
goto>stop
endif
GetPixelColor>115,350,c
if>{(%c%=65535)or(%c%=0)}
MouseMove>74,351
LClick
goto>stop
endif
goto>loop2
label>stop