Rule groups which can use other local variables

A feature I’d like to see in Hopscotch is:

Groups of rules, similar to custom rules but they cna use variables from the scope above

7 Likes

100% Yes.

I’m finding local variables very frustrating to use since they don’t cascade into custom abilities (I know you said “rules” but the same issue extends to abilities as well). I’m presently so frustrated that I’m about ready to quit using local variables.

Maybe T1 or someone will correct me if I’m wrong, but I believe in the future, once parameters are added, you’d be able to use those parameters so local variables could be inputs to the custom ability.

But in the mean time, while waiting for parameters, the neutering of custom abilities to prevent local variables from cascading into them is, in my opinion, ruining the ability to reuse code within your project.

@t1_hopscotch

7 Likes

Yeah parameters will be included, and are being worked on at the moment. They will be essentially local variables that exist inside that custom block (both custom abilities and custom rules), and you will be able to set inputs to them, including local variables from outer scopes.

In relation to the prevention of local variable scopes cascading into custom blocks — I do agree that without parameters, it limits use of local variables quite a lot in the meantime, where one is looking to reuse code.

Because if one is using local variables without being able to run different values for different places in code, it restricts you to using the same value. It leads to just having to code things manually again each time without using custom blocks, rather than being able to reuse code.

I think the neutering design is deliberate for when the ability to share custom blocks with other people is added, and it is at an in-between stage where we don’t have parameters yet to fill the other gap.

I can understand if you don’t have much use for local variables in the meantime (I initially felt the same) — their main advantage at the moment is being similar to Object Variables that don’t exist for all objects, and for things like counters for Repeat blocks, where you don’t need to reuse the code in another rule. But at least on the horizon, now that local variables have been implemented, custom blocks with parameters will be coming.

4 Likes