Discuss Scratch

progamer360noscope
Scratcher
13 posts

Help with a custom block with repeat until

deck26 wrote:

progamer360noscope wrote:

deck26 wrote:

You didn't answer my question as to how you're testing this. #griffpatch does explain how to test it with a single user so what happens when you do that? Do you see both UIDs and does each copy of the project see the other user even if no movement is seen?


Uids are different but I use the same user
So the answers to my questions are?
When Griffpatch and I test it, is using the same user, Every Single Player UID is Different, The Movement is not seen which is weird because if I test the one without the blocks in the Username Cloud, which is this https://scratch.mit.edu/projects/869147421/ It works perfectly but the username one is not working.
deck26
Scratcher
1000+ posts

Help with a custom block with repeat until

Sorry I couldn't look at this for a few days but I've spotted the problem!

The encoding system reads a single digit to tell it how long the next item is and then reads that number of digits to get the input. But even a short username like mine requires more than 9 digits when encoded so the length is given as 2 digits. Your code only reads the first digit of the length and therefore any remaining data on that line gets screwed up.

If you want to include usernames you're going to need to do something different such as the more usual 00 as a separator but then you'd need to encode the other values which are currently passed without encoding. An alternative might be to record the length as a 0 followed by 2 digits when you're passing encoded data - you'd need to modify the custom block that writes to the encoded string to check the length of what is being added and treat it differently and the custom block that reads the data. Shouldn't be too hard to do that.

In fact here's a remix https://scratch.mit.edu/projects/897677535/ which includes those changes. I'll delete this in a day or two so let me know when you have what you need.
deck26
Scratcher
1000+ posts

Help with a custom block with repeat until

Note that you don't need to encode the username in the forever loop, just do it once.
progamer360noscope
Scratcher
13 posts

Help with a custom block with repeat until

deck26 wrote:

Note that you don't need to encode the username in the forever loop, just do it once.
ok

Powered by DjangoBB