<p></p>
<p dir="auto">The problem is that in <code class="notranslate">loadsay</code>, if an Instead condition runs a script instead of the box, then the rest of <code class="notranslate">loadsay</code> is skipped, so the box isn't displayed, <code class="notranslate">txt.id</code> isn't set to the new ID, and <code class="notranslate">txt.showing</code> isn't set. But all the textbox data is actually loaded into <code class="notranslate">txt</code>, and <code class="notranslate">txt.id</code> and <code class="notranslate">txt.showing</code> keep their previous values, meaning the previous textbox if any doesn't actually close! And <code class="notranslate">advance_text_box</code> doesn't quit if there's no text box actually showing.</p>
<p dir="auto">If you trigger a textbox from an NPC<br>
Consider:<br>
Text box 1:<br>
After: ALWAYS show Text box 2<br>
Text box 2:<br>
Instead: ALWAYS run script <code class="notranslate">insteadscript</code><br>
After: ALWAYS run script 'afterscript' or show Text box 3</p>
<p dir="auto">If TB 2 is triggered directly from an NPC, then just <code class="notranslate">insteadscript</code> runs, and the box doesn't display as expected. But if <code class="notranslate">insteadscript</code> runs <code class="notranslate">advance text box</code> then all the conditionals that happen when advance run, including running <code class="notranslate">afterscript</code> or shows TB 3! (A menu set to "Advance text box when menu closes" will apparently have the same effect, since that also calls <code class="notranslate">advance_text_box</code> unconditionally.)</p>
<p dir="auto">If TB 1 is triggered from an NPC, TB 1 shows as normal, and when advanced <code class="notranslate">insteadscript</code> runs immediately, but TB 1 remains displayed! Pressing F1 at this point shows that the current <code class="notranslate">txt.id</code> is still 1, but all the data is from TB 2. Pressing Enter a second time then runs <code class="notranslate">afterscript</code> or shows TB 3. If <code class="notranslate">insteadscript</code> runs <code class="notranslate">advance text box</code> then that just skips needing to press Enter twice. If it runs <code class="notranslate">show text box</code> then that overwrite the phantom textbox data and everything is normal.</p>
<ul dir="auto">
<li>But wait! Are Instead scripts actually meant to skip the text box?<br>
r2206 (<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/ohrrpgce/ohrrpgce/commit/5ab1536013dfe721d509aa21911197a9801ed4b2/hovercard" href="https://github.com/ohrrpgce/ohrrpgce/commit/5ab1536013dfe721d509aa21911197a9801ed4b2"><tt>5ab1536</tt></a>) in 2008, xocolatl, introduced <code class="notranslate">txt.id</code>, and it looks like it changed the behaviour, because before then the equivalent of <code class="notranslate">txt.id</code> <em>was</em> still set even if the textbox was skipped by an Instead script. Currently testing...</li>
</ul>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/ohrrpgce/ohrrpgce/issues/1252">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AMWGWZQKFYM552QYTNDIUJTXAX2RXANCNFSM6AAAAAAW26UB3Q">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AMWGWZQXFF62ZOIUBLLF6MDXAX2RXA5CNFSM6AAAAAAW26UB3SWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHGGJRMSA.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><ohrrpgce/ohrrpgce/issues/1252</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/ohrrpgce/ohrrpgce/issues/1252",
"url": "https://github.com/ohrrpgce/ohrrpgce/issues/1252",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>