Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Code for login screen
- brillaoscoder
-
Scratcher
45 posts
Code for login screen
So I am trying to make a login screen but I don't want to put a different sprite for each one can anybody figure out how I can do that (like if mouse down and touching it) ?
- OCK_Scratch
-
Scratcher
14 posts
Code for login screen
Here’s an idea for the login button.
BUTTON
BACKDROP
BUTTON
when this sprite clicked
broadcast [LOGIN v]
BACKDROP
when I receive [LOGIN v]
repeat until <(answer) = (username)>
ask [Enter username] and wait
end
repeat until <(answer) = [eggs]
ask [Enter password] and wait
end
show variable [User v]
start up program
define start up program
stop [all v]
- brillaoscoder
-
Scratcher
45 posts
Code for login screen
Here’s an idea for the login button.thank you
BUTTONwhen this sprite clicked
broadcast [LOGIN v]
BACKDROPwhen I receive [LOGIN v]
repeat until <(answer) = (username)>
ask [Enter username] and wait
end
repeat until <(answer) = [eggs]
ask [Enter password] and wait
end
show variable [User v]
start up program
define start up program
stop [all v]
- han614698
-
Scratcher
1000+ posts
Code for login screen
Additionally, you can have them enter a password, and then
To this (where ans = password)
You will have that variable contain the value “*[r length pass]” and you can show it on the stage.
To this (where ans = password)
set [*** v] to ()//nothing here
repeat (length of (ans))
set [*** v] to (join (***) [*])
end
You will have that variable contain the value “*[r length pass]” and you can show it on the stage.
- brillaoscoder
-
Scratcher
45 posts
Code for login screen
i want it to have 3 user accounts but i want to figure out how to get it to detect when it clicks a account without them being seperatate sprites?
- helloworldbyeworld
-
Scratcher
1000+ posts
Code for login screen
i want it to have 3 user accounts but i want to figure out how to get it to detect when it clicks a account without them being seperatate sprites?You can pass the username into the start up function, like this:
if <[usernames v] contains (username) ?> then // the list 'usernames' is a list containing the usernames of all 3 users
start up user account (username)::custom
else
say [Unknown user] for (2) secs
end
Last edited by helloworldbyeworld (Oct. 4, 2021 00:26:04)
- scratchgaming2222
-
Scratcher
500+ posts
Code for login screen
Well I think the code might break with 85000000000000000 usernames in the list. So maybe make some fix code if that happens
- supergamer10000
-
Scratcher
1000+ posts
Code for login screen
Hmm, do you want to make a save code system?
Last edited by supergamer10000 (Oct. 4, 2021 01:24:15)
- scratchgaming2222
-
Scratcher
500+ posts
Code for login screen
Hmm, do you want to make a save code system?Ye
- MasterofTheBrick
-
Scratcher
1000+ posts
Code for login screen
i want it to have 3 user accounts but i want to figure out how to get it to detect when it clicks a account without them being seperatate sprites?Use 3 separate clones with their corresponding IDs to act as the buttons of each account. When one of the clones are clicked, that clone should set its ID to a global variable, which would then allow you to check which of the accounts were clicked.
- Discussion Forums
- » Help with Scripts
-
» Code for login screen






