Discuss Scratch

rdococ
Scratcher
500+ posts

Script variables extension

Currently there are global variables, and sprite variables, variables that belong to a particular sprite. I've implemented script variables - these are variables that belong to a particular script (including custom block definitions). These kinds of variables are used all over the place in traditional programming languages, so I thought it would be fun to see them in Scratch

(script var [variable] :: #FF4D6A)

set script var [variable] to [0] :: #FF4D6A

change script var [variable] by (1) :: #FF4D6A

Try it out!
Source code

The extension works with E羊icques (if you load it the old way) and TurboWarp (if you disable sandboxing and compilation). In the future, I may put this in a Scratch fork to see how far we can take the language.

Last edited by rdococ (Sept. 29, 2023 17:43:33)

lmccracken7
Scratcher
100+ posts

Script variables extension

i think this is a good idea

Hello! I'm lmccracken7, a scratcher and a Minecraft player!
But sorry, I'm in the middle of some lore RN, talk later?

100th Post: https://scratch.mit.edu/discuss/post/7779844/

if you are reading this then good job, you know how to highlight stuff. also im currently in The Dark Arc, with my character dead.

Powered by DjangoBB