Custom variable

can you make a custom block that acts as a variable without using variables

What do you mean by "custom blocks that acts like a variable"? You can use block variables to simulate those:
Screenshot 2024-06-07 192554

untitled script pic (26)

If this is you don't mean, explain more.

no i want a block to set a variable then another block to call it. but without actually using a variable

Like a counter?
untitled script pic (27)

untitled script pic (28)

untitled script pic (29)

but set not count

Is it like this for set?
untitled script pic (30)

no i want it to work like an actual variable without it being an actual variable. which means I need 2 custom blocks to communicate with eachother

Then I don't think this is possible in Snap!, but you can try to use database blocks that acts like variables without the use of variables. Keep in mind that they are stored project-to-project.

:file_icon: > Libraries > Database

you should be able to tell a block to change something

Yeah, some scheme and logo textbooks have an example about variable passing that is really, really cool. Snap! does not like it. It's a design decision made by jens I beleive.

Personally, I'd rather not use global variables unless I can sort them, having said that...

A couple of versions ago they implemented a key/pair system that you can put in a list and call via a mechanism I can't quite recall, and that is very cool, but someone else will have to clarify what I mean, I'm going from memory, and you may still not be able to do what you're after.

You can't create a custom block that acts exactly like a variable, but you can emulate it.

You can make the definition report a variable.
1000425286

And then you can hide the variable from the pallet by right clicking the pallet and clicking "hide blocks". Then scroll down to find the variable, then click on the checkbox next to it.

Now the variable won't show up in the set variable block, so you can create a custom block that sets the variable.
1000425288

thats just not true.
CloneScript script pic (5)

Based on the low level details of the implementation of block variables.
untitled script pic - 2024-06-07T232920.199
Named wrapper using side effect of the reporter
blocks variable script pic (9)


Used as a setter blocks variable script pic (4)
or getter blocks variable script pic (5)


Example
blocks variable script pic (6)


With the optional companion blocks (different styles)
blocks variable script pic (10)


Single shot, design-time macro to create a named storage
blocks variable script pic (12)


This concept has a slight drawback. "Variables" defined this way are persistent (saved with the project).


@DEV version with the new variadic handling it's more intuitive
untitled script pic - 2024-06-07T231007.530
untitled script pic - 2024-06-07T231014.177

i have a cleaner design for that

CloneScript script pic

Use "smart pic" or share your project.
script_pic

I'm assuming they right clicked the scripting area, and selected "scripts pic", which should still contain the blocks xml.
1000425303

Maybe a kind of aggressive proxy/firewall/antivirus removed the blocks.

You may use Snap! v10, Metaprogramming library's block to store value
search variable custom blocks script pic (2)


Creating a variable with metaprogramming seems to be OK.
But 70 ms just to set a variable value is rather an overkill
search variable custom blocks script pic (3)

im sure there are ways to speed it up