Pocket Plane Group

Friends and Neighbors => Weimer Republic (WeiDU.org) => WeiDU => Topic started by: jastey on June 14, 2019, 01:55:26 AM

Title: Question to STATE_WHICH_SAYS
Post by: jastey on June 14, 2019, 01:55:26 AM
In bg1npc v24, there is a STATE_WHICH_SAYS to detect the correct dialogue state number for an interjection point, in this case Skie into Brilla in the Silbershield's home (in bg1npc_kagqst.tpa):

Code: [Select]
// Get state for X#SkieBrillaGuards
OUTER_SET SkieBrillaGuards = STATE_WHICH_SAYS 66 IN ~bg1npc/tra/%s/x#skint.tra~ FROM ~%tutu_var%BRILLA~

The compilation of x#skint.d is done before calling this tpa. Line @66 is present.

There is one player report that I think means that this didn't work and the value of %SkieBrillaGuards% is appearently at -1:
Quote
[tb#_compile_eval_buffer/bg1npc/phase2/dlg/x#kagqst_ee.d] LEXER ERROR at line 123 column 1-79
Near Text: -
    invalid character [-]

-What would be the obvious reasons why this wouldn't work, i.e. why the STATE_WHICH_SAYS wouldn't match the dialogue state number? (Especially since it probably worked locally for at least AstroBryGuy).
-What can I do to make this more stable, or to not make it fail the install?

Thank you!


Title: Re: Question to STATE_WHICH_SAYS
Post by: Wisp on June 15, 2019, 04:15:27 AM
The returned value is -1 if no state with that SAY-text exists. If you have verified that it is a vanilla state, or is at least guaranteed to exist by the time this code runs, you can also verify that the relevant TRA string is a verbatim copy of the SAY text, in each language (if some translation is off, this would fail for that language). STATE_WHICH_SAYS matches on TLK indices, so the string needs to resolve into an existing strref or it will fail.

If you don't want to installation to fail for a missing state, you could check the return value from STATE_WHICH_SAYS before attempting to compile the D.
Title: Re: Question to STATE_WHICH_SAYS
Post by: jastey on June 15, 2019, 07:46:22 AM
Thank you for the explanations.
Is there also the possibility that STATE_WHICH_SAYS gives -1 if there are multiple instances of this line in the dlg? Because I had this "-" error message recently locally for a mod of mine as well, and there it was the case that the tra-line actually went into two dlg-states because it was compiled from a I_C_T3 with several NPCs reacting and this appearently leads to several dlg states for the NPC reacting last.

Short question rephrased: what does STATE_WHICH_SAYS give back if there are mutliple instances in the dlg?
Title: Re: Question to STATE_WHICH_SAYS
Post by: Wisp on June 15, 2019, 06:27:06 PM
This is documented in the readme.

-1 is if there is no state with SAY-text like that.
-2 is if there are two or more states with SAY-text like that.
-3 is if the string does not resolve into a strref already in the TLK.
Title: Re: Question to STATE_WHICH_SAYS
Post by: jastey on June 16, 2019, 02:44:23 PM
Thank you!