Jump to content
Macro Express Forums

End if Pixel Color


archer

Recommended Posts

Simple question but I can't get it going...

 

I currently have:

 

Repeat until n1<>n1

get pixel of screen coords into n1

repeat end

 

I just want it to stop if the pixel color changes. And also when stopping can it play an Audible Alarm?

 

Also, I was wondering if I could have it check two parts of the screen.? Ending if either does not equal the correct color.

 

Also, is there a way to repeat a command until something doesn't exist (pixel color) then continue with the script?

 

Thank you,

Link to comment
Share on other sites

Simple question but I can't get it going...

 

I currently have:

 

Repeat until n1<>n1

get pixel of screen coords into n1

repeat end

 

I just want it to stop if the pixel color changes. And also when stopping can it play an Audible Alarm?

The problem you're experiencing is that N1 will ALWAYS equal N1, even if N1 changes within the repeat, when the Macro

checks to see if N1 equals N1, it will... because N1 = N1

 

What you want to do is something along these lines:

Get Pixel: Screen Coords: 424,432 into %N1%
Repeat Until %T1% <> %T1%
 Get Pixel: Screen Coords: 424,432 into %N2%
 If Variable %N1% <> variable %N2%
Break
 End If
Repeat End

<GETPX:1:S:000424:000432><REP3:08:000002:000001:0001:1:01:T1><GETPX:2:S:000424:000432><IFVAR2:5:01:2:N2><BREAK><ENDIF><ENDREP>

This way the macro will repeat until N1 does not equal N2, because N1 is set before the Repeat Loop begins, it will never change.

N2, on the other hand, will only equal N1 until that pixel changes, at which point the Loop will break, and the rest of the macro can

continue.

 

Also, you can add a sound to the macro using the Sound Beep command or the Sound Wave File command (located under the

Multimedia category by default).

Link to comment
Share on other sites

Thank you both, I will try it out shortly.

 

With that logic can I also specify two different points for it to make sure has the correct color?

 

Can I have the sound go off if the macro is ended? (So I wake up..or can hear it beeping)

 

I understand the one Kevin posted a bit more I think I could put two points into it... And I just put that code anywhere in my script? Then when that script stops repeating can I make it audible beeps?

Link to comment
Share on other sites

Thank you both, I will try it out shortly.

 

With that logic can I also specify two different points for it to make sure has the correct color?

 

Can I have the sound go off if the macro is ended? (So I wake up..or can hear it beeping)

 

I understand the one Kevin posted a bit more I think I could put two points into it... And I just put that code anywhere in my script? Then when that script stops repeating can I make it audible beeps?

 

 

Update-- I worked with both of them but didn't get it working, probably inserted incorrectly. This is just a check for pixel change along with a long script for a videogame.

Link to comment
Share on other sites

Any idea's I can't get the script to end on pixel color change and another biggie was if the pixel color changes and the macro ends can i play audible repetitive beeps to alert me to the ending.

 

Thanks all!

To help us understand what might be going wrong, please provide the macro code inside [ codebox ] and [ /codebox ] tags (remove the spaces).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...