Discuss Scratch

46009361
Scratcher
1000+ posts

Trying to make a project to store "world record holder" in a variable

deck26 wrote:

46009361 wrote:

deck26 wrote:

Still don't understand why you're using binary. Cloud variables have limited numbers of digits so using 0 and 1 instead of 0-9 is hugely reducing what you can store.
6 binary digits for each character times 20 maximum characters is 120. Less than the current value, 256.
And 2 decimal digits per character is a lot less work and would take up 40 cloud digits. So that still doesn't explain why you're using binary.
Well, 40 is LESS than 120, but only a third of it. What do you mean by “hugely?” The gap between the gap between 40 and 256 and the gap between 120 and 256 (256 - 120) - (256 - 40) is only 80. And cloud variables can have 256 characters in them (including the decimal point). If you divide 80 by 256, you get 0.3125 (5/16). 80 isn't very huge when compared to 256, just like when 5 isn't very huge when compared to 16. It's like there has to be eight over 16 or 1/2 (at least) to be “huge”. And besides, 120 (used for accidental misinterpretation uses only) is less than 256 divided by 2, which is 128.

Last edited by Paddle2See (March 30, 2021 01:24:34)

deck26
Scratcher
1000+ posts

Trying to make a project to store "world record holder" in a variable

OK, ‘hugely’ was overstating the case perhaps but being able to store 3 times as much by not using binary is still significant. You still haven't explained why you want to do all the extra wok of converting to binary when it gives you no advantage, only disadvantages.

Last edited by deck26 (Aug. 16, 2019 09:44:39)

46009361
Scratcher
1000+ posts

Trying to make a project to store "world record holder" in a variable

Anyway, I think I have a plan for how I can do it with decimal.
Set up conversions and chunks (I don't want to use case sensing anymore):
Create a list called
conversions
, making sure to add the right content inside. Then, I will use an encoding and decoding script.
Encoding script (uses a block that exists in Scratch 3.0 and needs to have “::list” at the end to make it compatible with Scratch 2.0)
defineencodestringsetito1setworld record holder variabletorepeatlengthofstringifitem#ofletteriofstringinconversions<10thensetworld record holder variabletojoinworldrecordholdervariablejoin0item#ofletteriofstringinconversionselsesetworld record holder variabletojoinworldrecordholdervariableitem#ofletteriofstringinconversionschangeiby1
There may have been a trailing zero at the beginning that was removed, but that's okay, because we can add it back later. The decoding script will have a variable called “world record holder variable2” and a variable called “world record holder variable3” that's used exclusively for this function. I will probably also use “run without screen refresh” as well just to make sure.
Decoding script:
definedecodestringsetito1setworld record holder variable2toiflengthofstringmod2=0thensetworld record holder variable3tostringelsesetworld record holder variable3tojoin0stringrepeatlengthofworldrecordholdervariable3/2setworld record holder variable2tojoinworldrecordholdervariable2itemjoinletteriofworldrecordholdervariable3letteri+1ofworldrecordholdervariable3ofconversionschangeiby2

Last edited by 46009361 (Aug. 16, 2019 13:16:21)

46009361
Scratcher
1000+ posts

Trying to make a project to store "world record holder" in a variable

deck26 wrote:

OK, ‘hugely’ was overstating the case perhaps but being able to store 3 times as much by not using binary is still significant. You still haven't explained why you want to do all the extra wok of converting to binary when it gives you no advantage, only disadvantages.
Oh, and you mean “work,” not “wok,” right?
deck26
Scratcher
1000+ posts

Trying to make a project to store "world record holder" in a variable

46009361 wrote:

deck26 wrote:

OK, ‘hugely’ was overstating the case perhaps but being able to store 3 times as much by not using binary is still significant. You still haven't explained why you want to do all the extra wok of converting to binary when it gives you no advantage, only disadvantages.
Oh, and you mean “work,” not “wok,” right?
A fairly obvious typo I'd have thought.

Not sure what you gain by having the ‘chunks’ list - just append the code for each letter to your ‘world record holder variable’. You're looping through things twice when once is enough.

Last edited by Paddle2See (March 30, 2021 01:24:51)

46009361
Scratcher
1000+ posts

Trying to make a project to store "world record holder" in a variable

deck26 wrote:

46009361 wrote:

deck26 wrote:

OK, ‘hugely’ was overstating the case perhaps but being able to store 3 times as much by not using binary is still significant. You still haven't explained why you want to do all the extra wok of converting to binary when it gives you no advantage, only disadvantages.
Oh, and you mean “work,” not “wok,” right?
A fairly obvious typo I'd have thought.

Not sure what you gain by having the ‘chunks’ list - just append the code for each letter to your ‘world record holder variable’. You're looping through things twice when once is enough.
That's not what I was doing. I didn't want the script to make users unknowingly spam cloud variables by continuously adding a new part for each letter until it reaches the last character of their username (yes, you can check the wiki). I only used the extra variable so that the cloud variable change is only sent to the server once, after the repeating has been finished.

Last edited by Paddle2See (March 30, 2021 01:25:03)

46009361
Scratcher
1000+ posts

Trying to make a project to store "world record holder" in a variable

46009361 wrote:

deck26 wrote:

46009361 wrote:

deck26 wrote:

OK, ‘hugely’ was overstating the case perhaps but being able to store 3 times as much by not using binary is still significant. You still haven't explained why you want to do all the extra wok of converting to binary when it gives you no advantage, only disadvantages.
Oh, and you mean “work,” not “wok,” right?
A fairly obvious typo I'd have thought.

Not sure what you gain by having the ‘chunks’ list - just append the code for each letter to your ‘world record holder variable’. You're looping through things twice when once is enough.
That's not what I was doing. I didn't want the script to make users unknowingly spam cloud variables by continuously adding a new part for each letter until it reaches the last character of their username (yes, you can check the wiki). I only used the extra variable so that the cloud variable change is only sent to the server once, after the repeating has been finished.
I tried to make it so that everyone (including logged-out users who can't view the logs) would know who the current world record holder is. Sometimes, they would put the record holder in the Notes and Credits/Instructions (see this project for more information). The problem with that, is, that the user may be sleeping when the new record has been set and not realize it until, say, six hours later when he/she wakes up. Then, there's a delay. The user will have to check the logs and then edit the description to have the new username on there. The user may not have fast Internet connection after editing the description and attempting to save it. Who knows who that person could be on the other end?
Anyway, back to what I was saying, you can put an encrypted username in a cloud variable. The logged-out users cannot edit a cloud variable, but they can still retrieve it because I think that most users on Scratch will have a good bandwidth. (It will be decrypted using the script later on, so that doesn't matter for this post anymore). What I mean by a good bandwidth is that when the client requests the server for the value of the cloud variable, the server sends it back quickly and accurately to the client, and the time it takes for these two factors combined is called the “ping time.” But that's a story for another day.

Last edited by Paddle2See (March 30, 2021 01:25:35)

deck26
Scratcher
1000+ posts

Trying to make a project to store "world record holder" in a variable

You build up a temporary variable in the second repeat loop and only copy it to the cloud variable once. That is the variable you call ‘world record holder variable’ and is the one I referred to. So my post does not imply spamming the cloud variable but you do not need to store the variable in ‘chunks’ in one loop and then build the temporary variable in a second loop - it can all be done in one loop and there is no obvious need for ‘chunks’ at all.

So nothing in your last two posts changes what I'm suggesting or makes it any less valid!
46009361
Scratcher
1000+ posts

Trying to make a project to store "world record holder" in a variable

deck26 wrote:

You build up a temporary variable in the second repeat loop and only copy it to the cloud variable once. That is the variable you call ‘world record holder variable’ and is the one I referred to. So my post does not imply spamming the cloud variable but you do not need to store the variable in ‘chunks’ in one loop and then build the temporary variable in a second loop - it can all be done in one loop and there is no obvious need for ‘chunks’ at all.

So nothing in your last two posts changes what I'm suggesting or makes it any less valid!
Oh, I see what you mean. Is this what you mean?
Wrong: create chunks in a list –> combine them together –> store encrypted username
Right: create chunks in a variable and combine them together in one loop –> store encrypted username

Then I will change my encoding script if that is the case (plus forum post containing script too). The link to the first post in this forum on the first page is an unshared project that I haven't told you the actual purpose of the project and I will keep it secret until I share it.

Edit: Already edited forum post.

Edit: Already edited script to match forum post.

Last edited by 46009361 (Aug. 16, 2019 12:44:23)

deck26
Scratcher
1000+ posts

Trying to make a project to store "world record holder" in a variable

46009361 wrote:

deck26 wrote:

You build up a temporary variable in the second repeat loop and only copy it to the cloud variable once. That is the variable you call ‘world record holder variable’ and is the one I referred to. So my post does not imply spamming the cloud variable but you do not need to store the variable in ‘chunks’ in one loop and then build the temporary variable in a second loop - it can all be done in one loop and there is no obvious need for ‘chunks’ at all.

So nothing in your last two posts changes what I'm suggesting or makes it any less valid!
Oh, I see what you mean. Is this what you mean?
Wrong: create chunks in a list –> combine them together –> store encrypted username
Right: create chunks in a variable and combine them together in one loop –> store encrypted username

Then I will change my encoding script if that is the case (plus forum post containing script too). The link to the first post in this forum on the first page is an unshared project that I haven't told you the actual purpose of the project and I will keep it secret until I share it.

Edit: Already edited forum post.

Edit: Already edited script to match forum post.
If you mean the code for a single letter is a ‘chunk’ then your description does match but otherwise there are no chunks.. You have an input string that you want to encode. You set the temporary variable to blank and deal with each letter of the input in a loop, appending the correct code to the temporary variable. At the end of the loop your temporary variable holds the data to be stored to the cloud.

Last edited by Paddle2See (March 30, 2021 01:25:51)

46009361
Scratcher
1000+ posts

Trying to make a project to store "world record holder" in a variable

deck26 wrote:

46009361 wrote:

deck26 wrote:

You build up a temporary variable in the second repeat loop and only copy it to the cloud variable once. That is the variable you call ‘world record holder variable’ and is the one I referred to. So my post does not imply spamming the cloud variable but you do not need to store the variable in ‘chunks’ in one loop and then build the temporary variable in a second loop - it can all be done in one loop and there is no obvious need for ‘chunks’ at all.

So nothing in your last two posts changes what I'm suggesting or makes it any less valid!
Oh, I see what you mean. Is this what you mean?
Wrong: create chunks in a list –> combine them together –> store encrypted username
Right: create chunks in a variable and combine them together in one loop –> store encrypted username

Then I will change my encoding script if that is the case (plus forum post containing script too). The link to the first post in this forum on the first page is an unshared project that I haven't told you the actual purpose of the project and I will keep it secret until I share it.

Edit: Already edited forum post.

Edit: Already edited script to match forum post.
If you mean the code for a single letter is a ‘chunk’ then your description does match but otherwise there are no chunks.. You have an input string that you want to encode. You set the temporary variable to blank and deal with each letter of the input in a loop, appending the correct code to the temporary variable. At the end of the loop your temporary variable holds the data to be stored to the cloud.
I already removed the “chunks” list and saved the edited script. 100% confident it matches the one I posted on this page.

Last edited by Paddle2See (March 30, 2021 01:26:06)

46009361
Scratcher
1000+ posts

Trying to make a project to store "world record holder" in a variable

Anyway, there were more people other than me and deck26 on the first page, such as DaEnderBoss, cannonball84, a-jar-of-tuna, game_pr0grammer, imfh, and codeman1044. Now it's just us. What happened? Why did everyone else leave the discussion?
46009361
Scratcher
1000+ posts

Trying to make a project to store "world record holder" in a variable

That script worked! (I just used split screen to copy from the forum)
46009361
Scratcher
1000+ posts

Trying to make a project to store "world record holder" in a variable

I will share it soon. I just need to do four things and edit the post as I go along.
First: Using “clean up code.” - Done
Next: Writing instructions. - Done
Then: Writing notes and credits. - Done
Last: Sharing project. - Done

Last edited by 46009361 (Aug. 16, 2019 14:23:08)

46009361
Scratcher
1000+ posts

Trying to make a project to store "world record holder" in a variable

The project is now shared. You can find it on my profile, by searching my username, or by looking at the very first forum post in this thread.
46009361
Scratcher
1000+ posts

Trying to make a project to store "world record holder" in a variable

46009361 wrote:

deck26 wrote:

46009361 wrote:

deck26 wrote:

You build up a temporary variable in the second repeat loop and only copy it to the cloud variable once. That is the variable you call ‘world record holder variable’ and is the one I referred to. So my post does not imply spamming the cloud variable but you do not need to store the variable in ‘chunks’ in one loop and then build the temporary variable in a second loop - it can all be done in one loop and there is no obvious need for ‘chunks’ at all.

So nothing in your last two posts changes what I'm suggesting or makes it any less valid!
Oh, I see what you mean. Is this what you mean?
Wrong: create chunks in a list –> combine them together –> store encrypted username
Right: create chunks in a variable and combine them together in one loop –> store encrypted username

Then I will change my encoding script if that is the case (plus forum post containing script too). The link to the first post in this forum on the first page is an unshared project that I haven't told you the actual purpose of the project and I will keep it secret until I share it.

Edit: Already edited forum post.

Edit: Already edited script to match forum post.
If you mean the code for a single letter is a ‘chunk’ then your description does match but otherwise there are no chunks.. You have an input string that you want to encode. You set the temporary variable to blank and deal with each letter of the input in a loop, appending the correct code to the temporary variable. At the end of the loop your temporary variable holds the data to be stored to the cloud.
I already removed the “chunks” list and saved the edited script. 100% confident it matches the one I posted on this page.
Finished! You can try the project here now! (In case you didn't get the previous response)

Last edited by Paddle2See (March 30, 2021 01:26:32)

46009361
Scratcher
1000+ posts

Trying to make a project to store "world record holder" in a variable

Has @deck26 seen the project in the last post yet?
codeman1044
Scratcher
1000+ posts

Trying to make a project to store "world record holder" in a variable

Well, we don't quite try out projects on this forum too frequently unless we need to use them to see a user's issue with something. There is a better forum for showing off your project. I'm sure that someone there will enjoy it!
deck26
Scratcher
1000+ posts

Trying to make a project to store "world record holder" in a variable

46009361 wrote:

Has @deck26 seen the project in the last post yet?
@codeman1044 is right - if your problem is solved I don't really have much interest in checking out your project. Not a case of being rude, my interest is in helping people resolve problems and I'm often helping on multiple issues so if the person says they've solved the problem I just move on.

Last edited by Paddle2See (March 30, 2021 01:26:57)

46009361
Scratcher
1000+ posts

Trying to make a project to store "world record holder" in a variable

codeman1044 wrote:

Well, we don't quite try out projects on this forum too frequently unless we need to use them to see a user's issue with something. There is a better forum for showing off your project. I'm sure that someone there will enjoy it!
I already posted my project here: https://scratch.mit.edu/discuss/topic/367251/
Why is no one looking at it?

Powered by DjangoBB