Discuss Scratch

photopolaraccoustic
Scratcher
42 posts

How do you set a variable to nothing ?

How do you set a variable to nothing instead of space ?
set [ v] to [  ]
set [ v] to []
Thank you.

Last edited by photopolaraccoustic (July 27, 2015 14:33:43)

cm8263
Scratcher
100+ posts

How do you set a variable to nothing ?

You click on the white space then it will go grey, then press backspace then click away.
photopolaraccoustic
Scratcher
42 posts

How do you set a variable to nothing ?

Thank you, I have tried this but unfortunately the space reappears immediately when the text field is clicked on.
IronBit_Studios
Scratcher
1000+ posts

How do you set a variable to nothing ?

photopolaraccoustic wrote:

Thank you, I have tried this but unfortunately the space reappears immediately when the text field is clicked on.
double-click, space, backspace, leave.
tanky125
Scratcher
13 posts

How do you set a variable to nothing ?

cm8263 wrote:

You click on the white space then it will go grey, then press backspace then click away.

That should work.
Try this script:
set [Empty v] to (join (Empty) [1])
If “Empty” has nothing in it it should report 1.
Imaginary_Numbers
Scratcher
42 posts

How do you set a variable to nothing ?

photopolaraccoustic wrote:

Thank you, I have tried this but unfortunately the space reappears immediately when the text field is clicked on.
When you click in the variable, press backspace, and click away the space does reappear. However, if the reason you want to have nothing in the variable is like what
tanky125 said:
set [empty v] to (join (empty) [1])
then when you perform that script it will erase the space and replace it with 1.


Here's how I tested it:
when green flag clicked
set [Test var v] to [ ]
say (length of (Test var)) for (2) secs
say []
wait (1) secs
set [Test var v] to (join (Test var) [1])
say (length of (Test var)) for (2) secs
So
(Test var)
will have a length of one until you replace it with something else or put it in a join Test var and 1 script.
cm8263
Scratcher
100+ posts

How do you set a variable to nothing ?

cm8263 wrote:

You click on the white space then it will go grey, then press backspace then click away.
Don't know what to tell you, this works for me…
photopolaraccoustic
Scratcher
42 posts

How do you set a variable to nothing ?

This help is much appreciated.
nballast
Scratcher
40 posts

How do you set a variable to nothing ?

It's impossible.
tyjinw1
Scratcher
100+ posts

How do you set a variable to nothing ?

set [ ] to [0]

ok
awesome-llama
Scratcher
1000+ posts

How do you set a variable to nothing ?

tyjinw1 wrote:

i dont know
What do you mean? Everyone has already clearly answered how to set a variable to nothing, but I'll mention it again for you:

Run this block.
set [variable v] to [] // the input is blank, all the text has been erased with backspace or delete

Also, this topic is from 2015. Please check the date of the topic before posting. If you have your own question, it is best to create your own topic instead of reviving a dead one that is already answered.
help_with_scripts
Scratcher
100+ posts

How do you set a variable to nothing ?

The space doesn't actually exist, there's just no character to symbolize "nothing:.

EDIT: @Awesome_Llama posted today so I thought this topic was new. Sorry I posted this - I thought help was still needed.

Last edited by help_with_scripts (March 29, 2021 13:01:04)

help_with_scripts
Scratcher
100+ posts

How do you set a variable to nothing ?

tyjinw1 wrote:

(pick randomssssssssss () to (10))

i dont know
Don't necropost please!

Powered by DjangoBB