Discuss Scratch
- Dom_206
-
Scratcher
50 posts
new block
create [clone v] variable()
this would be used for clones, sprites, and backdrops to make variables as the project runs. this would be in the control section. iff two variables are made with the same name, they will be treated as the same variable. that space you see will contain the name of the variable. a good way to do it would be
create [clone v] variable(join [var] (var_number)
Last edited by Dom_206 (Oct. 23, 2025 15:06:11)
- jmb1293634
-
Scratcher
1000+ posts
new block
why not just in variables? whats to prevent someone from doing something like this:
also what would the drop-down do would it create the variable for the specified sprite/clone/backdrop in which case why not just make it so that it creates it for whatever creates the variable I think it would be better if it was something like this:
when green flag clickedand crashing scratch
set [i v] to [0]
forever
change [i v] by (1)
create [clone v] variable (join [var] (i))::variables
end
also what would the drop-down do would it create the variable for the specified sprite/clone/backdrop in which case why not just make it so that it creates it for whatever creates the variable I think it would be better if it was something like this:
create [for this sprite only v] variable named: []::variables
Last edited by jmb1293634 (Oct. 23, 2025 15:49:36)
- Dom_206
-
Scratcher
50 posts
new block
why not just in variables? wahts to prevent someone from doing something like this:when green flag clickedand crashing scratch
set [i v] to [0]
forever
change [i v] by (1)
create [clone v] variable (join [var] (i))::variables
end
also what would the drop-down do would it create the variable for the specified sprite/clone/backdrop in which case why not just make it so that it creates it for whatever creates the variable I think it would be better if it was something like this:create [for this sprite only v] variable named: []::variables
the drop-down has the options: clone, sprite, backdrop. that would just make variables over and over and might crash it, but I think people could infer that and not do it.
Last edited by Dom_206 (Oct. 23, 2025 15:43:45)
- Dom_206
-
Scratcher
50 posts
new block
its supposed to be used for mostly clones. when a clone starts it make its own variable. prob more uses tho
- d016
-
Scratcher
100+ posts
new block
So… a
would make a
that is only accessible for the sprite that ran the create variable block?
create a [sprite v] variable named [this is my variable] :: variables
would make a
(this is my variable)
that is only accessible for the sprite that ran the create variable block?
- Dom_206
-
Scratcher
50 posts
new block
So… ano, variables created by this block are for all sprites and clones and backdrops.create a [sprite v] variable named [this is my variable] :: variables
would make a(this is my variable)
that is only accessible for the sprite that ran the create variable block?
- Imtwentytenth
-
Scratcher
500+ posts
new block
I don’t really see use in this variable, cause you aren’t able to select it in the drop down because it isn’t in the project yet.
- Dom_206
-
Scratcher
50 posts
new block
I don’t really see use in this variable, cause you aren’t able to select it in the drop down because it isn’t in the project yet.
you can interact with blocks in the pallet and this isn't in scratch yet but when it is in it you can use the dropdown. that's like saying you don't see use in a car because you cant buy it yet.
- Imtwentytenth
-
Scratcher
500+ posts
new block
I meant that it’s not permanent, it is created automatically and Scratch probably wouldn’t be able to make them in the drop down.I don’t really see use in this variable, cause you aren’t able to select it in the drop down because it isn’t in the project yet.
you can interact with blocks in the pallet and this isn't in scratch yet but when it is in it you can use the dropdown. that's like saying you don't see use in a car because you cant buy it yet.
- Dom_206
-
Scratcher
50 posts
new block
I meant that it’s not permanent, it is created automatically and Scratch probably wouldn’t be able to make them in the drop down.I don’t really see use in this variable, cause you aren’t able to select it in the drop down because it isn’t in the project yet.
you can interact with blocks in the pallet and this isn't in scratch yet but when it is in it you can use the dropdown. that's like saying you don't see use in a car because you cant buy it yet.
its not supposed to be permanent. only while the project runs. also the drop down isn't where the variables are created and nothing is ever put in drop downs.
- Imtwentytenth
-
Scratcher
500+ posts
new block
You can’t change it without it being in a drop down of a “change” or “set” variable block.I meant that it’s not permanent, it is created automatically and Scratch probably wouldn’t be able to make them in the drop down.I don’t really see use in this variable, cause you aren’t able to select it in the drop down because it isn’t in the project yet.
you can interact with blocks in the pallet and this isn't in scratch yet but when it is in it you can use the dropdown. that's like saying you don't see use in a car because you cant buy it yet.
its not supposed to be permanent. only while the project runs. also the drop down isn't where the variables are created and nothing is ever put in drop downs.
- tagrim123
-
Scratcher
500+ posts
new block
How about something like this?You can’t change it without it being in a drop down of a “change” or “set” variable block.I meant that it’s not permanent, it is created automatically and Scratch probably wouldn’t be able to make them in the drop down.-sni[
-snip
its not supposed to be permanent. only while the project runs. also the drop down isn't where the variables are created and nothing is ever put in drop downs.
make a [for this sprite only v] variable named (foo ::grey) ::control //like the my-blocks "define" block when you make variables, you can drag the "foo" part out to other places.this might be script variables tho
using (foo ::grey){
...
}::control
but basically it adds the inserted block into the dropdown menu :3
Last edited by tagrim123 (Oct. 23, 2025 20:40:33)
- Dom_206
-
Scratcher
50 posts
new block
You can’t change it without it being in a drop down of a “change” or “set” variable block.I meant that it’s not permanent, it is created automatically and Scratch probably wouldn’t be able to make them in the drop down.I don’t really see use in this variable, cause you aren’t able to select it in the drop down because it isn’t in the project yet.
you can interact with blocks in the pallet and this isn't in scratch yet but when it is in it you can use the dropdown. that's like saying you don't see use in a car because you cant buy it yet.
its not supposed to be permanent. only while the project runs. also the drop down isn't where the variables are created and nothing is ever put in drop downs.
I think you misunderstand what Im saying
- da-ultimate-creater
-
Scratcher
100+ posts
new block
I would support this is there was a way you could type a variable name into the
set variable [ v] to () :: variablesblock.
- Dom_206
-
Scratcher
50 posts
new block
I would support this is there was a way you could type a variable name into theyou already have it; you can type in the little space. do you only use forums?set variable [ v] to () :: variablesblock.
Last edited by Dom_206 (Oct. 24, 2025 12:04:03)
- Alex5002
-
Scratcher
94 posts
new block
Workarround
Create two lists : Variable name and Variable value.
Then define this :
Now you can set a variable with :
And to read a value (can be shorten if custom reporters are made available to official Scratch) :
Create two lists : Variable name and Variable value.
Then define this :
define set variable (variable name) to (variable value)
if <not<[Variable name v] contains (variable name) ?>> then
add (variable name) to [Variable name v]
add (variable value) to [Variable value v]
else
replace item (item # of (variable name) in [Variable name v]) of [Variable value v] with (variable value)
end
Now you can set a variable with :
set variable [] to [] :: custom
And to read a value (can be shorten if custom reporters are made available to official Scratch) :
(item (item # of [] in [Variable name v]) of [Variable value v] :: list)
Last edited by Alex5002 (Oct. 24, 2025 12:23:44)
- Imtwentytenth
-
Scratcher
500+ posts
new block
It's meant to give the variable a value (insert skull)I would support this is there was a way you could type a variable name into theyou already have it; you can type in the little space. do you only use forums?set variable [ v] to () :: variablesblock.
- Dom_206
-
Scratcher
50 posts
new block
It's meant to give the variable a value (insert skull)I would support this is there was a way you could type a variable name into theyou already have it; you can type in the little space. do you only use forums?set variable [ v] to () :: variablesblock.
no that's where the name goes
- Imtwentytenth
-
Scratcher
500+ posts
new block
What space do you mean? TheIt's meant to give the variable a value (insert skull)I would support this is there was a way you could type a variable name into theyou already have it; you can type in the little space. do you only use forums?set variable [ v] to () :: variablesblock.
no that's where the name goes
[ v] ::variablesor
[] ::variables






