What does step do? Also, changing single pixel colors?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
What does step do? Also, changing single pixel colors?
Hi,
I'm trying to use a stack to change individual pixel colors (surprising challenge with LiveCode). Anyway, one stack that I'm experimenting with has a word "step" in the repeat loop "repeat with i = 1 to tLength step 4".
My silly question is what is step doing? It's not in help or the dictionary. Is it jumping by 4 steps at a time?
Secondary, if someone happens to know how to change a pixel color (I'm trying to sprinkle black pixels on a white square), that'd be great.
Josh
I'm trying to use a stack to change individual pixel colors (surprising challenge with LiveCode). Anyway, one stack that I'm experimenting with has a word "step" in the repeat loop "repeat with i = 1 to tLength step 4".
My silly question is what is step doing? It's not in help or the dictionary. Is it jumping by 4 steps at a time?
Secondary, if someone happens to know how to change a pixel color (I'm trying to sprinkle black pixels on a white square), that'd be great.
Josh
-
- VIP Livecode Opensource Backer
- Posts: 256
- Joined: Sun May 27, 2007 8:19 pm
Re: What does step do? Also, changing single pixel colors?
Hi
Yes it is jumping through every 4th value in the range you specify in step.
Put the following on a button and put a field on the card and try this.
You can also step backwards by giving a negative value for step.
Not sure how to change a pixel colour though.
Martin Koob
Yes it is jumping through every 4th value in the range you specify in step.
Put the following on a button and put a field on the card and try this.
Code: Select all
on mouseUp
repeat with i = 1 to 100 step 4
put i & CR after tList
end repeat
put tList into field 1
end mouseUp
You can also step backwards by giving a negative value for step.
Code: Select all
on mouseUp
repeat with i = 100 to 1 step -4
put i & CR after tList
end repeat
put tList into field 1
end mouseUp
Martin Koob
-
- VIP Livecode Opensource Backer
- Posts: 256
- Joined: Sun May 27, 2007 8:19 pm
Re: What does step do? Also, changing single pixel colors?
I just had a song pop into my head....
+ goes add
- goes subtract
repeat goes around and around again
mouseDown goes Cli..
mouseUp goes ..ick
return goes back
breakpoint goes stop so you can see what wrong
put goes in
so does set
but what I don't know is....
What does the step do?
Ring a ding ding ding a ding ding a ding
etc......
Maybe Jacque can add LiveCode songs to her LiveCode poetry page....
Martin
+ goes add
- goes subtract
repeat goes around and around again
mouseDown goes Cli..
mouseUp goes ..ick
return goes back
breakpoint goes stop so you can see what wrong
put goes in
so does set
but what I don't know is....
What does the step do?
Ring a ding ding ding a ding ding a ding
etc......
Maybe Jacque can add LiveCode songs to her LiveCode poetry page....

Martin
Re: What does step do? Also, changing single pixel colors?
Hi.
I could answer this, but would rather have you go to the dictionary for "repeat" and look through the comments near the "with" loopForm.
The mouseColor returns the color of the current pixel. You want to set that pixelColor? You cannot set, say, the color of a single pixel on a card. The various colors of features of controls can be set, but you would have to have a rectangle graphic of 1x1 and set its backColor or maybe the borderColor.
Craig Newman
I could answer this, but would rather have you go to the dictionary for "repeat" and look through the comments near the "with" loopForm.
The mouseColor returns the color of the current pixel. You want to set that pixelColor? You cannot set, say, the color of a single pixel on a card. The various colors of features of controls can be set, but you would have to have a rectangle graphic of 1x1 and set its backColor or maybe the borderColor.
Craig Newman
Re: What does step do? Also, changing single pixel colors?
You can manipulate image pixels in all sorts of ways, so if the square is a white image this lesson may give you some ideas:
http://lessons.livecode.com/m/4071/l/126613
There are some other lessons on image processing too, you could try a search through the lessons.
@Martin: I didn't think anyone ever found my personal experimental pages.
http://lessons.livecode.com/m/4071/l/126613
There are some other lessons on image processing too, you could try a search through the lessons.
@Martin: I didn't think anyone ever found my personal experimental pages.

Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: What does step do? Also, changing single pixel colors?
This thread contains some super-wonderful image manipulation tools:
http://forums.livecode.com/viewtopic.php?f=10&t=9490
http://forums.livecode.com/viewtopic.php?f=10&t=9490
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 256
- Joined: Sun May 27, 2007 8:19 pm
Re: What does step do? Also, changing single pixel colors?
@jacque: I had lost the bookmark but with a few google searches I found it. 'LiveCode Haiku Jacque' does the trick.jacque wrote:
@Martin: I didn't think anyone ever found my personal experimental pages.
http://www.jacque.on-rev.com
As far as the song I had just listened to this 'What does the fox say' parody so the tune was going through my head when I read the post.
https://www.youtube.com/watch?v=aEi_4Cyx4Uw
I thought to promote the release of LiveCode 8 it would make a great youTube video. "What does the step do?"
It could be an open source project. People could contribute more lyrics. Someone could host it on git hub, track revisions. I am sure there are a few musicians and singers in the community. And of course the dance moves would be done by Kevin and the LiveCode HQ engineers and staff, in kilts of course, stepping out, up and down the Royal Mile in Edinburgh. If that doesn't go viral what will?

Martin