But this solution creates the variables as local scope and cannot be modified as they are set as constant. For now, I just manually right-click and set them to task-local but I feel like there has to be a better way.
The other workaround is to just open the HSL Editor and insert lines of code with the variables that I want, however I want to see if this can all be done on Venus without having to go through extra steps.
This would save a lot of time and would avoid the trouble of having to constantly assign new variables through the click and drag UI.
If you declare the variables outside of the HSL block, either by using assignment=“” or by right clicking, new, in the Variables and Constants pane (image below), you can then assign multiple variables in the HSL block:
Yeah that seems to be another method. I was just looking to see if this could be done in one chunk of HSL code since that saves the most time. If I had to declare all the variables outside the HSL code block then I would still need to manually click and drag for every single one.
I’m wondering if there’s a more intuitive approach to this outside of the code block I attached above.
I believe this is a limitation of using HSL code blocks, even in the HSL powerpoint documentation (see link below), it states that “all NEW variables you create in the HSL code block are only valid within this block”.
It is true since when I declare a new variable in a code block, while it does not show in the Variables and Constants pane, it does show in the trace view. It’s ideal if you want to create temporary variables but, otherwise, you would have to manually set it as @Gareth mentioned.
{
variable NewVar, NewStr;
NewVar = 25;
NewStr = "Hello";
Trace("my new variable: ",NewVar);
Trace("my new string: ",NewStr);
}
Yeah I took a look at the slide deck earlier as well as the Example_HSL.pkg and it seems like variables that are created inside a code block is limited to the scope of that code block.
It’s unfortunate. I was hoping if there was a hackable solution to it but I guess that’s just one of Venus’s limitations.
Yeah, unfortunately. The only other way I can think of (which was intended in the documentation) is to declare it within the .hsl file instead. But, of course, it isn’t as convenient as it is to write it within a code block of a more user friendly interface like Venus
Its just variable scope, right? All variables are local until declared as global/public - you can do both within an HSL file but the HSL code block step is intended to be for local variables, unless you declare as global/public beforehand as I suggested.