@Denethor asked me about logging the last command from a macro, and I'm a little stumped on how this can be done. Any solution we come up with just crashes.
Here's a macro replicating the crash. This happens with both /mqlog and /mlog
[CODE title="TestExit.mac"]sub Main
/declare blnMacroComplete int outer 0
/echo TestExit Macro
/echo Ending in 3 sec...
/delay 1s
/echo Ending in 2 sec...
/delay 1s
/echo Ending in 1 sec...
/delay 1s
:OnExit
/if ( !${blnMacroComplete} && !${MacroQuest.LastCommand.Find[/end]} && !${MacroQuest.LastCommand.Find[/camp]}) {
/echo Exiting
/mqlog Exiting
/echo LastCMD: ${MacroQuest.LastCommand}
/mqlog LastCMD: ${MacroQuest.LastCommand}
}
/return
[/CODE]
And here's what appears in the Logs/charname_server.log file:
Here's a macro replicating the crash. This happens with both /mqlog and /mlog
[CODE title="TestExit.mac"]sub Main
/declare blnMacroComplete int outer 0
/echo TestExit Macro
/echo Ending in 3 sec...
/delay 1s
/echo Ending in 2 sec...
/delay 1s
/echo Ending in 1 sec...
/delay 1s
:OnExit
/if ( !${blnMacroComplete} && !${MacroQuest.LastCommand.Find[/end]} && !${MacroQuest.LastCommand.Find[/camp]}) {
/echo Exiting
/mqlog Exiting
/echo LastCMD: ${MacroQuest.LastCommand}
/mqlog LastCMD: ${MacroQuest.LastCommand}
}
/return
[/CODE]
And here's what appears in the Logs/charname_server.log file:
Code:
[2020/06/14 16:51:46] [MQ2] TestExit Macro
[2020/06/14 16:51:46] [MQ2] Ending in 3 sec...
[2020/06/14 16:51:47] [MQ2] Ending in 2 sec...
[2020/06/14 16:51:48] [MQ2] Ending in 1 sec...
[2020/06/14 16:51:49] [MQ2] Exiting
[2020/06/14 16:51:49] [MQ2] LastCMD: /mqlog Exiting
[2020/06/14 16:51:49] Syntax Error: /mqlog LastCMD: ${MacroQuest.LastCommand} Line:16 in testexit.macNewLength 40 was greater than BufferSize - addrlen 29 in ParseMacroData, did you try to read data that exceeds 2048 from your macro?

