Action Block Headache

OscariBot

Active member
Over few days now I have been playing with action block trying to figure out it uniqueness... Here are few questions

1) How do I pass value from my macro global variable to Action Block?... I was expecting provision for magic text at the input. (I couldn't figure out a way)

2) It seems action block working variables only work within themselves, you can't pass their content to/fro variables outside the block be it global or local. (I tried it but it fail)

3)It seems Action Block working variables are totally different from macro local variable (macro variables can pass data to/fro global variables)

4)How do you pass action block output data to your global variable, seeing that it doesn't have magic text to add your global variable waiting for the processed output. (I just couldn't figure it out after series of trial).

Any help will b appreciated
 

FrameXX

Well-known member
1)
macro global variable
A global variable is called global because it isn't usually dedicated to a single macro or action block. Action blocks can access global variables in the same way as macros.

2)
Simply use the Set Variable action inside the action block, as you would in a macro. Set Variable > MyGlobalVariable > SomeValue. Action block output variables should be used to pass the data obtained or processed, or whatever the action block did, back to the macro that started the action block and store it in its local variables.

3)
As I stated, you can use the Set Variable action in exactly the same way as a regular macro.

4)
You can either use the Set Variable action in your action block as mentioned in point 2, or you can use the Set Variable action in the macro that started the action block and got variables back from the action block (as the output variables of that action block) and now set global variables to their values with Set Variable action.
 

OscariBot

Active member
Thanks for ur response...

Pls @Endercraft can u giv me a simple example macro?

I Really wanted to pass value from variable "A" in my macro to action block input.

Just can't figure it out
 

OscariBot

Active member
Sure I thought of this and I did it.. I was expecting to see the content of my global variable "A" at the input of my action block. But it didn't work... Wat could possibly be wrong.

My input variable remain empty even after linking with my "A"
 
I've already spent a few hours trying to understand the action blocks, I thought it would be the same as the "functions" of programming languages, but I found out in practice that it's not like that. Maybe it's some bug that will be fixed in the next versions. I will follow this post closely...
 

Dm114

Well-known member
Sure I thought of this and I did it.. I was expecting to see the content of my global variable "A" at the input of my action block. But it didn't work... Wat could possibly be wrong.

My input variable remain empty even after linking with my "A"
I've already spent a few hours trying to understand the action blocks, I thought it would be the same as the "functions" of programming languages, but I found out in practice that it's not like that. Maybe it's some bug that will be fixed in the next versions. I will follow this post closely...
No, I don't think there are problems, nor issues now with Action blocks. I use them quite often with my macros and don't experience any specific difficulties.

I'd rather say it's a problem of understanding on how they work.

As @Endercraft just showed above, the way to pass variables to an Action block is quite simple. As to global type variables it's even unnecessary to pass them as they are... global, i.e. available in the whole MD environment.

Maybe you both missed few points:
1⁰) in an Action block, there 3 kinds of variables: input, output and work
2⁰) only the 1st two (input ant output) are "visible" from/to the calling macro
3⁰) they are implicitly of Local type and are always restored to their Default values ofter running. Ir's the reason why you'll never see these values during Action block running.

The only way to check them is to temporarily set Input variables values to those you want to test and click on Test actions (hamburger menu in the upper right corner)
 

Dm114

Well-known member
Another point: Input variables cannot be modified by the Set variable action (which is sometimes a bit annoying and could be a Feature request).

The only way to modify their value is with Text manipulation when it is useful.
 

Endercraft

Moderator (& bug finder :D)
Easy to bypass.
Just create an output/working variable, create the set variable action, delete the variable and create an input variable with the exact same name.
 

Attachments

  • Set input var.macro
    2.2 KB · Views: 4

Dm114

Well-known member
Easy to bypass.
Just create an output/working variable, create the set variable action, delete the variable and create an input variable with the exact same name.
You're right but it's a bit annoying anyway. I was writing mainly for newbies who are not familiar with this kind of "manipulation" 😉
 

Endercraft

Moderator (& bug finder :D)
You're right but it's a bit annoying anyway. I was writing mainly for newbies who are not familiar with this kind of "manipulation" 😉
Of course, this is for bit more advanced users 😉
But I think that method is good even for newbies. I have provided more complex workarounds anyway 😊
 

OscariBot

Active member
No, I don't think there are problems, nor issues now with Action blocks. I use them quite often with my macros and don't experience any specific difficulties.

I'd rather say it's a problem of understanding on how they work.

As @Endercraft just showed above, the way to pass variables to an Action block is quite simple. As to global type variables it's even unnecessary to pass them as they are... global, i.e. available in the whole MD environment.

Maybe you both missed few points:
1⁰) in an Action block, there 3 kinds of variables: input, output and work
2⁰) only the 1st two (input ant output) are "visible" from/to the calling macro
3⁰) they are implicitly of Local type and are always restored to their Default values ofter running. Ir's the reason why you'll never see these values during Action block running.

The only way to check them is to temporarily set Input variables values to those you want to test and click on Test actions (hamburger menu in the upper right corner)
Oh my God!

You have really helped me identify the culprit...your explanation was very simple and clear... I JUST WISH I COULD GIVE YOU A 100 LIKES (You wouldn't belive I hav been battling this action block for over a week now) your point on No.3 was a huge turn around for me..

I was expecting working macro to behave just like local variables, hence store my values and reuse them when next I run the action block, it's even more confusing when I inspect the working variables after running only to see the default value still there as if nothing updated, little did I knw it's always reset to default after first run...

Now I understand how this action block works and it's truly unnecessary to try to pass global variable to Action Block input as global variable will always be available anytime within the action block.

Conclusively, action block can never replace your regular macro.

Thanks guys.
 

Attachments

  • Screenshot_20230228-205019.jpg
    Screenshot_20230228-205019.jpg
    159.9 KB · Views: 7

Endercraft

Moderator (& bug finder :D)
Hence since working variables don't behave like local variables, what is the point of having "extract to action block" on the menu.

Just curious
Extract to action block lets you compress some of your macro or your whole macro in an action block.
 
Top