<p></p>
<p>Ah ha! Setting a watchpoint on scriptret in gdb revealed that the on-add-hero hook script is triggered when <code>add hero</code> is called, clobbering the return value. Welcome to the new world of script interpreter reentrancy bugs! By which I don't mean we recursively call <code>scriptinterpreter</code> but it does switch script while executing a command. This already happens when calling <code>run script by id</code> but in that case the return value from the script is the return value from the command.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/ohrrpgce/ohrrpgce/issues/1186#issuecomment-751452017">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AMWGWZUO5RNSNHN3A73KPELSW4F4HANCNFSM4VKJ2YQQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AMWGWZW7NR6XZJT24UJFRATSW4F4HA5CNFSM4VKJ2YQ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFTFD64I.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/ohrrpgce/ohrrpgce/issues/1186#issuecomment-751452017",
"url": "https://github.com/ohrrpgce/ohrrpgce/issues/1186#issuecomment-751452017",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>