Discuss Scratch
- Discussion Forums
- » Suggestions
- » ability to create variables while project is running!
- gracewebsite
-
Scratcher
60 posts
ability to create variables while project is running!
when green flag clicked
if <> then
create(varitables)
end
** only helpful for multiplayer games!
Last edited by gracewebsite (July 1, 2015 14:33:08)
- thelucariokid
-
Scratcher
100+ posts
ability to create variables while project is running!
Why don't you just make a variable, and not use it until you need to?
- Pot-of-Gold
-
Scratcher
1000+ posts
ability to create variables while project is running!
Why don't you just make a variable, and not use it until you need to?ANd how would you use it in:
set [ v] to [ ]
change [ v] by (0)
show variable [ v]
hide variable [ v]
- MushroomMan99
-
Scratcher
100+ posts
ability to create variables while project is running!
I support this because I think there would be uses for it and it does not have a workaround (at least not unless you hack Scratch).
However, people could use it to spam people be creating infinite variables, so limits would need to be set on how many you can create in this way in one project.
However, people could use it to spam people be creating infinite variables, so limits would need to be set on how many you can create in this way in one project.
- purplebook163
-
Scratcher
500+ posts
ability to create variables while project is running!
It would be useful to create a variable during the game play and name it
(join (username) ['s Game Level])or something similar for games where data needs to be saved to each player.
- Eli827
-
Scratcher
22 posts
ability to create variables while project is running!
Support!
I have wanted this for sure.
I think that could work.
I have wanted this for sure.
set [New variable v] to [(username) ]
I think that could work.
- Failord
-
Scratcher
1000+ posts
ability to create variables while project is running!
I support this because I think there would be uses for it and it does not have a workaround (at least not unless you hack Scratch).
There is indeed a workaround: LISTS. Am I the only one that realizes that a list is a bunch of variables? Variables that you can create and delete in-project? Variables that can be referenced despite being created and deleted?
Last edited by Failord (Dec. 5, 2015 14:53:15)
- BookOwl
-
Scratcher
1000+ posts
ability to create variables while project is running!
You actually can do this with hacked blocks, AND you can access them!
Semi-support. It would be hard to access the variables created.
But then you are limited to just numeric indexes.I support this because I think there would be uses for it and it does not have a workaround (at least not unless you hack Scratch).There is indeed a workaround: LISTS. Am I the only one that realizes that a list is a bunch of variables? Variables that you can create and delete in-project? Variables that can be referenced despite being created and deleted?
Semi-support. It would be hard to access the variables created.
- DatOneLefty
-
Scratcher
1000+ posts
ability to create variables while project is running!
you can use hacked blocks, and you can get those blocks from your backpack if you put them there. Semi Support
- Saiid
-
Scratcher
1000+ posts
ability to create variables while project is running!
Support
This would be helpful
This would be helpful
- Failord
-
Scratcher
1000+ posts
ability to create variables while project is running!
You actually can do this with hacked blocks, AND you can access them!But then you are limited to just numeric indexes.I support this because I think there would be uses for it and it does not have a workaround (at least not unless you hack Scratch).There is indeed a workaround: LISTS. Am I the only one that realizes that a list is a bunch of variables? Variables that you can create and delete in-project? Variables that can be referenced despite being created and deleted?
Where is your
(variable reporter)coming from? What if the variable doesn't exist when it's in your scripts?
Also, using the numerical index of a list should serve you just fine.
Another workaround is to use local variables and cloning. Technically none of my proposed workarounds help with “multiplayer games” due to a lack of cloud lists.
- Failord
-
Scratcher
1000+ posts
ability to create variables while project is running!
Here's a redirect from one of my posts:
create variable [ ] // category=variables
delete variable [ ] // category=variables
Ignoring the fact that there would be no way to implement reporters, the workaround is to use lists and keep track of which item is which variable:add [] to [ v] // create variable
replace item ( v) of [ v] with [ ] // set variable to/change variable
delete ( v) of [ v] // delete variable
insert [] at (0 v) of [ v] // might be useful
(item ( v) of [ v]) // a fully functional reporter!
Last edited by Failord (Dec. 5, 2015 20:59:36)
- InfernoGhost
-
Scratcher
3 posts
ability to create variables while project is running!
There is a workaround (it requires a reporter to be forced into a non-reporter space, however):
set (join [name] []) to [value]Since there is no “name” variable yet existing in the project, Scratch automatically creates a new variable and sets it to “value.”
- IronBit_Studios
-
Scratcher
1000+ posts
ability to create variables while project is running!
No support as per failord
- AwesomeManJesse
-
Scratcher
48 posts
ability to create variables while project is running!
create variable [ ]::variables
This would be really useful because of things like having users. For example you could make a block like this:
ask [Username?] and wait
set [Username Answer v] to (answer)
create variable (join (Username Answer) [ Score: ])::variables
show variable (join (Username Answer) [ Score: ])
Also, if you do this you would have to have:
move variable [] to x: () y: ()::variables
So it would be this:
ask [Username?] and wait
set [Username Answer v] to (answer)
create variable (join (Username Answer) [ Score: ])::variables
move variable (join (Username Answer) [ Score: ]) to x: (-180) y: (180)::variables
show variable (join (Username Answer) [ Score: ])
Last edited by AwesomeManJesse (Aug. 15, 2016 07:13:23)
- Sheep_maker
-
Scratcher
1000+ posts
ability to create variables while project is running!
[words[test test\]words]::grey stack
[words[test test\]words]::grey stackUse backslash to prevent the square bracket from ending the string input and causing problems.
Create variables via this:
define create variable [name](click the “Add to backpack” button)
set (name) to [0]
- GlassGalaxy
-
Scratcher
500+ posts
ability to create variables while project is running!
create variable [ ]::variables //Possible, using the new feature to add blocks to backpack directly from forums.
//(sheep_maker has it in the above post)
move variable [ v] to x: () y: ()::variables
//Support, because it's really annoying when you accidentally move it, or you can't get it in the exact spot.
(ninja'd)
Last edited by GlassGalaxy (Aug. 13, 2016 03:56:46)
- Cameron_Johnson
-
Scratcher
100+ posts
ability to create variables while project is running!
Thank you! I'll use this sometime :3[words[test test\]words]::grey stack[words[test test\]words]::grey stackUse backslash to prevent the square bracket from ending the string input and causing problems.
Create variables via this:define create variable [name](click the “Add to backpack” button)
set (name) to [0]
- MasterJPixel
-
Scratcher
500+ posts
ability to create variables while project is running!
Semi-support. Move variable is a good idea but using operators and whatnot, “create variable” could be severely abused.
- MasterJPixel
-
Scratcher
500+ posts
ability to create variables while project is running!
Semi-support. Move variable is a good idea but using operators and whatnot, “create variable” could be severely abused.For example:
when green flag clicked
set [Loop v] to [1]
repeat until <The Project Lags Out>
create variable [((1) * (Loop)) v]
change [Loop v] by (1)
end
- Discussion Forums
- » Suggestions
-
» ability to create variables while project is running!