Posts: 51
Threads: 6
Joined: Jan 2005
Okay i have the first part of the macro setup ,and its working great, for the next part, i want the macro to look on the screen for one of 3 specific sayings. We'll say these sayings are greengreengreen, blueblueblue, or whitewhitewhite. I want it to search the whole screen for one of those texts, if it finds it, i cant it to execute another part a the macro (press e, then 1 2 3 4 5 lets say) However, if it dosnt find any of this text, i want it to execute another part (lets say up arrow for 2 seconds, then right arrow for 0.5 seconds) how would this be done? I have tried playing around with find accessible object. However it would seem never be able to find the text. Also im not sure if you need to have a target box (the aimer with drag on it) where the text is spossed to appear. Also im un-sure what to do once it does find the text. if you could help with this, that would be great.
thanks
Posts: 12,097
Threads: 142
Joined: Dec 2002
When you drag the picture and drop it on the desired object (button, text, etc), "Find accessible object" dialog fields are populated. Click Test. If you see black blinking rectangle tightly surrounding the object, and then appears Success message, the object can be successfully found. If you see error message, or rectangle surrounds larger area, object cannot be found. In case of error message, you can try to change values in some fields and test again.
When object is found, uncheck 'Error if not found' and click OK. This inserts something like
Acc a=acc(..........)
Then use if and else.
Acc a=acc(..........)
if(a.a) ;;found
,execute
,this
,code
else ;;not found
,execute
,other
,code
Note: acc function searches only objects in a single window, not in all windows.
Note2: acc and similar functions often don't work in games.
Note3: acc function in some windows works slowly.
Posts: 51
Threads: 6
Joined: Jan 2005
The window flashes and it says it success full in finding the whole game window. But what i want to be a success is if it finds a certain string of text inside of that window (string of text being blueblueblue). Where would i type this in for that to be done?
(what its saying is a success it it is finding the game "client" not the string of text inside of it)
Posts: 12,097
Threads: 142
Joined: Dec 2002
It means, Quick Macros cannot find the object. The game program does not expose it as accessible object or as some other kind of object that another programs would be able to find.
Posts: 51
Threads: 6
Joined: Jan 2005
would there be able other way of doing this? To be able to find the string of text in game? or even a certain color?
Posts: 12,097
Threads: 142
Joined: Dec 2002
To get color, use the pixel function. There is no dialog for this function, but if you have QM 2.1.5, you can use the "Wait" dialog to capture the color. Or, read Help.
Posts: 51
Threads: 6
Joined: Jan 2005
The one under wait correct?
also do i put the color code in the box marked color?
Posts: 51
Threads: 6
Joined: Jan 2005
Alrihgt i have this:
WaitPixelColor(0 0xFFBE00 53 619)
so that means its waiting for that color, in the window thats up right? Now how do i make it, that if it does find that color, to do something like: key e, however if it dosnt find that color, i want it to look for another color. How would that be done?
it seems to be working in the sense that, if it finds the blue it continues on with what i want it to do (press e) however if it dosnt find the blue, it jsut stops until it does, wotn run anythign else...how do i make it..that if it dosnt find the blue (color) after about a second, to move on to the next color, then finally a last color, and if it finds non, to exceute something else like up arrow, up arrow right arrow?
Posts: 12,097
Threads: 142
Joined: Dec 2002
int c=pixel(53 619) ;;get color of pixel 53 619
if(c=0xFFBE00) ;;if color is 0xFFBE00
,key e
else if(c=...)
,...
Posts: 51
Threads: 6
Joined: Jan 2005
Alright heres a part of it:
5
key+ R
0.1
key- R
key (VK_F8)
key v
int c=pixel(53 619) ;;get color of pixel 53 619 (location)
if(c=0xFFBE00) ;;if color is 0xFFBE00 (blue con color)
,key e
key 1
key 3
key 1
key 3
key 1
key 3
key 1
key 3
key 1
key 3
key 1
key 3
key 1
key 3
key 1
key 3
else if(c=l0xFFFFFF) ;;White con color
,key e
key 1
key 3
key 1
key 3
key 1
key 3
key 1
key 3
key 1
key 3
key 1
key 3
key 1
key 3
key 1
key 3
however when i try that, it highlights the "else" and says:
Error in Program1: else without if.
but, if i take away the "else" it seems to be working, havnt tested it enough yet to be sure
Posts: 12,097
Threads: 142
Joined: Dec 2002
5
key+ R
0.1
key- R
key (VK_F8)
key v
int c=pixel(53 619) ;;get color of pixel 53 619 (location)
if(c=0xFFBE00) ;;if color is 0xFFBE00 (blue con color)
,key e
,rep 8
,,key 1
,,key 3
else if(c=0xFFFFFF) ;;White con color
,key e
,rep 8
,,key 1
,,key 3
Posts: 51
Threads: 6
Joined: Jan 2005
Now if i wanted that whole script to repeat 5 times how would i do that?
rep 5
then a ,, on the next thing after that, however then only the line after that repeats 5 times.
Posts: 12,097
Threads: 142
Joined: Dec 2002
Select whole text after rep 5 and press Tab. Tabs and commas are the same.
Posts: 51
Threads: 6
Joined: Jan 2005
Alright, well i continued with my script. Got the basics done. Seems like everything should work properly, and now im going back and adding more "features" to the script. WHich brings me back to the place i was having a problem before, heres a peice of the code again:
rep 99999
13
key+ R
0.1
key- R
key (VK_F8)
int d=pixel(87 99) ;;look for color at this location
if(d=0xFFBE00) ;;if color is blue, stop script here, and go back to the begining.
else if(d=0xFFFFFF) ;;if color is White, stop script here, and go back to the begining.
else if(d=0x40FF40) ;;if color is green, stop script here, and go back to the begining.
key v
int c=pixel(53 619) ;;get color of pixel 53 619 (location)
if(c=0xFFBE00) ;;if color is 0xFFBE00 (blue)
,key e
,rep 12
,,key 1
,,key 3
else if(c=0xFFFFFF) ;;White
,key e
,rep 12
,,key 1
,,key 3
else if(c=0x40FF40) ;;green
,key e
,rep 12
,,key 1
,,key 3
alright well what i want it to do is all where the d=pixel is, if it finds any one of those colors at that location, to stop running the rest of the script, and start the script again from the beginging. If it dosnt find one of those colors, to continue on with the script. I also made it d=pixel, because when i had c, an error came up saying: "name already exists."
(right now i beleive im telling the script to look for those, and when found, to continue, thats not what i want happening)
Thanks again for the help
Posts: 12,097
Threads: 142
Joined: Dec 2002
rep
,13
,key+ R; 0.1; key- R; key F8
,
,sel pixel(87 99)
,,case [0xFFBE00,0xFFFFFF,0x40FF40] continue
,
,key v
,
,sel pixel(53 619)
,,case [0xFFBE00,0xFFFFFF,0x40FF40]
,,key e
,,rep 12
,,,key 1
,,,key 3
Posts: 51
Threads: 6
Joined: Jan 2005
Edit nvm
but i am wondering one thing, you changed it now to sel pixel, and before you had c=pixel, and now i added in, so that the script wouldnt continue until a pixel was at a certain place, i used:
,WaitPixelColor(0 0xD6565E 68 43)
Whats the benifits from using one way over the other?
|