# How to check if the response from get is the same as color?

**URL:** <https://discourse.processing.org/t/how-to-check-if-the-response-from-get-is-the-same-as-color/30417>\
**Category:** Coding Questions\
**Created:** [June 1, 2021, 2:34pm UTC](https://discourse.processing.org/t/how-to-check-if-the-response-from-get-is-the-same-as-color/30417 "2021-06-01T14:34:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![MoonAlien822](https://avatars.discourse-cdn.com/v4/letter/m/65b543/32.png) [@MoonAlien822](https://discourse.processing.org/u/MoonAlien822)\
**Post date:** [June 1, 2021, 2:34pm UTC](https://discourse.processing.org/t/how-to-check-if-the-response-from-get-is-the-same-as-color/30417/1 "2021-06-01T14:34:27Z")

</div>

```auto
int x=1;
int y=1;
import java.awt.Robot;
import java.awt.image.BufferedImage;
import java.awt.Rectangle;
color pas = color(11, 96, 133); //this is the color

Robot robot;
void setup() {
  size(1500, 3000);
  try {
    robot = new Robot();
  } 
  catch (Exception e) {
    println(e.getMessage());
  }
}
void draw() {
  background(0);
  Rectangle r = new Rectangle(mouseX, mouseY, width, height);
  BufferedImage img1 = robot.createScreenCapture(r);
  PImage img2 = new PImage(img1);
  image(img2, 0, 0);
  get(x,y); //this is the get
  x++;
  y++;
 }

```

---

<div class="post-metadata">

**Author:** ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)\
**Post date:** [June 1, 2021, 3:41pm UTC](https://discourse.processing.org/t/how-to-check-if-the-response-from-get-is-the-same-as-color/30417/2 "2021-06-01T15:41:03Z")

</div>

Hi @MoonAlien822 ,

When you post a question on the forum, can you give more details about what you are actually trying to do ? (rather than putting the question in the title)

What doesn’t work with your current code? What’s the end goal?

It would help us answer your questions! 😉

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [June 1, 2021, 4:13pm UTC](https://discourse.processing.org/t/how-to-check-if-the-response-from-get-is-the-same-as-color/30417/3 "2021-06-01T16:13:29Z")

</div>

@MoonAlien822,

Our community guidelines ask that you:

> Don’t cross-post the same thing in multiple topics.

Community Guidelines:  
[https://discourse.processing.org/guidelines](https://discourse.processing.org/guidelines)

You have related posts here:

- [How to find a colour on the screen?](https://discourse.processing.org/t/how-to-find-a-colour-on-the-screen/30405)
- [Help with error in Robot class and createScreenCapture() method](https://discourse.processing.org/t/help-with-error-in-robot-class-and-createscreencapture-method/30396)

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [June 1, 2021, 4:22pm UTC](https://discourse.processing.org/t/how-to-check-if-the-response-from-get-is-the-same-as-color/30417/4 "2021-06-01T16:22:07Z")

</div>

> [@MoonAlien822](#):
>
> ` get(x,y);`

Make this to:

```auto

color colorFromGet = get(x,y); // store in a variable

if ( colorFromGet == pas ) // compare
     println("Same"); // Hooray! 

```

---

<div class="post-metadata">

**Author:** ![MoonAlien822](https://avatars.discourse-cdn.com/v4/letter/m/65b543/32.png) [@MoonAlien822](https://discourse.processing.org/u/MoonAlien822)\
**Post date:** [June 1, 2021, 4:36pm UTC](https://discourse.processing.org/t/how-to-check-if-the-response-from-get-is-the-same-as-color/30417/5 "2021-06-01T16:36:59Z")

</div>

thanks. what does the

> [@Chrisir](#):
>
> ` println("Same");`

do?

---

<div class="post-metadata">

**Author:** ![debxyz](https://avatars.discourse-cdn.com/v4/letter/d/58956e/32.png) [@debxyz](https://discourse.processing.org/u/debxyz)\
**Post date:** [June 1, 2021, 4:58pm UTC](https://discourse.processing.org/t/how-to-check-if-the-response-from-get-is-the-same-as-color/30417/6 "2021-06-01T16:58:58Z")

</div>

It is the response that prints to the console that answers your question of whether “get” is the same value as “color”.  
On the flip side, if it is **not** equal in value then nothing prints in the console.

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [June 1, 2021, 5:17pm UTC](https://discourse.processing.org/t/how-to-check-if-the-response-from-get-is-the-same-as-color/30417/7 "2021-06-01T17:17:02Z")

</div>

Hello,

There are lots of resources (tutorials, references, examples, etc.) here:  
_[processing.org](http://processing.org/)_

Check out the examples that come with Processing.  
These are in the menu under _File \> Examples…\>_ :

![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/3/35f05e0e0227932c25f0c7f86269d86609c2c294.png)

Other resources:

- Coding Train on YouTube [Coding Train](https://www.youtube.com/channel/UCvjgXvBlbQiydffZU7m1_aw)
- [Processing Tutorials - Happy Coding](https://happycoding.io/tutorials/processing/)

I encourage you to peruse the resource’s available to you on the Processing website and the examples in the Processing app.

I go through these often and learning something new each time.

It will get easier.

`:)`

---

<div class="post-metadata">

**Author:** ![MoonAlien822](https://avatars.discourse-cdn.com/v4/letter/m/65b543/32.png) [@MoonAlien822](https://discourse.processing.org/u/MoonAlien822)\
**Post date:** [June 1, 2021, 6:28pm UTC](https://discourse.processing.org/t/how-to-check-if-the-response-from-get-is-the-same-as-color/30417/8 "2021-06-01T18:28:11Z")

</div>

follow up question here: [How to play a sound when if ( colorFromGet == pas )?](https://discourse.processing.org/t/how-to-play-a-sound-when-if-colorfromget-pas/30426)
