Jump to content
Sign in to follow this  
temnix

Replacing an action in DLG files

Recommended Posts

I'm trying to patch all dialogues that end in a fight, finishing with Enemy(), so that a spell will be cast after them. Like this:

REPLACE_TEXTUALLY ~Enemy()~ ~Enemy() ApplySpellRES()~

The problem is with dialogues where Enemy() is within the parentheses of ActionOverride. For example, ActionOverride("guard",Enemy()). In these dialogues the second parenthesis will be deleted by my substitution. To Weidu both cases of Enemy() look the same, and I can't give it anything else to make it tell the difference. There may or may not be a space after and before the parentheses, so that doesn't help. If I could somehow make Weidu look only for "Enemy()" as a stand-alone expression! I would be satisfied also with including "END" in the scope of the text, because dialogues that have Enemy() in them usually terminate after this action, so including "END" would cover nearly every case - and I would not need to worry about screwing up ActionOverride. Something like this would be nice:

REPLACE_TEXTUALLY ~Enemy()~ END~ ~Enemy() ApplySpellRES()~ END~

But this doesn't work, because the tildas used in the dialogue are already being engaged by REPLACE_TEXTUALLY. Anybody know how to do the replacement in such a case?

Share this post


Link to post
Quote

But this doesn't work, because the tildas used in the dialogue are already being engaged by REPLACE_TEXTUALLY. Anybody know how to do the replacement in such a case?

from weidu documentation:

String   This is how you tell WeiDU what text you want shown to the player. For international mods or international translations, you may use any encoding you like (that is, you are not restricted to 7-bit characters or Latin-1 or anything like that).
is "abcdef" A string can be any sequence of characters not including a " that is enclosed in ""s.
or ~abcdef~ A string can be any sequence of characters not including a ~ that is enclosed in ~~s.
or %abcdef% A string can be any sequence of characters not including a % that is enclosed in %%s. This is handy for Big5 translations, since " and ~ can be part of Big5-encoded characters.
or ~~~~~abcdef~~~~~ That’s five consecutive tildes on each side. A string can be any sequence of characters not including ~~~~~ that is enclosed in ~~~~~s. For example, string #8750 is ~!@#$\%^&*()_+-=[]{}\|;:'",<.>/? and can be given to WeiDU as ~~~~~~!@#$\%^&*()_+-=[]{}\|;:'",<.>/?~~~~~ (the content of the string is shown in red for clarity).
or String ^ String String literal concatenation. The second string is appended to the first string. No whitespace is added. Thus "hello" ^ "World" is the same as "helloWorld".
Quote

The problem is with dialogues where Enemy() is within the parentheses of ActionOverride. For example, ActionOverride("guard",Enemy()). In these dialogues the second parenthesis will be deleted by my substitution.

you can use REGEXP within REPLACE_TEXTUALLY. Try this to catch both Enemy() and Enemy() enclosed within ActionOverride (that END is not needed):

REPLACE_TEXTUALLY ~Enemy()\()?\)~ ~Enemy()\1 ApplySpellRES(somethinghere)~

 

Edited by K4thos

Share this post


Link to post
On 11/22/2019 at 2:37 AM, K4thos said:

from weidu documentation:

String   This is how you tell WeiDU what text you want shown to the player. For international mods or international translations, you may use any encoding you like (that is, you are not restricted to 7-bit characters or Latin-1 or anything like that).
is "abcdef" A string can be any sequence of characters not including a " that is enclosed in ""s.
or ~abcdef~ A string can be any sequence of characters not including a ~ that is enclosed in ~~s.
or %abcdef% A string can be any sequence of characters not including a % that is enclosed in %%s. This is handy for Big5 translations, since " and ~ can be part of Big5-encoded characters.
or ~~~~~abcdef~~~~~ That’s five consecutive tildes on each side. A string can be any sequence of characters not including ~~~~~ that is enclosed in ~~~~~s. For example, string #8750 is ~!@#$\%^&*()_+-=[]{}\|;:'",<.>/? and can be given to WeiDU as ~~~~~~!@#$\%^&*()_+-=[]{}\|;:'",<.>/?~~~~~ (the content of the string is shown in red for clarity).
or String ^ String String literal concatenation. The second string is appended to the first string. No whitespace is added. Thus "hello" ^ "World" is the same as "helloWorld".

you can use REGEXP within REPLACE_TEXTUALLY. Try this to catch both Enemy() and Enemy() enclosed within ActionOverride (that END is not needed):


REPLACE_TEXTUALLY ~Enemy()\()?\)~ ~Enemy()\1 ApplySpellRES(somethinghere)~

 

Thank you. I found a different solution, but I appreciate it.

Share this post


Link to post
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...