Discuss Scratch

SuperDragonStudios
Scratcher
500+ posts

Position Recording With Lists

I need help with a Position Recorder because I'm thinking of a project that uses this method, but I don't know how to do it the new way.

I first used this method in a project I made in the 1.4 editor a few days ago, and it works fine, but when I uploaded it to Scratch 3.0 it doesn't work anymore. I know why though: Scratch 3.0 runs much faster.

Example: Here's the basic list script:

when green flag clicked
set [Item#] to (0)
repeat until <key [space] pressed?>
Movement::custom
add (x position) to [Player X]
add (y position) to [Player Y]

When [space] key pressed
repeat (length of [Player X] :: list)
go to x: (item (Item#) of [Player X]) y: (item (Item#) of [Player Y]):: motion
change [Item#] by (1)

If you make this script in 1.4, and look at the lists, you'll see that you'll have about 700-900 item in the lists in a matter of 5 seconds.

Now, make this in 3.0, and in 5 seconds you'll have about 75,000 items on the list. This is a BIG difference.

This is where I need your guys' help. I know how to make a basic list recording script, but I can't update it for Scratch 3.0.

Help will me much appreciated.

Thanks!

Last edited by SuperDragonStudios (Nov. 9, 2020 13:30:11)

deck26
Scratcher
1000+ posts

Position Recording With Lists

Why not just add a wait block in the loop to slow it down?

But if it's looping that quickly I'd guess there are no screen refreshes going on so perhaps what you actually need is to only save data when either x or y has changed. If they haven't changed Scratch may be running faster because it doesn't see the need to refresh the screen. What happens if you add a show block to the loop - I think that would force a screen refresh.
Laterbot-the-Third
Scratcher
4 posts

Position Recording With Lists

If you need to slow it down a bit, just add a wait block into the repeat script

wait (0.2) secs

Last edited by Laterbot-the-Third (Nov. 9, 2020 13:36:48)

SuperDragonStudios
Scratcher
500+ posts

Position Recording With Lists

See here: https://scratch.mit.edu/projects/446666336/

This is my recording project. I used wait blocks to slow it down.

It works, I know, but my goal stretched further from that. In Scratch 1.4, it runs SMOOTH. This was my goal for the 3.0 version.

I'm trying to get it as smooth as possible, instead of “framey.”

Thanks anyway
deck26
Scratcher
1000+ posts

Position Recording With Lists

Another option would be to record the time before each change of position.

In pseudo code

reset timer
repeat until space pressed
add timer to list
add x to list
add y to list
wait until x or y changes
end

playback

reset timer
repeat until end of list
wait until timer > time value
go to x y
move on to next item
end
help_with_scripts
Scratcher
100+ posts

Position Recording With Lists

SuperDragonStudios wrote:

I need help with a Position Recorder because I'm thinking of a project that uses this method, but I don't know how to do it the new way.

I first used this method in a project I made in the 1.4 editor a few days ago, and it works fine, but when I uploaded it to Scratch 3.0 it doesn't work anymore. I know why though: Scratch 3.0 runs much faster.

Example: Here's the basic list script:

when green flag clicked
set [Item#] to (0)
repeat until <key [space] pressed?>
Movement::custom
add (x position) to [Player X]
add (y position) to [Player Y]

When [space] key pressed
repeat (length of [Player X] :: list)
go to x: (item (Item#) of [Player X]) y: (item (Item#) of [Player Y]):: motion
change [Item#] by (1)

If you make this script in 1.4, and look at the lists, you'll see that you'll have about 700-900 item in the lists in a matter of 5 seconds.

Now, make this in 3.0, and in 5 seconds you'll have about 75,000 items on the list. This is a BIG difference.

This is where I need your guys' help. I know how to make a basic list recording script, but I can't update it for Scratch 3.0.

Help will me much appreciated.

Thanks!
You can use this:
Set old x to x
set old y to y
if not old x = x and old y = y
add x pos + y pos to list
This will only update when you move.
Mondayprojects
Scratcher
32 posts

Position Recording With Lists

??????
supa-panda
Scratcher
100+ posts

Position Recording With Lists

Here's a modified version of your script that utilizes the scratch glide block:
Mondayprojects
Scratcher
32 posts

Position Recording With Lists

supa-panda wrote:

Here's a modified version of your script that utilizes the scratch glide block:

?
medians
Scratcher
1000+ posts

Position Recording With Lists

Mondayprojects wrote:

??????
This was from 2020, this is considered a necropost. And the person above was trying to provide a solution.
SuperDragonStudios
Scratcher
500+ posts

Position Recording With Lists

Bro posted on my topic 3 years late lmao
SuperDragonStudios
Scratcher
500+ posts

Position Recording With Lists

This should have been closed a long time ago, so I'll do the honors.

Powered by DjangoBB