[Ohrrpgce] [ohrrpgce/ohrrpgce] Text box Instead run script conditionals don't properly skip the text box (Issue #1252)

Ralph Versteegen notifications at github.com
Tue Apr 11 17:38:51 PDT 2023


The problem is that in `loadsay`, if an Instead condition runs a script instead of the box, then the rest of `loadsay` is skipped, so the box isn't displayed, `txt.id` isn't set to the new ID, and `txt.showing` isn't set. But all the textbox data is actually loaded into `txt`, and `txt.id` and `txt.showing` keep their previous values, meaning the previous textbox if any doesn't actually close! And `advance_text_box` doesn't quit if there's no text box actually showing.

If you trigger a textbox from an NPC
Consider:
Text box 1:
  After: ALWAYS show Text box 2
Text box 2:
  Instead: ALWAYS run script `insteadscript`
  After: ALWAYS run script 'afterscript' or show Text box 3

If TB 2 is triggered directly from an NPC, then just `insteadscript` runs, and the box doesn't display as expected. But if `insteadscript` runs `advance text box` then all the conditionals that happen when advance run, including running `afterscript` or shows TB 3! (A menu set to "Advance text box when menu closes" will apparently have the same effect, since that also calls `advance_text_box` unconditionally.)

If TB 1 is triggered  from an NPC, TB 1 shows as normal, and when advanced `insteadscript` runs immediately, but TB 1 remains displayed! Pressing F1 at this point shows that the current `txt.id` is still 1, but all the data is from TB 2. Pressing Enter a second time then runs `afterscript` or shows TB 3. If `insteadscript` runs `advance text box` then that just skips needing to press Enter twice. If it runs `show text box` then that overwrite the phantom textbox data and everything is normal.

* But wait! Are Instead scripts actually meant to skip the text box?
r2206 (5ab153601) in 2008, xocolatl, introduced `txt.id`, and it looks like it changed the behaviour, because before then the equivalent of `txt.id` *was* still set even if the textbox was skipped by an Instead script. Currently testing...

-- 
Reply to this email directly or view it on GitHub:
https://github.com/ohrrpgce/ohrrpgce/issues/1252
You are receiving this because you are subscribed to this thread.

Message ID: <ohrrpgce/ohrrpgce/issues/1252 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.motherhamster.org/pipermail/ohrrpgce-motherhamster.org/attachments/20230411/182b5edb/attachment.htm>


More information about the Ohrrpgce mailing list