Discuss Scratch

drakearcher
Scratcher
54 posts

Repeat Until Pausing Script

My project has a save code system and I'm trying to load it. I'm making it so it stops loading the code once it has reached the last letter. When it gets to the end of the code, it pauses the script, and doesn't do further.

I tried to fix this by using “repeat until ‘i’ = length of ‘save code’”, “repeat until ‘i’ > ‘save code’”, “repeat length of ‘save code’”, and “repeat length of ‘save code’ + 1”, but nothing is working.

Any help would be apprieciated!
Kessel_Run
Scratcher
100+ posts

Repeat Until Pausing Script

Can you link the project? Hard to tell what the problem is without context.

Are you remembering to increase i with each iteration or the loop?
Is i set to 0 before the loop begins?

Those are some things that could be wrong, but it's hard to know without seeing the code.
drakearcher
Scratcher
54 posts

Repeat Until Pausing Script

Kessel_Run wrote:

Can you link the project? Hard to tell what the problem is without context.

Are you remembering to increase i with each iteration or the loop?
Is i set to 0 before the loop begins?

Those are some things that could be wrong, but it's hard to know without seeing the code.

'i' is set to 0 before the loop begins.

Here's the project: https://scratch.mit.edu/projects/862027462/
legendary34678
Scratcher
1000+ posts

Repeat Until Pausing Script

The project isn't shared.
drakearcher
Scratcher
54 posts

Repeat Until Pausing Script

legendary34678 wrote:

The project isn't shared.

But i sent you the link, so you should be able to See Inside
ocuious
Scratcher
1000+ posts

Repeat Until Pausing Script

drakearcher wrote:

legendary34678 wrote:

The project isn't shared.

But i sent you the link, so you should be able to See Inside
You have to share the project for other people to view it. See, try and press my unshared project: https://scratch.mit.edu/projects/864948821/
drakearcher
Scratcher
54 posts

Repeat Until Pausing Script

Oh ok. I send you a photo then:

https://imgur.com/a/ICjmILe

Last edited by drakearcher (June 13, 2023 22:15:24)

legendary34678
Scratcher
1000+ posts

Repeat Until Pausing Script

Best to just share the actual project.
--HyperZ--
Scratcher
100+ posts

Repeat Until Pausing Script

Is it possible that your save codes don't have that final forward slash? The code runs fine for me. If it is missing that final slash, however, it just runs in an infinite loop. Maybe this would fix it?

when I receive [Load Code v]
set [i v] to [0]
set [temp v] to []
repeat until <(i) > (length of (save code))>
repeat until <<(letter (i) of (save code)) = [/]> or <(i) > (length of (save code))>>
set [temp v] to (join (temp) (letter (i) of (save code))
change [i v] by (1)
end
Check Temp::custom
change [i v] by (1)
set [temp v] to []
end
set [i v] to [0]

Also, side note, you don't have to place a “stop this script” block at the end of a script if it's already going to stop executing.
drakearcher
Scratcher
54 posts

Repeat Until Pausing Script

I did forget to add a / at the end. It worked! Thanks!

Powered by DjangoBB