Add and option to change variables' belonging
-
What I mean by this is, along with the “change variable’s name” when you highlight it, you should be able to also switch between “for all sprites” and “for this Sprite only.”
This would be useful if you are trying to make the same variable with different sprites but you need them to be separate since you don’t already have them like that.
Just deleting them would mess up all the previous coding. -
@011830-0a42ef84 so what would happen if that variable is used in other sprites?
-
@tyller_ It might get deleted or canceled out, but you should know whether or not it is only used in that certain sprite.
-
@011830-0a42ef84 you can make the code in one sprite and when you drag that code with a sprite only variable to another sprite, it will make that variable in that other sprite as a sprite only variable aswell
-
@tyller_ Well no, because I completely re-made the same sprite (without cloning) and had to set all variables in that sprite to “{variable name}2”
-
@011830-0a42ef84 if you remake the same sprite without changes then you absolutely should be using clones with sprite only variables (sprite only variables are only across the specific instance, they aren’t shared by clones, clones have their own sprite only variable values)
-
@tyller_ No, it has very similar coding and has all the same variables but it works differently than the other.
Plus, cloning is weird and I don’t understand it (mainly detection and moving and stuff)
-
@tyller_ If you are curious, both Scratch Addons and Turbowarp have this setting, so feel free to test it out.
-
Are you referring to this tool on Turbowarp? It allows you to use another variable to replace the selected variable in the current sprite only.
-
@info-creaticode How do you get to that?
-
@011830-0a42ef84
“Developer tools:”? -
On Turbowarp, you can right-click a variable in the block palette to open this dialog box. On CreatiCode, we don’t have it yet. We are researching if this is the best solution, or if we can do better.
-
@info-creaticode I don’t think I can add that extension, but I would appreciate it if you could do this when you can.
-
@info-creaticode Not quite. I mean where you right click ang get an option “switch to for this sprite only”
-
as @Tyller_ pointed out, when you request to change a variable’s scope from shared to “this sprite only”, it is not clear what to do with blocks using this variable in other sprites. Some user might want to delete those blocks, some may want to keep them but using a separate shared variable.
It is much cleaner to do it in a 2-step approach:
- create a new variable for this sprite only
- swap the existing variable to use this new variable (this is the dialog box from Turbowarp that I showed above)
Would you agree?
-
@info-creaticode No, I don’t entirely agree. There’s a video by griffpatch called The Variable Hack which goes into detail on this subject.
-
@mod-squadacademy-1bc96c56 said in Add and option to change variables' belonging:
griffpatch called The Variable Hack
That video is suggesting exactly what I’m suggesting: create a new variable for this sprite itself and then use it to swap out the old shared variable. So which part you are not agreeing?
-
@info-creaticode That is still a handy feature. I personally am not against the feature entirely. I’m just also a fan of the convert to feature (as also mentioned in the video).
As for what to do with the blocks in other sprites for the same variable, messages like this appear if you try to convert a variable with blocks in other sprites:
What I don’t agree on is that the method of switching variables replaces the method of converting variables. Personally, I think both methods are worth including. Both have their uses. Even better is to add a third way to change this:
-
Thank you for clarifying. We will be supporting add-ons (Scratch version or Turbowarp version), so this feature will be supported when that happens.
-
@info-creaticode I’ve written a Turbowarp extension a while ago, all it does though is just give “pi” as a variable block for 3.14… From what you’re saying, would that hypothetically work with CreatiCode?
-
We are still doing research on that.
-
@info-creaticode Got it. My extension is at https://github.com/Jeffreymaniac/Turbowarp-Extensions and it’s pretty simple. I’m not sure if it still works though because I made it in like 2021
-
@jeffreyrb03-gmail Your extension seems to still work. Do you often make Turbowarp extensions, or just had a go at it once or twice?
-
@mod-squadacademy-1bc96c56 I havent made one since 2022. I just know JavaScript and its different forms by studying them, like for scratch extensions and nodeJS
-
@jeffreyrb03-gmail Okay, cool. Well, if you ever make more, please let us know!
-
@mod-squadacademy-1bc96c56 Sure, also, I don’t plan on making any as I don’t use turbowarp anymore, but if you want I can make an extension for you. Just tell me what blocks you want and what functionality you want and I can probably get it done.