This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2007-08-22 12:57:37

Helot
Scratcher
Registered: 2007-08-15
Posts: 2

Save color to a variable

So, I discovered scratch and have been doing some simple puzzle games as a stress reliever. Not wanting to copy sprites a bazillion times, the problem I had to overcome with a stamp based approach is that it's fairly challenging to get a color off the screen and store it, even though testing to see what's on the screen is pretty easy.

If there was a way to store a color in a variable, and test it against other stored colors, my projects would have been much simpler. I expect that you're trying to avoid having multiple data types in Scratch, but couldn't colors be stored as integer values (packed 24 bit, I'd assume)? Then, all it would take is a (color []) block in the sensing or numbers pane that would provide the standard color selector.

Also, I've seen a lot of comments about incorporating arrays, but my short experience with Scratch makes that seem like it would not integrate well with the visual designing. I think what I'd like to see is the ability to copy the current sprite, including it's current variables and their values. Then, in an odd sort of way, could solve the same kind of problems recursively and visually. I think that would also make it easier to take advantage of the inherently parrallel nature of scratch, as well.

Offline

 

#2 2007-08-22 14:08:05

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: Save color to a variable

color variables and string variables are high on my list of things needed.

I think that arrays are *more* important than dynamic sprite creation, though both would be valuable.

Offline

 

#3 2007-08-22 17:54:27

Helot
Scratcher
Registered: 2007-08-15
Posts: 2

Re: Save color to a variable

I'm not even particularly advocating for dynamic sprite creation in a general sense, as I think that would be rather complicated. I'm just hoping for an exact copy, sort of like a more complete version of stamp.

I agree that arrays would do much to make complicated projects easier, but is scratch really supposed to be worried about complicated projects?

Personally, I don't see much of a use for strings though, without extending the environment significantly to provide text input/output. It may just be because it's too close to my day job, but text parsing in scratch just sounds like a chore.

Offline

 

#4 2007-08-23 09:22:22

Mick
Scratcher
Registered: 2007-03-23
Posts: 100+

Re: Save color to a variable

that string idea could be great for tOy ScRaTcH 1.2.


Go to www.legoless.com
It's my blog.  big_smile

Offline

 

#5 2007-08-23 10:22:35

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Save color to a variable

I think Helot has a good point advocating color variables in form of integers. This wouldn't even change the 'language' of Scratch but still allow for dynamic color settings and for 'wider walls'. One more vote for this!


Jens Mönig

Offline

 

#6 2007-08-23 11:40:41

Sawman3
Scratcher
Registered: 2007-07-19
Posts: 97

Re: Save color to a variable

Add another--this seems to not have a dowside  smile


"These are the old days, the glory days...they're back."

Offline

 

#7 2007-11-02 18:18:48

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Save color to a variable

One more vote for the color variable!  That would simplify a lot of code. 

I'd also like character string variables.  I don't think they would be that hard to add to the environment, and they would open up a world of text-based games.  But I suppose you'd have to have some way of parsing them out too which means a stable of string functions.  Maybe it's too hard after all.  How about in Scratch Pro?  Different "skins" on the IDE depending on the level of the programer?


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#8 2007-11-08 00:49:49

hmnwilson
Scratcher
Registered: 2007-07-04
Posts: 1000+

Re: Save color to a variable

Another vote for the color variable! (seriously, that would be useful in a project I'm thinking of making.)  smile


I'm taking a break from Scratch until 2.0 comes out. Any messages sent between then and now probably won't be read - sorry.
(Oct. 20, 2011)

Offline

 

#9 2008-09-12 16:12:20

likegames
Scratcher
Registered: 2008-03-24
Posts: 100+

Re: Save color to a variable

Paddle2See wrote:

One more vote for the color variable!  That would simplify a lot of code. 

I'd also like character string variables.  I don't think they would be that hard to add to the environment, and they would open up a world of text-based games.  But I suppose you'd have to have some way of parsing them out too which means a stable of string functions.  Maybe it's too hard after all.  How about in Scratch Pro?  Different "skins" on the IDE depending on the level of the programer?

colour variable, another vote! and what about your screen colour, 32-bit or 16-bit?


There are 10 types of people in this world: Those who understand trinary, those who don't, and those who think this is the same old signature.
Three lines! (and base three!)

Offline

 

#10 2008-09-12 17:28:18

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: Save color to a variable

likegames wrote:

Paddle2See wrote:

One more vote for the color variable!  That would simplify a lot of code. 

I'd also like character string variables.  I don't think they would be that hard to add to the environment, and they would open up a world of text-based games.  But I suppose you'd have to have some way of parsing them out too which means a stable of string functions.  Maybe it's too hard after all.  How about in Scratch Pro?  Different "skins" on the IDE depending on the level of the programer?

colour variable, another vote! and what about your screen colour, 32-bit or 16-bit?

Thank you for bumping this!!!!!!!!!!! I would love a circular block (that you could put in math blocks, lists, etc) for the pen color and maybe graphic effects (because you could always just store the costumes)


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#11 2009-07-11 11:48:40

fuzzwuzz
Scratcher
Registered: 2008-06-24
Posts: 87

Re: Save color to a variable

another vote!!!
[blocks]
((hi))
[/blocks]


Ready for the next generation of scratch??? Try Jaguar!
Add grob the slime to your signature to help him take over the world! http://img709.imageshack.us/img709/3252/gobanim2.gif

Offline

 

#12 2010-09-12 17:24:42

johndo77
Scratcher
Registered: 2010-07-30
Posts: 1000+

Re: Save color to a variable

How do you vote? If it is just by saying "I vote," I VOTE!!!

There should also be a pen size and pen shade oval block.


Crizapples

Offline

 

#13 2010-09-13 22:51:23

graham7sarah9
Scratcher
Registered: 2009-07-19
Posts: 28

Re: Save color to a variable

Just a question, but what's wrong with using the block that goes like:
set pen color to (#number)
set color effect to (#number)
I don't exactly get the premonition. Do you mean that you want to use 24 bit colors instead of colors that range 1 to 200? Or  do you want to be able to save a color as a variable, because that's possible.

Offline

 

#14 2010-10-28 17:45:00

Pecola1
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: Save color to a variable

open two (Make sure its two!) offline scratch program windows. shift click on the R in scratch while using the offline scratch program. press turn fill screen off then go to the white space and click. Then click on open. click on browser. Scratch objects. scriptablescratchmorph. then variables. click variableblockcolor. change the number for h:. right click and click on accept. click the x on the top of the green box and when it asks you if you want to save changes click yes. look at your new variable color!. WARNING: when you try to exit your Scratch window it will ask you if you want to save changes. click no or else the variable color will be permanent. If you do switch to the other scratch window I asked you to open. and shift click the R in scratch. click save image for end-user. open another scratch window to see if it worked.


If you are reading this, please read to the end, because if you don't you won't know what's at the end. Don't just skip to the end though otherwise you won't be able to read the middle, which is most important. Now you must be wondering why you just read all that, the reason is you may have not noticed something, read it again and see if you notice it this time  smile

Offline

 

#15 2010-11-12 15:02:01

Mcsugarface
Scratcher
Registered: 2009-11-16
Posts: 100+

Re: Save color to a variable

Another vote!  big_smile  As Paddle2See said another version of Scratch  with more advanced features would be good.


Hi! I'm http://blocks.scratchr.org/API.php?user=USERNAMEHERE&action=onlineStatus&type=text!
http://internetometer.com/imagesmall/11070.png

Offline

 

#16 2010-11-12 15:22:19

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Save color to a variable

I agree


You can now reach me on Twitter @johnnydean1_

Offline

 

#17 2010-11-12 17:47:12

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Save color to a variable

Yes! This would be great to have, especially if we also had a reporter block that reports a color the sprite is touching. (It would report which color the center of the sprite is touching, of course.)


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#18 2010-11-27 01:12:06

piguillaud
Scratcher
Registered: 2010-06-19
Posts: 100+

Re: Save color to a variable

yeah, I made a project ( http://scratch.mit.edu/projects/piguillaud/1439519 ) that took me alot of time to make... with a color variable, it would have taken only 20 minutes.

please look at it...
http://scratch.mit.edu/projects/piguillaud/1439519
http://scratch.mit.edu/projects/piguillaud/1439519
http://scratch.mit.edu/projects/piguillaud/1439519
http://scratch.mit.edu/projects/piguillaud/1439519

Offline

 

Board footer