TimMcCool / scratchattach

Scratch API wrapper with support for almost all site features, cloud requests framework and more
MIT License
177 stars 48 forks source link

Response error #187

Closed JustablockCode closed 1 month ago

JustablockCode commented 7 months ago

So if user makes cloud request and scrolls or switches tab then data corrupts(even with no packet loss).

Ryan-shamu-YT commented 7 months ago

I am working with the OP on a project and this is the result of the bug:

image

Please fix this, projects which send more than 3000 characters seem to mostly suffer from this, e.g. PFP renderers and others.

JustablockCode commented 7 months ago

i think its smth with scratch code

Ryan-shamu-YT commented 7 months ago

i think its smth with scratch code

I have also seen this issue in other projects which load PFP and other info which is large

redspacecat commented 7 months ago

So if user makes cloud request and scrolls or switches tab then data corrupts(even with no packet loss).

I have experienced this too with making a comment loader

TimMcCool commented 7 months ago

This happens because scratch runs projects at a lower FPS rate when the tab isn't opened, therefore some of the data isn't received by the project. Can't be fixed unfortunately (maybe enabling turbo mode improves the problem, I haven't tested that before). Tell the users of your project to not switch tabs during the loading process.

btw, I wouldn't recommend you to send the pixel data using hex color values. convert the hex values to 8-digit-long base10 integers and send these integers instead (scratch can render this kind of color value too). scratchattach will encode values that contain both numbers and letters (therefore a 6 digit hex code is 12 digits long in the encoded value), but it won't encode values that only contain numbers (therefore an 8 digit base10 integer is only 8 digits long in the encoded vlaue)

Waakul commented 4 months ago

I am working with the OP on a project and this is the result of the bug:

image

Please fix this, projects which send more than 3000 characters seem to mostly suffer from this, e.g. PFP renderers and others.

You can fix this with a simple method of decoding it into a string and cutting it into parts. see my pfp render project where i managed to get alot of resolution without data loss: https://[scratch.mit.edu/projects/987765422/](https://scratch.mit.edu/projects/987765422/)