Is there a way to fetch a returning value from execLink() like macro.return does for MACRO() ?
In other words: after calling a certain macro, I can read the returned result by:
[H: MACRO(macroLinkText): params]
[H: Result = macro.return]
How do I retrieve the results of an execLink(macroLinkText)?
Getting values back from execLink
Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice
Re: Getting values back from execLink
Nope. Unless you make a circular reference (so the macro in the execlink calls the. Other macro with the right parameters). To get anything returned directly you should use UDFs or [macro:]
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
- CoveredInFish
- Demigod
- Posts: 3104
- Joined: Mon Jun 29, 2009 10:37 am
- Location: Germany
- Contact:
Re: Getting values back from execLink
Thanks for the replies. I saw both of these suggestions beforehand.
I got around it, but UDF does not work for me here because the macro name is unknown (i.e. has to be determined) before execution. It's complicated.
But thanks anyways.
I got around it, but UDF does not work for me here because the macro name is unknown (i.e. has to be determined) before execution. It's complicated.
But thanks anyways.
- CoveredInFish
- Demigod
- Posts: 3104
- Joined: Mon Jun 29, 2009 10:37 am
- Location: Germany
- Contact:
Re: Getting values back from execLink
I can understand that dynamically build/choosen macro name/selection.
Could you explain why you choose Wiki: execLink() over [macro:]? If we see the reason behind that we might be able to offer a workaround.
I dont think wolph nor me get scared from a complicated macro
Could you explain why you choose Wiki: execLink() over [macro:]? If we see the reason behind that we might be able to offer a workaround.
I dont think wolph nor me get scared from a complicated macro
Re: Getting values back from execLink
yup same here, I have several routines where I execute an 'undetermined' macro based on the input of the user (or circumstances). I've devised two methods for that
1. [macro:]. Pretty obvious, just construct a string that resembles the name of the macro to execute and cram it in [macro:] and execute.
2. UDF, slightly trickier but not much. Same method as with one but now use eval("buildMacroName()"). Obviously the function names need to be defined for this to work.
1. [macro:]. Pretty obvious, just construct a string that resembles the name of the macro to execute and cram it in [macro:] and execute.
2. UDF, slightly trickier but not much. Same method as with one but now use eval("buildMacroName()"). Obviously the function names need to be defined for this to work.
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: Getting values back from execLink
I ended up using the macro function in the end. For some strange reason it didn't work for me at first as far as using the original calling token's properties. Only after I manually called switchToken() to the original token did it use the correct properties.
LIB:A was calling a macro on LIB:B
On LIB:A the code went something like this:
[H, macro(ABC@LIB:B): params]
[H: X = macro.return]
All the property values were missing in the called macro (ABC@LIB:B).
When I checked why in ABC@LIB:B, by using
[H: broadcast(getName())],
I got "LIB:B" broadcasted???
Which explains why there were no property values.
All I had to do was add one line of code before the macro() call on LIB:A:
[H: switchToken("LIB:A")]
[H, macro(ABC@LIB:B): params]
[H: X = macro.return]
Makes no sense, but it worked.
LIB:A was calling a macro on LIB:B
On LIB:A the code went something like this:
[H, macro(ABC@LIB:B): params]
[H: X = macro.return]
All the property values were missing in the called macro (ABC@LIB:B).
When I checked why in ABC@LIB:B, by using
[H: broadcast(getName())],
I got "LIB:B" broadcasted???
Which explains why there were no property values.
All I had to do was add one line of code before the macro() call on LIB:A:
[H: switchToken("LIB:A")]
[H, macro(ABC@LIB:B): params]
[H: X = macro.return]
Makes no sense, but it worked.