Discuss Scratch
- Ghxstify2009
-
100+ posts
Online Cloud Variable
How do I create an online library full of usernames and corresponding ‘ranks’? I want to do this so that I can keep track of my members and associate a rank with their username, so that when they enter their username in a rank tracker project they will be able to see their rank
- BigNate469
-
1000+ posts
Online Cloud Variable
Nothing in the OP's question actually requires the Scratch API, and thus does not require scratchattach. you can use scratch attach
Just create a program with one list (if in Scratch)/array (if anywhere else) that has a list of usernames that have a rank. Then, have another with their rank (if in Scratch), or (if anywhere else) create an object/dictionary inside each array item that holds the user's name and rank.
Note: you will have to update rank manually, because Scratch* doesn't provide a way to do this, because you can't rank people from inside Scratch (outside of the three levels of New Scratcher, Scratcher, and Scratch Team, which are applied already anyways)
*using anything the ST has built into Scratch, anyways.
Last edited by BigNate469 (May 2, 2024 19:51:35)
- CST1229
-
1000+ posts
Online Cloud Variable
(#4)Cloud lists don't exist though, so you have to encode the list into numbers and use a cloud variable.
Nothing in the OP's question actually requires the Scratch API, and thus does not require scratchattach.
Just create a program with one list (if in Scratch)/array (if anywhere else) that has a list of usernames that have a rank. Then, have another with their rank (if in Scratch), or (if anywhere else) create an object/dictionary inside each array item that holds the user's name and rank.
Note: you will have to update rank manually, because Scratch* doesn't provide a way to do this, because you can't rank people from inside Scratch (outside of the three levels of New Scratcher, Scratcher, and Scratch Team, which are applied already anyways)
*using anything the ST has built into Scratch, anyways.
- Stegie1234
-
100+ posts
Online Cloud Variable
Cloud variables cannot store enough data and updating local variables or lists manually would be impractical. This would mean using an external database to store the map, and would require scratchattach or a similar API to transfer data between the database and the Scratch project.Nothing in the OP's question actually requires the Scratch API, and thus does not require scratchattach. you can use scratch attach
[…]
Last edited by Stegie1234 (May 3, 2024 10:26:13)
- Ghxstify2009
-
100+ posts
Online Cloud Variable
Cloud variables sadly don't accept letters, so it's kinda difficult to create that.
- Ghxstify2009
-
100+ posts
Online Cloud Variable
What do you mean by cloud list? I know Scratch doesn't yet have a ‘cloud’ list feature available, but there may be a way to create one.. could you provide a link to a tutorial/project/etc.?
- qloakonscratch
-
1000+ posts
Online Cloud Variable
A relatively modern and easy-to-follow tutorial can be found here: What do you mean by cloud list? I know Scratch doesn't yet have a ‘cloud’ list feature available, but there may be a way to create one.. could you provide a link to a tutorial/project/etc.?https://scratch.mit.edu/projects/493258809/
You can also look up “Cloud List” in the search bar and check there to see if there's anything that can help you.
- ninjaMAR
-
1000+ posts
Online Cloud Variable
(#9)https://scratch.mit.edu/projects/495545839/
What do you mean by cloud list? I know Scratch doesn't yet have a ‘cloud’ list feature available, but there may be a way to create one.. could you provide a link to a tutorial/project/etc.?
- ninjaMAR
-
1000+ posts
Online Cloud Variable
(#6)You can store 2560 characters in cloud variables (10 cloud variables * 256 characters)Cloud variables cannot store enough data and updating local variables or lists manually would be impractical. This would mean using an external database to store the map, and would require scratchattach or a similar API to transfer data between the database and the Scratch project.Nothing in the OP's question actually requires the Scratch API, and thus does not require scratchattach. you can use scratch attach
[…]
- davidtheplatform
-
500+ posts
Online Cloud Variable
Cloud vars can only hold digits, not letters so you get 2560 digits. This works out to about a kilobyte of data. If we assume 2x compression on usernames*, an average of 8 characters per username, and 2 bytes of extra data per entry, we can store ~166 total entries.(#6)You can store 2560 characters in cloud variables (10 cloud variables * 256 characters)Cloud variables cannot store enough data and updating local variables or lists manually would be impractical. This would mean using an external database to store the map, and would require scratchattach or a similar API to transfer data between the database and the Scratch project.Nothing in the OP's question actually requires the Scratch API, and thus does not require scratchattach. you can use scratch attach
[…]
If you just want a leaderboard this will work, but if you want actual cloud saving you'd need to use a server to handle things.
p.s. The theoretical throughput of cloud variables is 10kb/sec, but I've found that only around half that is possible.
- ninjaMAR
-
1000+ posts
Online Cloud Variable
what do you mean by 2x compression? (typo?) my understanding is that you need 2 digits per character of the alphabet, meaning that a username needs 2x space Cloud vars can only hold digits, not letters so you get 2560 digits. This works out to about a kilobyte of data. If we assume 2x compression on usernames*, an average of 8 characters per username, and 2 bytes of extra data per entry, we can store ~166 total entries.
If you just want a leaderboard this will work, but if you want actual cloud saving you'd need to use a server to handle things.
p.s. The theoretical throughput of cloud variables is 10kb/sec, but I've found that only around half that is possible
- davidtheplatform
-
500+ posts
Online Cloud Variable
There's roughly 65 characters you can use in a username, so if we encode them properly we only need 1.8 digits per character. Some letters are more/less common, ie. “Q” is probably used less than “e”. We can use huffman coding (or something similar) to get a little bit more compression. Normal english text can be compressed by about 8x for reference.what do you mean by 2x compression? (typo?) my understanding is that you need 2 digits per character of the alphabet, meaning that a username needs 2x space Cloud vars can only hold digits, not letters so you get 2560 digits. This works out to about a kilobyte of data. If we assume 2x compression on usernames*, an average of 8 characters per username, and 2 bytes of extra data per entry, we can store ~166 total entries.
If you just want a leaderboard this will work, but if you want actual cloud saving you'd need to use a server to handle things.
p.s. The theoretical throughput of cloud variables is 10kb/sec, but I've found that only around half that is possible
Various other methods could be used, like truncating usernames to 5 characters, but then you'd have to deal with collisions.
- ninjaMAR
-
1000+ posts
Online Cloud Variable
(#17)Interesting! Do you have a Proof-Of-Concept?
There's roughly 65 characters you can use in a username, so if we encode them properly we only need 1.8 digits per character. Some letters are more/less common, ie. “Q” is probably used less than “e”. We can use huffman coding (or something similar) to get a little bit more compression. Normal english text can be compressed by about 8x for reference.
Various other methods could be used, like truncating usernames to 5 characters, but then you'd have to deal with collisions.
(#11)I updated the project to include an API that you can use. Directions are in the editor.
https://scratch.mit.edu/projects/495545839/
- davidtheplatform
-
500+ posts
Online Cloud Variable
All of these numbers are based on a 10000 “random” usernames.(#17)Interesting! Do you have a Proof-Of-Concept?.
There's roughly 65 characters you can use in a username, so if we encode them properly we only need 1.8 digits per character. Some letters are more/less common, ie. “Q” is probably used less than “e”. We can use huffman coding (or something similar) to get a little bit more compression. Normal english text can be compressed by about 8x for reference.
Various other methods could be used, like truncating usernames to 5 characters, but then you'd have to deal with collisions.
The 3 approaches I've tested so far are: 1 letter = 2 digits, 1 letter = ~1.8 digits (no compression, just packing the username efficiently), and using huffman coding. Also, there's an algorithm to calculate the entropy of the data, which is the lowest possible value no matter how the data is encoded.
Results:
base: 14.8 digits per username
packing: 13.4
huffman: 11.2
best: 11.1
Lossy encoding
I'll write this part in a few hours
- Ghxstify2009
-
100+ posts
Online Cloud Variable
I would also like to associate a rank with specific usernames though, and allow other people to see it.(#17)Interesting! Do you have a Proof-Of-Concept?
There's roughly 65 characters you can use in a username, so if we encode them properly we only need 1.8 digits per character. Some letters are more/less common, ie. “Q” is probably used less than “e”. We can use huffman coding (or something similar) to get a little bit more compression. Normal english text can be compressed by about 8x for reference.
Various other methods could be used, like truncating usernames to 5 characters, but then you'd have to deal with collisions.(#11)I updated the project to include an API that you can use. Directions are in the editor.
https://scratch.mit.edu/projects/495545839/
Is there a way on Scratch like in Python to add onto the username such as: +“Rank = Bronze”
Last edited by Ghxstify2009 (May 7, 2024 14:59:56)