Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » scratchattach - A Scratch API wrapper (Python)
- Eason_9
- Scratcher
1000+ posts
scratchattach - A Scratch API wrapper (Python)
(#2276)bump for my post(#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..?
- TheMobileGames
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
Correct since this is just an example; I’m coding something different but I feel that there is no need to explain it as it will cause more confusion to answer the original question directly. I think in the use case you described, the gain in speed wouldn't justify the effort to code something like that.
That would be really nice if you could add that feature, which does whatever is needed internally to set many cloud variables (up to 10) at max speed (10 times a 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.
Yep, I already have fixed that problem in my actual script that I am working on. When coding something like this, beware that the on_set event will also be called when the cloud variable is set to 0 by the Python script. To prevent an infinite loop of on_set events caused by the Python script itself, add something like this to the on_set event:if str(event.value) != "0": ...
I am going to try to make a similar function to the one I made in the code below. It takes in “event.var” as an input and uses the last used connection to set the variable to “0”.
import scratchattach as scratch3 session = scratch3.login("TheMobileGames", os.environ["PASSWORD"]) conn_list = [session.connect_cloud("project_id") for i in range(10)] print(conn_list) # yep it works next_conn_to_use = 0 def set_var_with_old_conn(var_name): global next_conn_to_use conn_list[next_conn_to_use].set_var(var_name, “0") if next_conn_to_use == 9: next_conn_to_use = 0 else: next_conn_to_use += 1 events = scratch3.CloudEvents("project_id") @events.event def on_set(event): if str(event.value) != "0": set_var_with_old_conn(event.var) @events.event def on_ready(): print("Event listener ready!") events.start()
Last edited by TheMobileGames (Jan. 21, 2024 04:47:27)
—————————— —————————— —————————— —————————— ——————————
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/
—————————— —————————— —————————— —————————— ——————————
- TheMobileGames
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
Update: Much much less data is lost which is very exciting but there are still a few problems. After a while (about 30 seconds) setting cloud variables no longer works although I can see, in console, when an event is triggered. To fix this do I really have to open a bunch of connections and after 20-30 seconds, I would need create more connections and switch to them, afterwards, I need to close the old connections and repeat? Also how often should I create new connections?
Last edited by TheMobileGames (Jan. 21, 2024 21:14:26)
—————————— —————————— —————————— —————————— ——————————
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/
—————————— —————————— —————————— —————————— ——————————
- ShadowMilo
- Scratcher
13 posts
scratchattach - A Scratch API wrapper (Python)
yoooo the cloud logs are back!!!!!!!![/b]:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D
- EpicCoderGamer1000
- Scratcher
79 posts
scratchattach - A Scratch API wrapper (Python)
Hey I also use vs code for all of my coding using scratch attach and I used the terminal inside vs code to install scratchattach. I did not use the cmd to install scratch attach. Hope this helps!(#2276)bump for my post(#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
epic coder gamer 1000
- Mooaus2940
- Scratcher
90 posts
scratchattach - A Scratch API wrapper (Python)
Hello, im austin and im wondering, do you use the scratches api, or did you make your own?
- Air_heads
- Scratcher
92 posts
scratchattach - A Scratch API wrapper (Python)
Hello, im austin and im wondering, do you use the scratches api, or did you make your own?
Scratchattach utilizes the API provided by Scratch.
- Mooaus2940
- Scratcher
90 posts
scratchattach - A Scratch API wrapper (Python)
Ok, how did they get the Auth token?Hello, im austin and im wondering, do you use the scratches api, or did you make your own?
Scratchattach utilizes the API provided by Scratch.
- Eason_9
- Scratcher
1000+ posts
scratchattach - A Scratch API wrapper (Python)
(#2283)Is it required to use the terminal inside vs code to install scratch attach for it to work?
Hey I also use vs code for all of my coding using scratch attach and I used the terminal inside vs code to install scratchattach. I did not use the cmd to install scratch attach. Hope this helps!
*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..?
- ajskateboarder
- Scratcher
1000+ posts
scratchattach - A Scratch API wrapper (Python)
I'm pretty sure scratchattach POSTs user credentials to scratch.mit.edu/login and gets the session ID cookie from the response, which is basically the token used to do user-specific actionsOk, how did they get the Auth token?Hello, im austin and im wondering, do you use the scratches api, or did you make your own?
Scratchattach utilizes the API provided by Scratch.
It doesn't matter what terminal you use, but the terminal in VSCode is recommended since it opens alongside code(#2283)Is it required to use the terminal inside vs code to install scratch attach for it to work?
Hey I also use vs code for all of my coding using scratch attach and I used the terminal inside vs code to install scratchattach. I did not use the cmd to install scratch attach. Hope this helps!
Last edited by ajskateboarder (Jan. 22, 2024 13:05:26)
- Eason_9
- Scratcher
1000+ posts
scratchattach - A Scratch API wrapper (Python)
(#2288)umm then how about this?
It doesn't matter what terminal you use, but the terminal in VSCode is recommended since it opens alongside code
(#2267)
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
*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)
Its better to use the terminal in vs code because thats how i got scratchattach to work(#2288)umm then how about this?
It doesn't matter what terminal you use, but the terminal in VSCode is recommended since it opens alongside code(#2267)
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
epic coder gamer 1000
- caftingdead261
- Scratcher
96 posts
scratchattach - A Scratch API wrapper (Python)
I don't get it what is so bad about scratch attach?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.
can someone tell me?
- ajskateboarder
- Scratcher
1000+ posts
scratchattach - A Scratch API wrapper (Python)
People are using it for various “exploits” by setting cloud variables to values so they can show up on the leaderboard. Deleting the module is pointless – what really should be done on Scratch's part is securing their cloud variable interfacesI don't get it what is so bad about scratch attach?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.
can someone tell me?
- Eason_9
- Scratcher
1000+ posts
scratchattach - A Scratch API wrapper (Python)
(#2290)bump for my post(#2288)umm then how about this?
It doesn't matter what terminal you use, but the terminal in VSCode is recommended since it opens alongside code(#2267)
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
*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)
So you must have downloaded the file onto your pc when you ran the command in the cmd. To use scratchattach in vs code download scratchattach using the terminal in vs code.(#2290)bump for my post(#2288)umm then how about this?
It doesn't matter what terminal you use, but the terminal in VSCode is recommended since it opens alongside code(#2267)
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
epic coder gamer 1000
- Eason_9
- Scratcher
1000+ posts
scratchattach - A Scratch API wrapper (Python)
(#2281)I tried, but it said that requirements are already satisfied and refused to download
So you must have downloaded the file onto your pc when you ran the command in the cmd. To use scratchattach in vs code download scratchattach using the terminal in vs code.
Last edited by Eason_9 (Jan. 30, 2024 06:34:50)
*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..?
- caftingdead261
- Scratcher
96 posts
scratchattach - A Scratch API wrapper (Python)
Don't you need to own the project to change them?People are using it for various “exploits” by setting cloud variables to values so they can show up on the leaderboard. Deleting the module is pointless – what really should be done on Scratch's part is securing their cloud variable interfacesI don't get it what is so bad about scratch attach?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.
can someone tell me?
- TheMobileGames
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
No, you can change the variables of any project as long as you aren’t banned from the Scratch API and have the Scratcher rank of course. It’s actually very very helpful to me whenever I need to change some variables on my project with an alt account instead. Don't you need to own the project to change them?
—————————— —————————— —————————— —————————— ——————————
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/
—————————— —————————— —————————— —————————— ——————————