Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » scratchattach - A Scratch API wrapper (Python)
- Knightbot63
- Scratcher
1000+ posts
scratchattach - A Scratch API wrapper (Python)
CLOUD LOG ARE BACK THIS IS NOT A DRILL I REPEAT CLOUD LOGS ARE BACK THIS IS NOT A DRILL
Awesome. Good news everyone the logs just came back up
Working on an RPG. Consistently losing followers because of inactivity.
I head to forums time-to-time. Not as much as I used to.
- mas6y6
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
THE CLOUD LOGS ARE BACK!!!!!!!@!
Hi i am mas6y6 i am the maker and owner for Scratch Cloud
Its a Scratch in Scratch Project
======
The Cloud Web has been discontinued
- EpicCoderGamer1000
- Scratcher
79 posts
scratchattach - A Scratch API wrapper (Python)
We know THE CLOUD LOGS ARE BACK!!!!!!!@!
epic coder gamer 1000
- scaryghost14
- Scratcher
53 posts
scratchattach - A Scratch API wrapper (Python)
yes back up!!!We know THE CLOUD LOGS ARE BACK!!!!!!!@!
when green flag clicked
if <cloud_logs = back up> then
say [yes!!]
else
sad
end
play https://scratch.mit.edu/projects/860188790/ it is fun follow scaryghost14
when I receive [I'm board v]
follow [scaryghost14]
- ajskateboarder
- Scratcher
1000+ posts
scratchattach - A Scratch API wrapper (Python)
I'm not able to run the Python CodeSandbox due to some strange error with a “microVM”, but my guess is that it probably should work if you create a terminal and run “pip install scratchattach” Just found this, seeing how to import to CodeSandbox.
- perperperper
- Scratcher
16 posts
scratchattach - A Scratch API wrapper (Python)
yepWe know THE CLOUD LOGS ARE BACK!!!!!!!@!
well
I'm a MEMER, and an ASAIN FURRY
- grandpasp
- Scratcher
39 posts
scratchattach - A Scratch API wrapper (Python)
I'm trying to add 2 projects to the Scratchattach studio. They keep disppearing!
- ScratchcatandGobo
- Scratcher
1000+ posts
scratchattach - A Scratch API wrapper (Python)
Wait they are back up- *GROWS MENTALLY INSTABLE*
amoungus
- Eason_9
- Scratcher
1000+ posts
scratchattach - A Scratch API wrapper (Python)
I already installed scratchattach but it says I haven't. Can anyone help?
Picture here btw: https://u.cubeupload.com/eason_9_lol/Screenshot2024012015.png
(also cloud logs are up!!!! )
Picture here btw: https://u.cubeupload.com/eason_9_lol/Screenshot2024012015.png
(also cloud logs are up!!!! )
*This is my signature, it will appear below every post of mine! Scroll down by highlighting anywhere and press shift and the down arrow key.
Get your images up on your forum posts with my shop: Imagif Hosters (for free!)
working on my first indie game..
sneak peek..?
working on my first indie game..
sneak peek..?
- EpicCoderGamer1000
- Scratcher
79 posts
scratchattach - A Scratch API wrapper (Python)
I already installed scratchattach but it says I haven't. Can anyone help?
Picture here btw: https://u.cubeupload.com/eason_9_lol/Screenshot2024012015.png
(also cloud logs are up!!!! )
What are you using to code
Also you don't need to use the cloud emoji to set a var
epic coder gamer 1000
- TheMobileGames
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
Hey, does anyone know of some problems that I could have made that results in a lot of data being lost? I am currently using cloud events such as this and I’m wondering if it’s lossless when the project is full of people and busy (constant cloud variable changes):
Lastly, does anyone have any tips for me to indeed make these things (events and setting cloud variables) lossless (or almost/close to lossless) while keeping the same speed? I would much rather resolve this without editing my Scratch code itself please.
import scratchattach as scratch3Also, from a single account, how fast can these variables be set with Scratchattach? Is it possible to set all 10 of them at max speed (10 per second, I think) while being completely lossless?
events = scratch3.CloudEvents(“project_id”)
@events.event
def on_set(event): #Called when a cloud var is set
print(f“{event.user} set the variable {event.var} to the value {event.value} at {event.timestamp}”)
@events.event #Called when the event listener is ready
def on_ready():
print(“Event listener ready!”)
events.start()
Lastly, does anyone have any tips for me to indeed make these things (events and setting cloud variables) lossless (or almost/close to lossless) while keeping the same speed? I would much rather resolve this without editing my Scratch code itself please.
Last edited by TheMobileGames (Jan. 20, 2024 21:50:54)
—————————— —————————— —————————— —————————— ——————————
A way to make any game easily mobile (no remixing needed): https://scratch.mit.edu/discuss/topic/733837
My mobile engine (use to add buttons/controls to a game): https://scratch.mit.edu/projects/778848092/
—————————— —————————— —————————— —————————— ——————————
- TimMcCool
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
Cloud events should be lossless because they use the clouddata log to detect cloud activity. Hey, does anyone know of some problems that I could have made that results in a lot of data being lost? I am currently using cloud events such as this and I’m wondering if it’s lossless when the project is full of people and busy (constant cloud variable changes):import scratchattach as scratch3Also, from a single account, how fast can these variables be set with Scratchattach? Is it possible to set all 10 of them at max speed (10 per second, I think) while being completely lossless?
events = scratch3.CloudEvents(“project_id”)
@events.event
def on_set(event): #Called when a cloud var is set
print(f“{event.user} set the variable {event.var} to the value {event.value} at {event.timestamp}”)
@events.event #Called when the event listener is ready
def on_ready():
print(“Event listener ready!”)
events.start()
Lastly, does anyone have any tips for me to indeed make these things (events and setting cloud variables) lossless (or almost/close to lossless) while keeping the same speed? I would much rather resolve this without editing my Scratch code itself please.
Setting cloud variables is not garantueed to be lossless. You can reduce loss by reconnecting to the cloud regularly (close old connection and open new connection).
When setting cloud variables with scratchattach using a CloudConnection, there is a 0.1s cooldown between cloud variable sets. (You can only use the conn.set_var function 10 times per second.) However you can open multiple cloud connections to a project in order to set cloud variables more often (using only one session / one account):
import scratchattach as scratch3 session = scratch3.Session("sessionid", username="username") conn1 = session.connect_cloud("projectid") conn2 = session.connect_cloud("projectid") conn1.set_var("var", "value") # Sets a cloud var using connection 1 conn2.set_var("var", "value") # Sets a cloud var using connection 2
Developer of scratchattach, the most popular Python Scratch API wrapper
- TimMcCool
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
delete it now. people are hacking with it like crazy!Just like every useful tool, scratchattach can be abused. However, deleting the library would harm Scratch's Python dev community while it wouldn't stop hackers at all: There are plenty of other libraries that support setting cloud variables (many of these existed before scratchattach). Hackers could just use one of these libraries instead. bro, remove the module.
Last edited by TimMcCool (Jan. 21, 2024 01:34:16)
Developer of scratchattach, the most popular Python Scratch API wrapper
- Air_heads
- Scratcher
92 posts
scratchattach - A Scratch API wrapper (Python)
The blame goes on scratch attach because it is known of and well people don’t know much more than the basic programming in scratch and they have no idea how everything else works. (Notevveryone of course)True but it sure simplifies it and yes people use html and js but still the blame goes on scratch attach.Check robot destructor people are abusing and I hope this won’t happen but I would not be surprised if the st gets rid of scratchattach projectsdelete it now. people are hacking with it like crazy!who ? bro, remove the module.
People can still do it without scratchattach -_-
I still don’t get your argument as to why the blame should be on Scratchattach …
If the API is public, then anyone can utilize it, and if you’re talking about JavaScript, scratchattach is completely irrelevant as it is a python library.
ScratchConnect and other libraries use a seemingly similar syntax as ScratchAttach, so anyone who knows how to use ScratchAttach can use ScratchConnect instead. I'm not even going to bring up the fact that ANYONE can access the API with a simple post request as your contention is based on the idea that libraries make it simpler to use the API.
- Air_heads
- Scratcher
92 posts
scratchattach - A Scratch API wrapper (Python)
@wvzack @TimMcCool essentially encapsulated my contention here. Read this post for a better understanding of what I am trying to convey.delete it now. people are hacking with it like crazy!Just like every useful tool, scratchattach can be abused. However, deleting the library would harm Scratch's Python dev community while it wouldn't stop hackers at all: There are plenty of other libraries that support setting cloud variables (many of these existed before scratchattach). Hackers could just use one of these libraries instead. bro, remove the module.
Last edited by Air_heads (Jan. 21, 2024 01:40:35)
- scaryghost14
- Scratcher
53 posts
scratchattach - A Scratch API wrapper (Python)
cooldelete it now. people are hacking with it like crazy!Just like every useful tool, scratchattach can be abused. However, deleting the library would harm Scratch's Python dev community while it wouldn't stop hackers at all: There are plenty of other libraries that support setting cloud variables (many of these existed before scratchattach). Hackers could just use one of these libraries instead. bro, remove the module.
play https://scratch.mit.edu/projects/860188790/ it is fun follow scaryghost14
when I receive [I'm board v]
follow [scaryghost14]
- TheMobileGames
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
Okay, I now understand that cloud events should be lossless. Yet, I still have some questions about setting cloud variables, below is some simplified example code for you to quickly analyze. Let’s say whenever any cloud variable in the project is changed, Scratchattach will set it back to 0 to emulate fast changes. Cloud events should be lossless because they use the clouddata log to detect cloud activity.
Setting cloud variables is not garantueed to be lossless. You can reduce loss by reconnecting to the cloud regularly (close old connection and open new connection).
When setting cloud variables with scratchattach using a CloudConnection, there is a 0.1s cooldown between cloud variable sets. (You can only use the conn.set_var function 10 times per second.) However you can open multiple cloud connections to a project in order to set cloud variables more often (using only one session / one account):import scratchattach as scratch3 session = scratch3.Session("sessionid", username="username") conn1 = session.connect_cloud("projectid") conn2 = session.connect_cloud("projectid") conn1.set_var("var", "value") # Sets a cloud var using connection 1 conn2.set_var("var", "value") # Sets a cloud var using connection 2
import scratchattach as scratch3 session = scratch3.login("TheMobileGames", os.environ["PASSWORD"]) conn1 = session.connect_cloud("project_id") events = scratch3.CloudEvents("project_id") @events.event def on_set(event): conn1.set_var("event.var", "0") @events.event def on_ready(): print("Event listener ready!") events.start()
—————————— —————————— —————————— —————————— ——————————
A way to make any game easily mobile (no remixing needed): https://scratch.mit.edu/discuss/topic/733837
My mobile engine (use to add buttons/controls to a game): https://scratch.mit.edu/projects/778848092/
—————————— —————————— —————————— —————————— ——————————
- Eason_9
- Scratcher
1000+ posts
scratchattach - A Scratch API wrapper (Python)
(#2268)I used VS Code for coding and cmd for downloadingI already installed scratchattach but it says I haven't. Can anyone help?
Picture here btw: https://u.cubeupload.com/eason_9_lol/Screenshot2024012015.png
(also cloud logs are up!!!! )
What are you using to code
Also you don't need to use the cloud emoji to set a var
*This is my signature, it will appear below every post of mine! Scroll down by highlighting anywhere and press shift and the down arrow key.
Get your images up on your forum posts with my shop: Imagif Hosters (for free!)
working on my first indie game..
sneak peek..?
working on my first indie game..
sneak peek..?
- TimMcCool
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
…Am I really supposed to make 10 connections and a function that takes in “event.var” and sets it to the last used connection? If there isn’t one already, there should be a function in Scratchattach that can “just” handle setting 5-10 cloud variables with each being changed 10 times a second. Maybe there could be one that opens as many connections as it needs and automatically closes them, all internally, so all someone has to do is use it and it works even when it’s setting a lot quickly.
I think in the use case you described, the gain in speed wouldn't justify the effort to code something like that. Using multiple connections can be beneficial if you want to set multiple cloud variables simultaneously, because one cloud connection only allows you to perform a total of 10 cloud var sets per second.
That's an interesting idea tho. This feature doesn't exist atm, but I might add something like this to scratchattach in the future If there isn’t one already, there should be a function in Scratchattach that can “just” handle setting 5-10 cloud variables with each being changed 10 times a second.
import scratchattach as scratch3 session = scratch3.login("TheMobileGames", os.environ["PASSWORD"]) conn1 = session.connect_cloud("project_id") events = scratch3.CloudEvents("project_id") @events.event def on_set(event): conn1.set_var("event.var", "0") @events.event def on_ready(): print("Event listener ready!") events.start()
if str(event.value) != "0": ...
Last edited by TimMcCool (Jan. 21, 2024 02:22:20)
Developer of scratchattach, the most popular Python Scratch API wrapper