So - the problem you are having is that the contents of the roll query are being substituted in, and partly parsed, before the roll query macro is itself executed. I am absolutely no expert on this particular problem - but basically you have to substitute certain characters in the sub macros with html calls so that when they get parsed, the roll query macro is entirely correct. I generally get around this by having the parent macro whisper a bunch of macro call buttons into chat, and then I can click on those buttons to call the sub macros, rather than using the query, thus avoiding the whole 'substitute and parse' problem - it also means I can use the sub macros directly as they do not have to be parsed to become executable. Perhaps others can comment on the correct means to fix your issue - but you will probably need to provide the code of your sub macros for them to do it, as that is where the fixes will need to be.