# Running a custom block when one of its arguments is updated

I discovered the "Execute on slider change" setting today (I know, I'm a bit slow). It inspired me for a feature that I would like to implement in my BloP extension. Basically, I would like to add an option to the Snap settings that, when enabled, will cause a custom block to run (not the whole script, as I understand "Execute on slider change" works) when I "confirm" the change of the value of an argument of the block (either by pressing ENTER or by clicking outside the argument). When enabled in the settings, I would like to be able to toggle this behaviour for each single parameter.

Why I need this? I want the users of my extension to be able to create variables by using blocks such as, for example, <int () ; > (when they type the name of the variable in the argument, if they are using the simplified C/C++ that I created by using my extension).

If anyone has suggestions about which scripts, functions to start hacking from, I would really appreciate it.

I wonder if you can't implement this in Snap! code: Remember the SPLIT of the block, then have a generic-WHEN script whose condition is (current SPLIT value) ≠ (saved SPLIT value). Might be too slow though.

You should look at

ArgMorph.prototype.reactToSliderEdit @ blocks.js

There are also some experiments with partial eval Snap! Build Your Own Blocks
When you click with Alt, only the subexpression is evaluated and displayed.