screenmouseloc not cutting it

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: screenmouseloc not cutting it

Post by Da_Elf » Sun Oct 15, 2017 1:28 pm

yeah. my question of how to find a color at a specific coordinate is a beginners question. the rest of the code is entry level coding but all put together to make something complex

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: screenmouseloc not cutting it

Post by bogs » Sun Oct 15, 2017 1:40 pm

I agree with the first part for sure, but after watching (all) of those videos, I suspect that the phrase 'entry level' has changed a bit over the decades that have passed since I started writing code :P

But I'll take your word that it is what passes for entry level these days, and will stop derailing your thread :)
Image

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: screenmouseloc not cutting it

Post by Da_Elf » Sun Oct 15, 2017 2:56 pm

im currently just using simple loops and arrays in my code which is simple code even if a bit long

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: screenmouseloc not cutting it

Post by bogs » Mon Oct 16, 2017 9:21 am

Back to the question at hand, I know your using 6.6.2, but I wonder if there isn't something similar to this (I believe Lc 8 dictionary entry) -
GetPixelDataOfCanvas (operator)
Get the current contents of a canvas as raw pixel data
Syntax
the pixel data of Canvas
----Description
Capture the current contents of the Canvas as raw pixel data in RGBA
format with 8 bits per color component, i.e. 32 bits or 4 bytes per
pixel.
I didn't see anything close, but you never know.
Image

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: screenmouseloc not cutting it

Post by Da_Elf » Mon Oct 16, 2017 12:40 pm

nope. no getpixeldata. was hoping the foreground color thing might work but it didnt
pixel color.JPG

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: screenmouseloc not cutting it

Post by bogs » Mon Oct 16, 2017 7:10 pm

Ah well, then mouseColor (or one of Jacque's solutions) looks like the way it is for us :)
Image

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: screenmouseloc not cutting it

Post by Da_Elf » Tue Oct 17, 2017 2:48 am

yes. im currently using the method of moving the mouse location then testing the pixel at the location then returning the mouse to its start. i foresee it having to test a couple hundred locations or more.

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: screenmouseloc not cutting it

Post by bogs » Tue Oct 17, 2017 4:55 am

... i can still see the pointer buz around the screen. should i just hide the pointer then unhide it?
Are you still seeing the 'jitter' you were mentioning earlier?
Image

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: screenmouseloc not cutting it

Post by Da_Elf » Tue Oct 17, 2017 10:53 am

the jitter in the position of the mouse if because its going to all of the locations (currently 8 because im only currently testing the neighbours around the start point). But my trick was to set the cursor to none then set it back to arrow when its done.

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: screenmouseloc not cutting it

Post by bogs » Wed Oct 18, 2017 3:15 am

Yes, I see now. I put the same 3 colors, a list box, and a repeat loop for 100x visiting each color. Oddly, even though it was looping through the locations of the 3 colors, without hiding the mouse arrow, it would actually show up outside of the stack by quite some distance, regardless using the globalLoc and the localLoc, or just location. Unfortunately, it would be tough to get a screen shot of that aspect of it.

Hiding it gave a slightly unsightly brief disappearance of the cursor itself, however that might be (read that most likely is) because of the inefficiency of my testing method, and the fact that it does run 100x.
Image
Image

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: screenmouseloc not cutting it

Post by bogs » Sat Oct 21, 2017 9:24 pm

You know this question really must have bugged me, because I was still wondering why you would have to go to all this rigamarole to get the color of a square :roll:

Mind you Da_Elf, I don't know if this will suit your need or not, or maybe you are satisfied with where the solution is now, but I hope so :D

Ok, remember the little demo picture of mine, where I made 3 graphic objects of different colors? For those of us with 'all-the-timers', here is the new 'improved' routine picture
Image
I think the code is pretty much as simple as I can make it, I remember you were talking about a 'path of colored squares', so I think this works fairly well, fairly quick, and without needing to know where you are since the mouse isn't involved at all (other than clicking).
Image

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: screenmouseloc not cutting it

Post by Da_Elf » Mon Oct 23, 2017 3:01 am

i need to test a black and white image that would be an indication of walkable areas and non-walkable areas. thats why im testing the color of an area. i will put the walkable areas into 1 list and the rest in another list. This way i know what areas i can proceed to test next

Post Reply