Problem with FindColor library
Moderators: Dorian (MJT support), JRL
-
- Junior Coder
- Posts: 33
- Joined: Sat Feb 27, 2010 8:11 pm
Problem with FindColor library
Hello. I have a problem with moving the mouse to a pixel color. The first part works but after it waits for the pixel color to come on the screen, it doesn't work. Please help! My code:
// COMPILE_OPTS|C:\Documents and Settings\mokshal\My Documents\AutoBot\AutoFlaxer\AutoFlaxer.exe||CONSOLE=0|INCLUDES=1|
Dialog>AutoSpin
Caption=AutoEP - http://www.autobot.tk
Width=407
Height=239
Top=294
Left=827
Button=Start,32,96,97,41,1
Button=End,272,96,97,41,2
Image=fbg copy.jpg,0,0,401,201,msImage1,0
Button=Info,152,128,97,41,3
Label=Bot ID: 2,176,176,true
EndDialog>AutoSpin
Label>codeStart
show>AutoSpin,result
if>result=2
goto>end
endif
if>result=1
goto>start
endif
if>result=3
MessageModal>Start your character lumbridge bank, make sure flax is visable in the bank!
goto>codeStart
endif
Label>start
Message>Authorizing ID: 2
/*HTTPRequest>http://www.nakido.com/F8DD9F6D48B74E204 ... ,GET,,Data
if>Data=404 HTTP/1.1 404 Not Found
goto>Disabled
endif
Label>Disabled
MessageModal>Your Bot Has Been Disabled. For questions please contact [email protected] or the msn [email protected]
*/
Wait>5
//GetPixelColor>633,320,col
//Message>col
Let>fcLib=%SCRIPT_DIR%\findcolor.dll
LibFunc>fcLib,FindColor,r,16642557,325,32,1362,761,xres,yres
If>r=1
Let>x=r_6
Let>y=r_7
MouseMove>x,y
RClick
Wait>1
Let>YB=y+45
MouseMove>x,YB
LClick
WaitPixelColor>11446860
Endif
Let>fcLib=%SCRIPT_DIR%\findcolor.dll
LibFunc>fcLib,FindColor,r,11446860,325,32,1362,761,xres,yres
If>r=1
Let>x=r_6
Let>y=r_7
MouseMove>x,y
RClick
Wait>1
Endif
Label>end
// COMPILE_OPTS|C:\Documents and Settings\mokshal\My Documents\AutoBot\AutoFlaxer\AutoFlaxer.exe||CONSOLE=0|INCLUDES=1|
Dialog>AutoSpin
Caption=AutoEP - http://www.autobot.tk
Width=407
Height=239
Top=294
Left=827
Button=Start,32,96,97,41,1
Button=End,272,96,97,41,2
Image=fbg copy.jpg,0,0,401,201,msImage1,0
Button=Info,152,128,97,41,3
Label=Bot ID: 2,176,176,true
EndDialog>AutoSpin
Label>codeStart
show>AutoSpin,result
if>result=2
goto>end
endif
if>result=1
goto>start
endif
if>result=3
MessageModal>Start your character lumbridge bank, make sure flax is visable in the bank!
goto>codeStart
endif
Label>start
Message>Authorizing ID: 2
/*HTTPRequest>http://www.nakido.com/F8DD9F6D48B74E204 ... ,GET,,Data
if>Data=404 HTTP/1.1 404 Not Found
goto>Disabled
endif
Label>Disabled
MessageModal>Your Bot Has Been Disabled. For questions please contact [email protected] or the msn [email protected]
*/
Wait>5
//GetPixelColor>633,320,col
//Message>col
Let>fcLib=%SCRIPT_DIR%\findcolor.dll
LibFunc>fcLib,FindColor,r,16642557,325,32,1362,761,xres,yres
If>r=1
Let>x=r_6
Let>y=r_7
MouseMove>x,y
RClick
Wait>1
Let>YB=y+45
MouseMove>x,YB
LClick
WaitPixelColor>11446860
Endif
Let>fcLib=%SCRIPT_DIR%\findcolor.dll
LibFunc>fcLib,FindColor,r,11446860,325,32,1362,761,xres,yres
If>r=1
Let>x=r_6
Let>y=r_7
MouseMove>x,y
RClick
Wait>1
Endif
Label>end
Findcolor example incorrect?
Hi mokeshal1663,
I believe the example that comes with the Findcolor plug-in refers to the wrong variable when capturing the coordinates of the found colorl
Try this:
I'm a little unsure of my answer because I am not at my computer with Macro Scheduler loaded.
Here is the FindColor documentation:
Gale
I believe the example that comes with the Findcolor plug-in refers to the wrong variable when capturing the coordinates of the found colorl
Try this:
Code: Select all
Let>fcLib=%SCRIPT_DIR%\findcolor.dll
LibFunc>fcLib,FindColor,r,11446860,325,32,1362,761,xres,yres
If>r=1
Let>x=xres
Let>y=yres
MouseMove>x,y
RClick
Wait>1
Endif
Here is the FindColor documentation:
xres and yres are the 6th and 7th parameters after r and seem intended to return the same value as array members r_6 and r_7.// location of library
Let>fcLib=%SCRIPT_DIR%\findcolor.dll
// Find color on screen
// LibFunc>findcolor.dll,FindColor,result,color,xStart,yStart,xEnd,yEnd,result_x,result_y
// if found result = 1, else 0
// result in result_6,result_7
// Find color between 0,0 and 500,500
LibFunc>fcLib,FindColor,r,15986598,0,0,500,500,xres,yres
If>r=1
Let>x=r_6
Let>y=r_7
MouseMove>x,y
Endif
// Find color in window only
GetActiveWindow>title,x,y,w,h
LibFunc>fcLib,FindColor,r,16105118,x,y,w,h,xres,yres
If>r=1
Let>x=r_6
Let>y=r_7
MouseMove>x,y
Endif
Gale
-
- Junior Coder
- Posts: 33
- Joined: Sat Feb 27, 2010 8:11 pm
:(
Nope, still not working. Thanks for the input though. Anyone have any suggestions?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
What is the debugger telling you? What does it tell you is the value of "r" after the LibFunc line? What does the watch list show for the other values? If you don't have the debugger (if you're using Lite) then place some diagnostic message boxes in the code or use a log file. Please use the tools available to help you help us help you.
Really must charge up that crystal ball again.
Really must charge up that crystal ball again.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
I confirmed that FindColor works under Windows XP SP3 using MS 11.1.13.
When the color is found,
r=1
r_6=the xcoord found
r_7=the ycoord found
When the color is not found
r=0
r_6=xres
r_7=yres
When FindColor not loaded properly or not functioning
r should be neither 0 or 1, should not be assigned at all.
xres and yres are not variables, just text values for r_6 and r_7 to aid in debugging it appears.
I used FindPixelColor to guarantee a color is found to test the r=1 condition.
//Get a color, then find that color.
GetPixelColor>111,164,nColor
// Find color between 0,0 and 500,500
LibFunc>fcLib,FindColor,r,nColor,0,0,500,500,xres,yres
Gale
When the color is found,
r=1
r_6=the xcoord found
r_7=the ycoord found
When the color is not found
r=0
r_6=xres
r_7=yres
When FindColor not loaded properly or not functioning
r should be neither 0 or 1, should not be assigned at all.
xres and yres are not variables, just text values for r_6 and r_7 to aid in debugging it appears.
I used FindPixelColor to guarantee a color is found to test the r=1 condition.
//Get a color, then find that color.
GetPixelColor>111,164,nColor
// Find color between 0,0 and 500,500
LibFunc>fcLib,FindColor,r,nColor,0,0,500,500,xres,yres
Gale
-
- Junior Coder
- Posts: 33
- Joined: Sat Feb 27, 2010 8:11 pm
HElp
Still not working
Anyone got any suggestions?
Anyone got any suggestions?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: HElp
You must be doing something wrong (e.g. a typo in your code or looking for the wrong pixel color). How about posting your code.mokshal1663 wrote:Still not working
Anyone got any suggestions?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Junior Coder
- Posts: 33
- Joined: Sat Feb 27, 2010 8:11 pm
Code
// COMPILE_OPTS|C:\Documents and Settings\mokshal\My Documents\AutoBot\AutoFlaxer\AutoFlaxer.exe||CONSOLE=0|INCLUDES=1|
Dialog>AutoSpin
Caption=AutoEP - http://www.autobot.tk
Width=407
Height=239
Top=294
Left=827
Button=Start,32,96,97,41,1
Button=End,272,96,97,41,2
Image=fbg copy.jpg,0,0,401,201,msImage1,0
Button=Info,152,128,97,41,3
Label=Bot ID: 2,176,176,true
EndDialog>AutoSpin
Label>codeStart
show>AutoSpin,result
if>result=2
goto>end
endif
if>result=1
goto>start
endif
if>result=3
MessageModal>Start your character lumbridge bank, make sure flax is visable in the bank!
goto>codeStart
endif
Label>start
Message>Authorizing ID: 2
/*HTTPRequest>http://www.nakido.com/F8DD9F6D48B74E204 ... ,GET,,Data
if>Data=404 HTTP/1.1 404 Not Found
goto>Disabled
endif
Label>Disabled
MessageModal>Your Bot Has Been Disabled. For questions please contact [email protected] or the msn [email protected]
*/
Wait>5
//GetPixelColor>680,169,col
//Message>col
Let>fcLib=%SCRIPT_DIR%\findcolor.dll
LibFunc>fcLib,FindColor,r,10067879,325,32,1362,761,xres,yres
If>r=1
Let>x=r_6
Let>y=r_7
MouseMove>x,y
RClick
Wait>1
Let>YB=y+45
MouseMove>x,YB
LClick
WaitPixelColor>11446860
Endif
Let>fcLib=%SCRIPT_DIR%\findcolor.dll
LibFunc>fcLib,FindColor,r,11446860,325,32,1362,761,xres,yres
If>r=1
Let>x=xres
Let>y=yres
MouseMove>x,y
RClick
Wait>1
Endif
Label>end
Dialog>AutoSpin
Caption=AutoEP - http://www.autobot.tk
Width=407
Height=239
Top=294
Left=827
Button=Start,32,96,97,41,1
Button=End,272,96,97,41,2
Image=fbg copy.jpg,0,0,401,201,msImage1,0
Button=Info,152,128,97,41,3
Label=Bot ID: 2,176,176,true
EndDialog>AutoSpin
Label>codeStart
show>AutoSpin,result
if>result=2
goto>end
endif
if>result=1
goto>start
endif
if>result=3
MessageModal>Start your character lumbridge bank, make sure flax is visable in the bank!
goto>codeStart
endif
Label>start
Message>Authorizing ID: 2
/*HTTPRequest>http://www.nakido.com/F8DD9F6D48B74E204 ... ,GET,,Data
if>Data=404 HTTP/1.1 404 Not Found
goto>Disabled
endif
Label>Disabled
MessageModal>Your Bot Has Been Disabled. For questions please contact [email protected] or the msn [email protected]
*/
Wait>5
//GetPixelColor>680,169,col
//Message>col
Let>fcLib=%SCRIPT_DIR%\findcolor.dll
LibFunc>fcLib,FindColor,r,10067879,325,32,1362,761,xres,yres
If>r=1
Let>x=r_6
Let>y=r_7
MouseMove>x,y
RClick
Wait>1
Let>YB=y+45
MouseMove>x,YB
LClick
WaitPixelColor>11446860
Endif
Let>fcLib=%SCRIPT_DIR%\findcolor.dll
LibFunc>fcLib,FindColor,r,11446860,325,32,1362,761,xres,yres
If>r=1
Let>x=xres
Let>y=yres
MouseMove>x,y
RClick
Wait>1
Endif
Label>end
Please provide this detail:
The return values for r, r_6, and r_7.
Your OS so someone can try to reproduce problem.
Try this:
Reactive your GetPixelColor code in case color has changed.
Replace the hardcoded color code with %col%.
Make sure you have erased all trailing spaces in your script.
I don't believe FindColor recognizes color tolerance, so the color has to be right on. Try JRL's suggestion, FindImagePos allows for a color tolerance in case there is some variance from run to run or machine to machine.
Gale
The return values for r, r_6, and r_7.
Your OS so someone can try to reproduce problem.
Try this:
Reactive your GetPixelColor code in case color has changed.
Replace the hardcoded color code with %col%.
Make sure you have erased all trailing spaces in your script.
I don't believe FindColor recognizes color tolerance, so the color has to be right on. Try JRL's suggestion, FindImagePos allows for a color tolerance in case there is some variance from run to run or machine to machine.
Gale
wahaha hello runescapian you do realise that the color changes right and is not constant? and you should not be worrying about color what you need to do is learn to use image recognition when you right click something in runescape the color is still constant wich makes for easy autoers like when you right click a monster you will get like 3 options
attack monster
view monster
walk here
or something like that
or you can do it your way wich is long and boring and dosent always work
and requires multiple colors for all the color changes it runs thru
also the mini map colors are still constant so walking can still work too just the icons on mini map can change exact location slightly so you will need to make use of the findcolor dll for running back and forth also clickable text in runescape never changes positon when its the blue tect you can interact with at bottom of screen wqhen talking to a npc
also never trust autobots it is bad site all the way around
attack monster
view monster
walk here
or something like that
or you can do it your way wich is long and boring and dosent always work
and requires multiple colors for all the color changes it runs thru
also the mini map colors are still constant so walking can still work too just the icons on mini map can change exact location slightly so you will need to make use of the findcolor dll for running back and forth also clickable text in runescape never changes positon when its the blue tect you can interact with at bottom of screen wqhen talking to a npc
also never trust autobots it is bad site all the way around
if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!