Discuss Scratch

progamer360noscope
Scratcher
13 posts

Help with a custom block with repeat until

Hello! I am having a problem with my script, I want to make it fast by using without screen refresh but I have a repeat until block which slows it down!, Does anyone have an alternate way to fix this

Script:

snezitko
Scratcher
100+ posts

Help with a custom block with repeat until

Are you creating a big project using this? Because I think this script will be same speed no matter what (if you make it run without screen refresh). If it is not used in a large project.
progamer360noscope
Scratcher
13 posts

Help with a custom block with repeat until

snezitko wrote:

Are you creating a big project using this? Because I think this script will be same speed no matter what (if you make it run without screen refresh). If it is not used in a large project.
Yes, I am making a username system in online
deck26
Scratcher
1000+ posts

Help with a custom block with repeat until

A repeat until of that sort shouldn't be a problem with no screen refresh. Can you share the project?
progamer360noscope
Scratcher
13 posts

Help with a custom block with repeat until

deck26 wrote:

A repeat until of that sort shouldn't be a problem with no screen refresh. Can you share the project?
https://scratch.mit.edu/projects/894232660/ Here
progamer360noscope
Scratcher
13 posts

Help with a custom block with repeat until

deck26 wrote:

A repeat until of that sort shouldn't be a problem with no screen refresh. Can you share the project?
and I have a decode block which is in the cloud player sprite
deck26
Scratcher
1000+ posts

Help with a custom block with repeat until

So why do you say the repeat until is slowing it down? I ran the custom block manually and it ran immediately. Why are you encoding the username in a forever loop when it only needs doing once?
progamer360noscope
Scratcher
13 posts

Help with a custom block with repeat until

deck26 wrote:

So why do you say the repeat until is slowing it down? I ran the custom block manually and it ran immediately. Why are you encoding the username in a forever loop when it only needs doing once?
Go to the cloud player sprite because it also I have a Decoding which is the same thing as encoding but it lags

Last edited by progamer360noscope (Sept. 17, 2023 08:15:09)

deck26
Scratcher
1000+ posts

Help with a custom block with repeat until

I can't make sense of your code. Why would your val block repeat ‘letter encoded idx of encoded string’? I suspect you're just trying to loop through each character of the string so repeating the length of the input is what you want. Have you actually checked what it is you're trying to decode or tested that function separately?
progamer360noscope
Scratcher
13 posts

Help with a custom block with repeat until

deck26 wrote:

I can't make sense of your code. Why would your val block repeat ‘letter encoded idx of encoded string’? I suspect you're just trying to loop through each character of the string so repeating the length of the input is what you want. Have you actually checked what it is you're trying to decode or tested that function separately?
this is from the griffpatch tutorial and yes I have tested it

Last edited by progamer360noscope (Sept. 17, 2023 14:21:10)

deck26
Scratcher
1000+ posts

Help with a custom block with repeat until

The decode block doesn't even have a loop so it can't decode more than a single character.
progamer360noscope
Scratcher
13 posts

Help with a custom block with repeat until

deck26 wrote:

The decode block doesn't even have a loop so it can't decode more than a single character.
òh I will see if I can use a loop, thanks
progamer360noscope
Scratcher
13 posts

Help with a custom block with repeat until

y eah the problem is, that I think this is hard for me, I put a loop and it does not work, this is a bit hard
deck26
Scratcher
1000+ posts

Help with a custom block with repeat until

It's not hard - you start with a counter set to one and join letters counter and counter+1 to get a two digit number which you can convert to a character. Increase the counter by 2 and do the same with the next pair. Repeat until the counter is greater than the length of the input.
progamer360noscope
Scratcher
13 posts

Help with a custom block with repeat until

deck26 wrote:

It's not hard - you start with a counter set to one and join letters counter and counter+1 to get a two digit number which you can convert to a character. Increase the counter by 2 and do the same with the next pair. Repeat until the counter is greater than the length of the input.
Yeah but the problem is, the cloud player is invisble and it's because of the decode script
deck26
Scratcher
1000+ posts

Help with a custom block with repeat until

progamer360noscope wrote:

deck26 wrote:

It's not hard - you start with a counter set to one and join letters counter and counter+1 to get a two digit number which you can convert to a character. Increase the counter by 2 and do the same with the next pair. Repeat until the counter is greater than the length of the input.
Yeah but the problem is, the cloud player is invisble and it's because of the decode script
You keep changing the question! First it was encoding, then it's decoding and now it's the cloud player not being visible. It's hard to keep up with moving goalposts.

If the cloud player isn't showing I suggest you take out the hide blocks for now which will make it easier to see what is happening - you can add them back if necessary. But how are you testing this? Do you have two accounts with Scratcher status?

So which tutorial have you tried to follow? Don't just say the griffpatch one - they have stuff in Scratch and on YouTube,

Not sure I'll be doing much to help for the next few days but perhaps someone else will help.
deck26
Scratcher
1000+ posts

Help with a custom block with repeat until

So I've tested you encoding and decoding - I manually ran the encode block on my username and on a test string and manually ran the decode block to see that it worked. So that's a good starting point.

I then ran the project and checked the cloud data log which seemed to be OK.

The problem I find with YT tutorials is it's hard to follow them other than at normal speed and I'm afraid sitting through an hour or more of tutorial to see where you went wrong is more than I have time for. So it comes down to testing and debugging. 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?

progamer360noscope
Scratcher
13 posts

Help with a custom block with repeat until

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
deck26
Scratcher
1000+ posts

Help with a custom block with repeat until

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?

Powered by DjangoBB