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

#1 2013-04-09 22:26:06

Unknown164
Scratcher
Registered: 2012-04-08
Posts: 7

Blocks that Create/Delete Variables

We need to have blocks that create/delete variables as part of the script.

when clicked
create variable
Blah
set
Blah
to
1
delete variable
Blah

Like this.

You wouldn't have to have the clutter of a bunch of variables, just a few at a time that are deleted when they are not needed, and created when they are.

Last edited by Unknown164 (2013-04-09 22:27:30)

Offline

 

#2 2013-04-09 22:53:05

kayybee
Scratcher
Registered: 2009-12-07
Posts: 1000+

Re: Blocks that Create/Delete Variables

Unknown164 wrote:

We need to have blocks that create/delete variables as part of the script.

when clicked
create variable
Blah
set
Blah
to
1
delete variable
Blah

Like this.

You wouldn't have to have the clutter of a bunch of variables, just a few at a time that are deleted when they are not needed, and created when they are.

I think this way is better because that is how variables function in most programming languages.

Offline

 

#3 2013-04-09 22:57:12

ProgrammingPro01
Scratcher
Registered: 2011-07-30
Posts: 1000+

Re: Blocks that Create/Delete Variables

I do not think this is pretty unnecessary, as you don't really have any reason to have to delete a variable. Or, at least I haven't needed to. But if you for some reason of had to, there is a work-around for it. Just set the variable to something that won't affect the project. Like "[not used]" or something.

I don't know, I don't know if you have my support or not, yet. Could you tell me how you think this would be useful, because I just can't think of any times this would actually be useful rather than just organization.  hmm


Bye 1.4!
http://www.reactiongifs.com/wp-content/uploads/2013/04/sobbing.gifhttp://25.media.tumblr.com/tumblr_mbfh6bIamQ1qky11ho1_500.png

Offline

 

#4 2013-04-10 16:40:00

Hyperbola
Scratcher
Registered: 2013-03-15
Posts: 100+

Re: Blocks that Create/Delete Variables

A script variable instead would be good too. Not displayed as a variable, but able to store numbers like one.

Or maybe just an easier way to make a for loop. That'll help a lot.

Re: Useful
Looping.


Tip of the whatever: Don't post in threads older than 2 weeks unless your post will actually be useful.
It's the last day of 1.4! *cries* (quote from NeilWest, rest by me) by the time you read this it probably will be 2.0  sad

Offline

 

#5 2013-04-10 23:25:32

kayybee
Scratcher
Registered: 2009-12-07
Posts: 1000+

Re: Blocks that Create/Delete Variables

I think Scratch shouldn't have variables made manually.

It'd match JS, python, and most of those other languages to create variables in script.
(var count = 3 or whatever)

Oh wait. But then I forgot that Scratch is drag-and-drop and that won't work out never mind

Offline

 

#6 2013-04-11 08:53:35

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: Blocks that Create/Delete Variables

kayybee wrote:

I think Scratch shouldn't have variables made manually.

It'd match JS, python, and most of those other languages to create variables in script.
(var count = 3 or whatever)

Oh wait. But then I forgot that Scratch is drag-and-drop and that won't work out never mind

So?
What's wrong with script variables, like BYOB does?


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#7 2013-04-11 10:02:17

veggieman001
Scratcher
Registered: 2010-02-20
Posts: 1000+

Re: Blocks that Create/Delete Variables

i would really like this


Posts: 20000 - Show all posts

Offline

 

#8 2013-04-11 10:18:14

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Blocks that Create/Delete Variables

kayybee wrote:

I think Scratch shouldn't have variables made manually.

It'd match JS, python, and most of those other languages to create variables in script.
(var count = 3 or whatever)

Oh wait. But then I forgot that Scratch is drag-and-drop and that won't work out never mind

It would work if they were typed into a block like this

variable

Anyway, the problem isn't to have to delete any variables, it's creating them when you want to store something in them. Of course that's what lists are for so I find this totally unnecessary.

Offline

 

#9 2013-04-11 16:20:55

shadowmouse
New Scratcher
Registered: 2013-02-03
Posts: 100+

Re: Blocks that Create/Delete Variables

LS97 wrote:

kayybee wrote:

I think Scratch shouldn't have variables made manually.

It'd match JS, python, and most of those other languages to create variables in script.
(var count = 3 or whatever)

Oh wait. But then I forgot that Scratch is drag-and-drop and that won't work out never mind

It would work if they were typed into a block like this

variable

Anyway, the problem isn't to have to delete any variables, it's creating them when you want to store something in them. Of course that's what lists are for so I find this totally unnecessary.

But lists make code less understandable and tidy, and longer. Using item 1 of list: things, item 2 of list: things e.t.c. is less easily understandable than named variables such as x vel, y vel, score... I think something like temp variables that are declared at the start of a script like in squeak or script variables like in byob are much better than the current system.

Offline

 

#10 2013-04-11 18:43:14

kayybee
Scratcher
Registered: 2009-12-07
Posts: 1000+

Re: Blocks that Create/Delete Variables

mythbusteranimator wrote:

kayybee wrote:

I think Scratch shouldn't have variables made manually.

It'd match JS, python, and most of those other languages to create variables in script.
(var count = 3 or whatever)

Oh wait. But then I forgot that Scratch is drag-and-drop and that won't work out never mind

So?
What's wrong with script variables, like BYOB does?

No I meant completely removing manually created variables.

Offline

 

#11 2013-04-11 21:43:28

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: Blocks that Create/Delete Variables

kayybee wrote:

mythbusteranimator wrote:

kayybee wrote:

I think Scratch shouldn't have variables made manually.

It'd match JS, python, and most of those other languages to create variables in script.
(var count = 3 or whatever)

Oh wait. But then I forgot that Scratch is drag-and-drop and that won't work out never mind

So?
What's wrong with script variables, like BYOB does?

No I meant completely removing manually created variables.

You can't delete variables in PHP or JS


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#12 2013-04-11 22:27:24

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

Re: Blocks that Create/Delete Variables

mythbusteranimator wrote:

kayybee wrote:

mythbusteranimator wrote:


So?
What's wrong with script variables, like BYOB does?

No I meant completely removing manually created variables.

You can't delete variables in PHP or JS

PHP:

Code:

unset($var);

JS:

Code:

delete variable;

http://i.imgur.com/BAEgGDL.png

Offline

 

#13 2013-04-11 23:15:19

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: Blocks that Create/Delete Variables

Ah, I remember the PHP code now.

But not JS.  tongue


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#14 2013-04-12 12:39:01

joshuaho
Scratcher
Registered: 2012-08-20
Posts: 100+

Re: Blocks that Create/Delete Variables

Unknown164 wrote:

We need to have blocks that create/delete variables as part of the script.

when clicked
create variable
Blah
set
Blah
to
1
delete variable
Blah

Like this.

You wouldn't have to have the clutter of a bunch of variables, just a few at a time that are deleted when they are not needed, and created when they are.

Great idea!  smile

Last edited by joshuaho (2013-04-12 12:40:03)


Did you know that you can go to space and see Mars by clicking here?

Offline

 

#15 2013-04-12 12:54:51

topazdragonlord
Scratcher
Registered: 2013-02-22
Posts: 500+

Re: Blocks that Create/Delete Variables

You could use lists for this though. Good Idea anyway.
and here are some improved versions of the main variables you did.

create variable
variable
delete variable
variable
when variable
variable
created
when variable
variable
deleted
if variable
variable
is created
if variable
variable
is deleted

Last edited by topazdragonlord (2013-04-12 12:55:39)


http://i45.tinypic.com/idumbk.png

Offline

 

#16 2013-05-01 12:02:51

Scratch12300
New Scratcher
Registered: 2013-04-13
Posts: 38

Re: Blocks that Create/Delete Variables

Hey, I once made a variable caled "Blah"!!

Offline

 

#17 2013-05-01 13:47:28

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: Blocks that Create/Delete Variables

While local script variables à-la BYOB are a good idea, typing variable names in scratch is going to open a new dimension of errors about typos, variables that are not created yet and new scratchers wondering why they cannot access not-yet-initialized variables anymore.

Offline

 

Board footer