Page 1 of 1

Calling a macro from a macro - /declare problem

Posted: Thu Sep 30, 2004 8:25 am
by morevit
This is not normally something I do, but it seemed the simplest solution when using the MQ2MyButtons plugin (i.e. have a set of fixed macros called by the buttons which then called your custom macros).

The problem I'm having is that apparently the first /declare in the called macro is not being recognized. It's possible the issue is with the first command rather than the first /declare but I don't think so. The called macros work fine when invoked directly from the command line of course.

Posted: Thu Sep 30, 2004 3:00 pm
by fice
When you call a macro it ends the macro currently running and starts the new one you called, it doesn't return to the original one. What you need to do is add Sub functions inside the macro already running, and in these functions you should specify what the other macros you have, do.

Posted: Thu Sep 30, 2004 7:53 pm
by eqjoe
Edit the source to his plugin to call your macro.



-j

Posted: Fri Oct 01, 2004 6:42 pm
by morevit
fice wrote:When you call a macro it ends the macro currently running and starts the new one you called, it doesn't return to the original one. What you need to do is add Sub functions inside the macro already running, and in these functions you should specify what the other macros you have, do.
Well aware of that. That's not the issue. The situation is this...

Code: Select all

------------------------------------------
|
| A.mac
|

sub Main
    /macro B
/return

Code: Select all

-------------------------------------------
|
| B.mac
|
sub Main
    /declare Foo string local
    /declare Bar string local

   /varset Foo abc
   /varset Bar def

   /echo ${Foo}${Bar}
/return
-------------------------------------------
The result of executing /mac A is an error message stating that "Foo" isn't defined on the set statement. This has nothing to do with the early termination of macro "A".

Posted: Fri Oct 01, 2004 6:44 pm
by morevit
eqjoe wrote:Edit the source to his plugin to call your macro.



-j
Obvious and wholy not the point. I want the buttons to be configurable from within EQ, not to require a recompile of the plugin every time I make a change.