Discuss Scratch

456mnb
Scratcher
5 posts

Change username when starting the game

I need a code that does the following thing: as soon as an account enters the game a question will be asked (which is your username), and the answer that that person gives to the question will change the “username” function
(username)
(which, in which, identifies account name).

Note: this setting on “username” has to be infinite in loop.

Why don't I do this myself? I've tried too hard, and lost my Scratch skills and knowledge.

Last edited by 456mnb (March 26, 2023 03:53:48)

medians
Scratcher
1000+ posts

Change username when starting the game

Not sure if I'm misunderstanding, but:

If you only want them to be able to enter the username, just repeat until the answer is equal to username.

Last edited by medians (March 26, 2023 03:57:40)

456mnb
Scratcher
5 posts

Change username when starting the game

medians wrote:

Not sure if I'm misunderstanding, but:

If you only want them to be able to enter the username, just repeat until the answer is equal to username.

ok, looks like it's working code, but where do I find the “set” block
medians
Scratcher
1000+ posts

Change username when starting the game

456mnb wrote:

medians wrote:

Not sure if I'm misunderstanding, but:

If you only want them to be able to enter the username, just repeat until the answer is equal to username.

ok, looks like it's working code, but where do I find the “set” block
You just click “Variables” (I didn't forget about the name change!!), and then click “Make a Variable”, and you can name it something like “name”. Then 5 blocks will appear, including the set block.

Last edited by medians (March 26, 2023 04:06:16)

456mnb
Scratcher
5 posts

Change username when starting the game

medians wrote:

456mnb wrote:

medians wrote:

Not sure if I'm misunderstanding, but:

If you only want them to be able to enter the username, just repeat until the answer is equal to username.

ok, looks like it's working code, but where do I find the “set” block
You just click “Variables” (I didn't forget about the name change!!), and then click “Make a Variable”, and you can name it something like “name”. Then 5 blocks will appear, including the set block.

ok, I managed to reproduce the same code, but it had no effect on the “username”. How will I set the answer to the question in place of “username”?
like:

when this sprite clicked
set [ name] to (username)

Last edited by 456mnb (March 26, 2023 04:14:20)

legendary34678
Scratcher
1000+ posts

Change username when starting the game

You cannot change the blue username block. That will always stay the same. You can use an orange variable block instead of the blue username block, though. You can create a new variable and call it “name.” Then, you can set the name variable to the username. Finally, the orange name block will have the same value as the blue username block. Then, whenever you want to change the name, you would set the name variable to something else.
Spentine
Scratcher
1000+ posts

Change username when starting the game

medians wrote:

You just click “Variables” (I didn't forget about the name change!!), …
2.0 “Data” category moment
medians
Scratcher
1000+ posts

Change username when starting the game

Spentine wrote:

medians wrote:

You just click “Variables” (I didn't forget about the name change!!), …
2.0 “Data” category moment
LOLLLL

456mnb wrote:

ok, I managed to reproduce the same code, but it had no effect on the “username”. How will I set the answer to the question in place of “username”?
like:

when this sprite clicked
set [name v] to (username)
Yeah, that's how you do it. And then you can do what I showed if you want to allow for something custom.

Last edited by medians (March 26, 2023 14:59:40)

helpwithskripts
New Scratcher
95 posts

Change username when starting the game

The username block represents the player's username and cannot be changed, you can create a variable and change it if you'd like to, but for the username block, you can't.
456mnb
Scratcher
5 posts

Change username when starting the game

ajuda com scripts wrote:

The username block represents the player's username and cannot be changed, you can create a variable and change it if you'd like to, but for the username block, you can't.

that's exactly what I want, I want to change the “username” using a variable, in this case, define the “username” as the value of the variable, which would be the answer to a question.

Powered by DjangoBB