Discuss Scratch

NoMod-Programming
Scratcher
1000+ posts

Water Ripple effect from Scratch 1.x

I decided to delve back into the old 1.x days of Scratch (back when it ran on Squeak), and thought about looking into the “Water Ripple” effect and why it didn't work. According to the Scratch Wiki:

Scratch Wiki wrote:

There was also a water ripple effect, which crashed Scratch due to the system not having enough memory

Well, looking into the source, I noticed that out of bounds reads and writes were occurring within the following lines of code:

	for (q = 0; q <= (width * height); q += 1) {
		temp = bArray[q];
		bArray[q] = (aArray[q]);
		aArray[q] = temp;
	}

If you didn't notice the issue, it's the <= comparison used for checking that the variable “q” is between 0 and (width * height). Because arrays bArray and aArray are 0-indexed, though, the last element, at width * height, doesn't exist. So the code crashed every time it tried looping over the final element. The fix to this, therefore, was to replace the <= comparison with the < operator, such as in the following snippet:

	for (q = 0; q < (width * height); q += 1) {
		temp = bArray[q];
		bArray[q] = (aArray[q]);
		aArray[q] = temp;
	}

That one character fix gets the “water ripple” effect working (after recompiling the plugin), and it can be seen in the following gif:

Maximouse
Scratcher
1000+ posts

Water Ripple effect from Scratch 1.x

Interesting! Someone should correct the wiki article then.
Jeffalo
Scratcher
1000+ posts

Water Ripple effect from Scratch 1.x

imagine how different scratch might have been if they didn't mess that up.

for compatibility i'm guessing they would keep the water ripple effect… which might have changed a lot of things. we might have had more advanced effects and stuff. wow!
CatsUnited
Scratcher
1000+ posts

Water Ripple effect from Scratch 1.x

Jeffalo wrote:

imagine how different scratch might have been if they didn't mess that up.
I could see a lot of people using this in their projects as cool glitch effect woah
Bacteria999
Scratcher
1000+ posts

Water Ripple effect from Scratch 1.x

bump
FunE552
Scratcher
8 posts

Water Ripple effect from Scratch 1.x

i found a project called instant scratch crasher that contains a block that is an effect set that has the option chosen for water ripple effect, it does nothing but is a cool relic and i put it in my backpack so i always have id

ps: i am not lying go there right now
ninjaMAR
Scratcher
1000+ posts

Water Ripple effect from Scratch 1.x

Cool! I hope the ST sees this and re-adds it
Raihan142857
Scratcher
1000+ posts

Water Ripple effect from Scratch 1.x

ninjaMAR wrote:

Cool! I hope the ST sees this and re-adds it
Haha, the ST never adds anything. Also why did @FunE552 necropost thats not cool
CatsUnited
Scratcher
1000+ posts

Water Ripple effect from Scratch 1.x

Raihan142857 wrote:

Also why did @FunE552 necropost thats not cool
because it is cool?
nekoender
Scratcher
100+ posts

Water Ripple effect from Scratch 1.x

I'm using the system browser thing in 1.x to fix it. where is this line of code?
	for (q = 0; q <= (width * height); q += 1) {
temp = bArray[q];
bArray[q] = (aArray[q]);
aArray[q] = temp;
}
Maximouse
Scratcher
1000+ posts

Water Ripple effect from Scratch 1.x

nekoender wrote:

I'm using the system browser thing in 1.x to fix it. where is this line of code?
	for (q = 0; q <= (width * height); q += 1) {
temp = bArray[q];
bArray[q] = (aArray[q]);
aArray[q] = temp;
}
It's in a plugin, so you can't change it in the editor itself.
flyingtrain322
Scratcher
21 posts

Water Ripple effect from Scratch 1.x

Is there any way to use the plugin file or does it do it automatically?
RSITYTScratch
Scratcher
100+ posts

Water Ripple effect from Scratch 1.x

flyingtrain322 wrote:

Is there any way to use the plugin file or does it do it automatically?
Don't necropost.
CST1229
Scratcher
1000+ posts

Water Ripple effect from Scratch 1.x

RSITYTScratch wrote:

(#13)

flyingtrain322 wrote:

Is there any way to use the plugin file or does it do it automatically?
Don't necropost.
I wouldn't call that a necropost because it is related to the topic and is not spam or anything like that.
ScratchCatHELLO
Scratcher
1000+ posts

Water Ripple effect from Scratch 1.x

RSITYTScratch wrote:

flyingtrain322 wrote:

Is there any way to use the plugin file or does it do it automatically?
Don't necropost.

I don’t think it’s possible to necropost in Advanced Topics.
Andricxa
Scratcher
94 posts

Water Ripple effect from Scratch 1.x

new effects
change [water ripple v] effect by (25)
change [blur v] effect by (25)
tyson4621
Scratcher
29 posts

Water Ripple effect from Scratch 1.x

set [WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW v] effect to (WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWw)
just use that

Powered by DjangoBB