Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mac Command
#1
Hello,

Ive got two questions.

The first being about "mac" commands.
I have 1 macro that is the MAIN macro, at some point in this maco, the command:
mac "macro2" Will be introduced. Allowing both macro's to run at the same time. However, then further down the main macro, "macro2" Will be SHUT OFF. How would i do that?
I know if i did command mac- it would end the main macro ,and only run macro2, but that is not what i would like to do.

Secondly, i know
sel pixel (99 99)
,case [0x3030FF]

means for the macro to look at a certain location for a certain color, and if that color appears, either start the macro over again...add in further commands..etc

However i am looking to make something where. It look's at a certain point for a pixel color, and then, if that color ever DISAPEARS, for it to do something like press F1.

Since the color behind the object will always be changing, i can't simply do it whenver object1(color1) disapears, look for color2(behind object1) because it will always be different.

So it needs to watch the location for that CERTAIN color, whenevr that color changes to ANYTHING but itself, to continue with other commands.


Hopefully that wasnt really confusing =P

Thanks,
[Image: banner-grunge2.jpg]
#2
1. At least one of them (main macro or macro2) must be function. Main macro can end macro2 using

shutdown -6 0 "macro2"

It is the easiest way, but also can be used other ways, eg global variables.

2. Try "wait for color" action in the Wait dialog. Check Not. It waits until the color disappears.
#3
1. What do you mean "Must be Function" ?
The main macro will be running constantly, with only macro2 being activated/deactivated throughout the macro

2. Thank you very much ,this one should work great!
[Image: banner-grunge2.jpg]
#4
Quote:What do you mean "Must be Function" ?

Its type must be function, because two items of type macro cannot run simultaneously.
#5
there are two ways of running your code. as a macro or as a function. only one macro can be running at a time but you can have any number of functions running on once. you can change a macro to a function in the Properties dialog under the Macro Properties tab.
An old blog on QM coding and automation.

The Macro Hook
#6
ah, i get it now.

I just have one final question now. Sometimes the macro will get stuck on something. So i want to know if it's possible, to add something that if the macro gets stuck at a certain spot like, wait for color for longer then..10min, it will do a certain command, wait 30seconds, and restart the macro...is that possible?
[Image: banner-grunge2.jpg]
#7
yes. without seeing your code, it's hard to give you the best way but you can use the 'goto' to do this.

Code:
Copy      Help
;restart

;code does a bunch of stuff here

600 C 0x000000 10 10;;waits 10 minutes for the colour black at position 10 10
;if it doesn't see the colour it keeps going
;****
;the command here if it didnt find the colour
;*****

30;;wait 30 seconds
goto restart
An old blog on QM coding and automation.

The Macro Hook
#8
Sorry to keep asking questions. Had my macro working perfect until i came across a product and have to revamp it.
At a certain point in the macro, i had it waiting for a certain color at a certain position. However i ran into a problem, and now i am looking to do something. That at a certain point at a macro, it is going to look at a specific location, and anytime there is ANY color change, the macro will contiue.
As the color is always changing there, i can not do something like look for a certain color to appear or disapear. It needs to look at the location just so any whatsoever change at that location. How would i go about doing this?

Thanks again for all the help, the support around here is really amazing =)
[Image: banner-grunge2.jpg]
#9
you could code it to 'get' the colour from there and then check in a second or two to see if it's the same if not break out of the loop and do the commands if it is the same wait a second or so and redo it.
An old blog on QM coding and automation.

The Macro Hook
#10
Actually that would be good. How would i do that?
I would like it to look at that certain location at a point in the script, take note of what color is there, and then constantly check to see if it changes.
That is something that is compltly out of my skill range, so if you could be as detailed as possible as how i would do that, that would be great.
[Image: banner-grunge2.jpg]
#11
how about this?


Code:
Copy      Help
mou 305 85 "Quick Macros"
int col
col = pixel(305 85 "Quick Macros")
rep
,if col = pixel(300 85 "Quick Macros")
,,out "continue"
,,0.5
,,ClearOutput
,,continue
,else
,,break
out "break"
An old blog on QM coding and automation.

The Macro Hook
#12
Ill give it a shot now =) thanks,
but could you explain alittle what each line of text means? I understand some of the basic ones, but some of the others really confuse me.
[Image: banner-grunge2.jpg]
#13
what ones are you unsure about?
An old blog on QM coding and automation.

The Macro Hook
#14
Code:
Copy      Help
mou 305 85 "Quick Macros" ;;mouse movement
int col ;;Stores the color from where the mouse is above
col = pixel(305 85 "Quick Macros")  ;;not really sure what this means...seems same as top
rep  ;;repear
,if col = pixel(300 85 "Quick Macros")  ;;if the color is there
,,out "continue" ;;not sure, maybe continue??
,,0.5 ;;wait?
,,ClearOutput  ;;everything from this line down, im pretty much unsure
,,continue
,else
,,break
out "break"
[Image: banner-grunge2.jpg]
#15
ken gray Wrote:how about this?


Code:
Copy      Help
mou 305 85 "Quick Macros"
int col  [color=red]this is just initialing the integer 'col'[/color]
col = pixel(305 85 "Quick Macros") [color=red]Stores the color from the xy inside the parens[/color]
rep
,if col = pixel(300 85 "Quick Macros")
,,out "continue"[color=red]just puts the word continue in the output of the editor for debug[/color]
,,0.5[color=red]waits half-second[/color]
,,ClearOutput[color=red]clears the Editor's output box for debugging[/color]
,,continue[color=red]if colour the same keep repeating[/color]
,else
,,break[color=red]if colour is changed stop repeating and go on[/color]
out "break"[color=red]output for debugging[/color]
An old blog on QM coding and automation.

The Macro Hook
#16
ken gray Wrote:
ken gray Wrote:how about this?


Code:
Copy      Help
mou 305 85 "Quick Macros"
int col  [color=red]this is just initialing the integer 'col'[/color]
col = pixel(305 85 "Quick Macros") [color=red]Stores the color from the xy inside the parens[/color]
rep
,if col = pixel(300 85 "Quick Macros")
,,out "continue"[color=red]just puts the word continue in the output of the editor for debug[/color]
,,0.5[color=red]waits half-second[/color]
,,ClearOutput[color=red]clears the Editor's output box for debugging[/color]
,,continue[color=red]if colour the same keep repeating[/color]
,else
,,break[color=red]if colour is changed stop repeating and go on[/color]
out "break"[color=red]output for debugging[/color]


I seem to be having a problem, when it moves the mouse to that location, and gets the color, then since the mouse is above it, it is a different color, and moves on right away, is it possible to look at the location and get the color without actually moving the mouse there?
[Image: banner-grunge2.jpg]
#17
Code:
Copy      Help
,,mou 308 294
,,int col  ;;this is just initialing the integer 'col'
,,col = pixel(308 294) ;;Stores the color from the xy inside the parens
,,rep
,,,if col = pixel(308 294)
,,,,out "continue" ;;just puts the word continue in the output of the editor for debug
,,,,0.5 ;;waits half-second
,,,,ClearOutput ;;clears the Editor's output box for debugging
,,,,continue ;;if colour the same keep repeating
,,,else
,,,,break ;;if colour is changed stop repeating and go on
,,out "break" ;;output for debugging

Thats what i put in, except the second the mouse moves to that location, it continues with the script...but the color hasnt changed..
[Image: banner-grunge2.jpg]
#18
i got rid of the mouse movement, but again, even though i know 100% the color hasnt changed, the macro moves on...
[Image: banner-grunge2.jpg]
#19
post your code and let's take a look.
An old blog on QM coding and automation.

The Macro Hook
#20
Below is the code i use. Most is mouse Movements. Even after i took our the "mou" in the code you gave me, it still dosnt work. Also in the dwebug, it would always write the "break" BUT would never write continue, even though the code itself was continuing.

Code:
Copy      Help
rep 9999999999999999
,
,spe 10
,int w1=act(win("EVE" "triuiScreen"))
,lef 18 742 w1; 34.95
,mou "@aw47Xiw31Siw188BbB@w31Fcw31Law31O@Hcw32Vew31+33-13w31Ytw31Vww32Rqw31Ljw31Qpw31Mqw16JjCbw31Miw31Njw32Gew31B@w31Dbw31Ebw32GaE@w62+28+0w16K@C@w47N@w31Daw78a@w31a@w172"
,lef+ 396 551 w1; 0.06
,mou "@bw47@cw31ccw125-16-30w31ehw47bew16bcw31bcw31abw31acw47adw31aaw16@cw31@c@aw32@aw31@bw31@cw31@bw32@dw31@ew31@dw31@gw32@fw31@gw31@hw31@gw32@ew31aew31@dw31acw32acw31aew31@dw47@jw31@gw31Bhw47Chw32Cgw31Aew31Abw31@bw32A@w31@aw31BaAaw31Daw32G@w31H@w31E@w31D@w16A@w31C@w16B@w47C@w15B@w32D@w31D@w31E@w31D@w32E@w31D@w31C@w31C@w32C@w62B@w47A@w31B@w31E@w32JBw31IAw500"
,lef- 475 342 w1; 0.89
,mou "CAw31IEw31JEw31GCCAw32NFw31LGw31NJw31ZPw47QKw31+27+13w32MHw31GDw31FCw31CBw32DAw31ECw31AAw31AAA@w32DABBw31LCw31A@w297JDw31+37+1w32O@w31Baw31@aw31@bw32@aw62baw31aaw32a@w31bb@aw31aaw31aaw594fdw31ea@aw32bbw31ccw31cew31ajw32@ow31@nw31@mw31cpw47clw16@fw15@bw32@dw31@cw31adw31@dw32@ew31@bw94"
,rig 706 316 w1; 0.78
,mou "CGw47EIw31EJBCw47KOw31OVw31KPw32GLw62KVw31EIw63@Dw31@Bw31@Bw32@Bw31@Bw62aBw32@Aw31@Aw797b@w31eaw31ibw32b@w31baw31b@w31b@w32c@w31d@w31e@w78i@w31d@w32d@w31b@w31b@w31c@a@w47e@w32c@w46a@w16a@w47b@w16a@w296"
,lef 706 453 w1; 62.17
,mou "Bjw16Csw16+6-32w15DtBhw31Hxw16+13-33w16Jxw31+14-31w16Iyw31+11-31Dgw15Irw16Nyw31ItBdw47+4-28w31@ow16@dw16@g@bw31Aaw453BBw31FBA@w32DDw15CBw31AAw32F@w15Aaw47A@w141@aw31Caw31Aaw32A@w31@Aw109@Aw63@Aw109aAw31aAw157"
,rig 859 77 w1; 0.53
,mou "@Aw31@Aw31@Ew16ABw16@Ew31@Dw15ADw32@Dw62@Kw31@Dw94@Ew31@Aw16@Aw16@Aw15@Aw47@Aw16@Aw15@Aw32@Aw15@Aw32@Cw31@Cw31@Aw313"
,lef 861 139 w1; 0.48
,mou "@bw31@cw31acabw32beaaw31dkw31bdw31aaw32@aa@w31@aw31bcw31@aw32aaw31aaw31a@w31bbw16abw31aaw32baw31@aw172"
,rig 837 92 w1; 0.48
,mou "@Bw31@Bw32ABw15@Bw16ACw31ADw16BDw31BEw16ACw31ACw31ADw31ACw16@Aw31@Bw31@Cw16@Bw31@Bw32@Aw15@Aw31@Bw32@Aw47@Bw31@Aw15@Aw47@Aw172"
,lef 848 149 w1; 0.30
,mou "b@w31eAw32kCw31sGw31pIeDw31nJcCw32hEw31gFw15cFcCw32dIw31cF@Aw31aEw31bGw32cHw15cFw47dIw16dIw31bEw31bDaAw5391Baw16A@w78@Aw15@Dw32@Ew15@Dw16aFw31aHw16bHw15dMw32dPw15cKw31gQw16gVw31gZw32-11+39w15jYw31-11+28cKw32eTw15eKbCw32bHw15cGw16bE@Bw31bCw16aFw15@C@Bw32@Bw15@Dw16aBw31@Bw31aBw32aBw31aAw15bCw32cGw31bDw16bDaBw31cDw31cDw47cFw16bDw31a@w31@Aw31a@w625"
,lef 606 643 w1; 0.28
,mou "@bw31Cjw15DjAdw32Enw15CfBcw32Cew15Dew16Abw3265"
,
,
,,int col  ;;this is just initialing the integer 'col'
,,col = pixel(308 299) ;;Stores the color from the xy inside the parens
,,rep
,,,if col = pixel(308 299)
,,,,out "continue" ;;just puts the word continue in the output of the editor for debug
,,,,0.5 ;;waits half-second
,,,,ClearOutput ;;clears the Editor's output box for debugging
,,,,continue ;;if colour the same keep repeating
,,,else
,,,,break ;;if colour is changed stop repeating and go on
,,out "break" ;;output for debugging
,,,spe 10
,,,int w2=act(win("EVE" "triuiScreen"))
,,,rig 613 273 w1; 0.33
,,,mou "aAw31cAw141@Aw16B@w31H@w328CBA@w31BAw16BCw15CCw32DEw15CCBAw32DCw46AAw16@Aw16ABw31ABw16BCw15BDw31BBw16BEw172DTw31@Cw63aFw15@Aw32@B@Aw15@Bw31@Cw16@Bw31@Bw32@Cw125@Aw359a@w47a@w47b@w15a@w16c@w16baw31b@w15b@a@w16a@w31a@w16b@w31a@w16c@w15b@a@w32b@w15e@w16e@w62paw63r@w31g@w16g@w31d@w16a@w31b@w16c@w15a@w31a@w16c@w31b@w16a@w31b@w16b@w31a@w156@Aw47aCw16@Cw15@Bw32@Dw15@Bw47@Aw219@Aw31B@w16A@w15B@w32C@w15A@w16C@w31D@w16A@w31C@w16C@w31C@w16B@w15B@w63A@w31A@w16Caw31C@w15A@w16C@w31B@w16A@w16A@w31B@w15"
,,,mou "A@w16A@w47A@w31B@w16C@w31B@w16C@w15B@w32C@w15B@w16A@w31B@w16A@w31C@w16B@w15C@w31B@w16A@w31C@w16B@w31A@w16A@w15B@w32B@w15A@w32A@w140@Aw16@Aw15@Aw32@Bw31@C@Bw16@Cw31@Dw15@Cw32@Cw15@Bw63@Dw15@Bw32@Dw31@Bw16@Bw31@Bw312Abw16@a@aw734"
,,,lef 644 414 w1; 72.95
,,,mou "@cw16-5-27w16cow15ajw32cew15few16nlw15jiw32niw15jew16jfw16ogw31qfw15ygw16paw16l@w15yaw32rbw15w@w16l@w31r@w16oBw15tCw16yGw16pEw31xKw15nGw16-28+13w31tIw16-31+12w16zKw31mGw15dCw32aAw93a@w16b@w16g@w31g@w16i@w15h@w31l@w16j@w16e@a@w31b@a@w219"
,,,lef+ 85 375 w1; 0.08
,,,mou "CDBBw15PMw32PLw15XQw32VOw15LIw16URw15LJEDw32KKw15TSw32VUw15ONw16PMw15LKw32RPw15OPw32JLCDw15KLw16NQw31FGw16JJw15FHw32IJw15DFw16CDw31DEw16DDw15IKw32EFw15ABw16@Bw406"
,,,lef- 446 720 w1; 0.19
,,,mou "abw31cdw15cdw32tww15low16-41-41w31-42-45w47-92-83w16-26-27w15klw32ffw15adw31eiw16cew16fhw15cdw32bbw15bbw16aaw31bdw16bbw31acw16ccw15bcw31bcw16bbw406@aw16@aw31@aw16@aw15@aw32@aw15@aw32@aw15acw31@bw16@baaw16@bw15bbw32@aw15aaw188"
,,,lef+ 147 381 w1; 0.13
,,,mou "A@w15DDw32GFw15IHw16FEw31LKw16KKCDw31MLw16OTw15RWw31NTw16TZw16LOw31RWw16KPw31+19+28w62+25+42CDw16GLw31GKw16CDw15BEw32BDw15EGw16GLw31HJw31DFw16ADw16BAw375"
,,,lef- 416 735 w1; 0.06
,,,mou "@aw31@bw16@dw31@lw16@gw16@d@bw31@bw15afw16agw16cmw31bmw16doclw15hpw31lxw16ipw16hmcew31ficew16gkw31nxw15lpw32fjw15hjw16eiw78-16-28w47hlw31dgw16cew31hjw31ehw16fhw16gjw62hkw31baw250"
,,,lef+ 234 367 w1; 0.13
,,,mou "BBw16DDw31FEBBw16HFw31QMw16NMw15WWw16NRw31+21+27w31MMw16PWw16JNw15JQw32FHw15HNw16HOw31GLw16EKw31DIw16BFw15EKw31ENw16CE@Cw16ABw31ACw16ACw15ADw31@Dw16ADw16@Bw15@Cw32@Bw15@Bw16@Bw297"
,,,lef- 452 686 w1; 0.67
,,,mou "@bw15Bfw16Bhw31Bhw16Blw15Auw16@ow31@s@hw16Atw15@qw16@l@jw16@lw31@qw16cww15@ow16aow15@gw32@hw15@jw16anw16Akw31Bew15Aew16@dw16@gw15@ew16Aew31AdAcw16@ew15@ew16Agw16Clw15Bkw32Bhw15Aew16@bw1359"
,,,
[Image: banner-grunge2.jpg]
#21
"col = pixel(308 299)"
is getting the colour for the entire screen area not in your window. you should use the window name to have it only look in the window.

see 'pixel' in the help doc for more info.
An old blog on QM coding and automation.

The Macro Hook
#22
yeah, thats what im trying to do. I got the coordinates of the place on the WHOLE screen, however i want it to look at that exact location "308 299" (on the screen) then when there is a change in pixel color at that location, the script moves on

but also like i said, the "break" appears in debug, but never the "continue" even though the script moves on
[Image: banner-grunge2.jpg]
#23
try this to help debug.

make a new macro and run it for about 10 seconds with a half-second wait between each run and have it 'out' the colour of just that pixel to see what it is seeing over a ten second period...
An old blog on QM coding and automation.

The Macro Hook
#24
Sorry, you lost me now. What do you mean?
[Image: banner-grunge2.jpg]
#25
Okay, i tried the command you gave me a few times, and each and everytime, it continues even though the color has not changed, and it also does not write "continue"
Ive tried them in different windows and places
[Image: banner-grunge2.jpg]
#26
I have even tried it like this:

Code:
Copy      Help
mou 638 709 win("EV" "triuiScreen")
int col
col = pixel(638 709 win("EV" "triuiScreen"))
rep
,if col = pixel(638 709 win("EV" "triuiScreen"))
,,out "continue"
,,0.5
,,ClearOutput
,,continue
,else
,,break
out "break"
key 123345

After your suggestion about doing it in the window, it still did not work. it just continues the script even though there is no change, keys the 1233465, and "continue" never appears in debug.

There is a problem with the code. Any ideas? Really need this working for class.
[Image: banner-grunge2.jpg]
#27
run this in a new macro and paste into the forum what the output looks like

Code:
Copy      Help
ClearOutput
int col
rep 20
,col = pixel(638 709 win("EV" "triuiScreen"))
,out col
,0.5
out "done"

,
An old blog on QM coding and automation.

The Macro Hook
#28
Code:
Copy      Help
4684645
4684645
4684645
4684645
4684645
4684645
4684645
4684645
4684645
4684645
4684645
4684645
4684645
4684645
4684645
4684645
4684645
4684645
4684645
4684645
done
[Image: banner-grunge2.jpg]


Forum Jump:


Users browsing this thread: 1 Guest(s)