Post reply

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.
Name:
Email:
Subject:
Message icon:

Verification:
Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?:

shortcuts: hit alt+s to submit/post or alt+p to preview


Topic Summary

Posted by: DavidW
« on: May 08, 2022, 03:13:19 PM »

And presumably it shouldn't. In variable-substitution contexts a file is just text. (I substitute comments in and out in various bits of my code.)
Posted by: Wisp
« on: May 07, 2022, 06:14:20 PM »

Variable substitution does not heed comments, no. /* */ works because it ends up containing the expanded new lines, whereas // only comments out the string before %WNL%; whatever comes after ends up on a different line.
Posted by: CamDawg
« on: May 04, 2022, 07:46:08 PM »

However, WeiDU is evaluating %WNL% even if it is commented out. That was causing my error above because I commented out lines of unused code while I was troubleshooting.

Working example:

Code: [Select]
<<<<<<<<./narlen.d
//REPLACE_TRIGGER_TEXT NARLEN ~Global("TalkedToNarlen","GLOBAL",0)\([ %TAB%%WNL%]+!\)~ ~Global("TalkedToNarlen","GLOBAL",0) !InParty([0.0.0.BARD_ALL]) \1~
REPLACE_TRIGGER_TEXT NARLEN ~Global("TalkedToNarlen","GLOBAL",0)\([ %TAB%%WNL%]+!\)~ ~Global("TalkedToNarlen","GLOBAL",0) !InParty([0.0.0.BARD_ALL]) \1~
>>>>>>>>
COMPILE ~./narlen.d~ EVALUATE_BUFFER
Removing the commented code, or wrapping it in /* */ instead works fine.
Posted by: morpheus562
« on: May 04, 2022, 07:43:16 PM »

I have no way to edit my prior message, but big props to Bubb for determining the issue with WeiDU evaluating %WNL% even if it is commented out.
Posted by: morpheus562
« on: May 04, 2022, 07:41:27 PM »

However, WeiDU is evaluating %WNL% even if it is commented out. That was causing my error above because I commented out lines of unused code while I was troubleshooting.
Posted by: CamDawg
« on: May 04, 2022, 07:23:49 PM »

And the solution is decidedly less sexy--compiling with an explicit EVALUATE_BUFFER was needed. I thought AUTO_EVAL_STRINGS was sufficient.
Posted by: CamDawg
« on: May 04, 2022, 07:14:47 PM »

Variable substitution is one of the things we tried that also didn't work.

edit: should also add, ! is absolutely allowed in regexps--it's used without issue throughout BG2FP in both script (via R_T) and d code patches.
Posted by: morpheus562
« on: May 04, 2022, 06:22:42 PM »

Code: [Select]
OUTER_SPRINT monegate ~!~
Code: [Select]
///////////////////////////////////////////////////////////////////////////
// Narlen Darkwalk - BGEE Thieves Guild                             //
///////////////////////////////////////////////////////////////////////////
ACTION_IF GAME_IS ~bgee eet~ BEGIN
  COMPILE EVAL ~skills-and-abilities/dlg/narlenb.d~
END

Code: [Select]
REPLACE_TRIGGER_TEXT NARLEN ~Global("TalkedToNarlen","GLOBAL",0)[ %TAB%%WNL%]*%monegate%~ ~Global("TalkedToNarlen","GLOBAL",0) !InParty([0.0.0.BARD_ALL]) !~
I think I have everything exactly as you stated.
Posted by: Argent77
« on: May 04, 2022, 05:21:48 PM »

The code above worked fine in a quick test mod. Maybe there is something else in your code that interferes with script execution?
Posted by: morpheus562
« on: May 04, 2022, 04:35:17 PM »

That code provides the following error:

[tb#_compile_eval_buffer/skills-and-abilities/dlg/narlenb.d] LEXER ERROR at line 21 column 1-0
Near Text: !
        invalid character [!]
ERROR: parsing [tb#_compile_eval_buffer/skills-and-abilities/dlg/narlenb.d]: Parsing.Parse_error
ERROR: compiling [skills-and-abilities/dlg/narlenb.d]!
Stopping installation because of error.
Stopping installation because of error.
Stopping installation because of error.
Posted by: Argent77
« on: May 04, 2022, 04:09:52 PM »

It looks like exclamation marks are not allowed in regular expressions. You can work around it by using variable substitution.

Add this line to your .tp2 file:
Code: [Select]
OUTER_SPRINT NEGATE ~!~
and add EVAL to the COMPILE action.

Use this .d command to replace the state trigger:
Code: [Select]
REPLACE_TRIGGER_TEXT NARLEN ~Global("TalkedToNarlen","GLOBAL",0)[ %TAB%%WNL%]*%NEGATE%~ ~Global("TalkedToNarlen","GLOBAL",0) !InParty([0.0.0.BARD_ALL]) !~

Edit: Btw, LNL and MNL instances are redundant in regexp character sets, since both codes are already included by WNL. I mention it because I have seen it numerous times in WeiDU code examples.
Posted by: CamDawg
« on: May 04, 2022, 03:36:31 PM »

This came up in the G3 Discord, as part of morpheus562's work on the Skills and Abilities mod.

Essentially, he wants to patch Narlen Darkwalk's dialogue in BGEE to allow monks and bars to take part in the previously thief-only quests. Narlen has two top-level states with these triggers:

Code: [Select]
Global("TalkedToNarlen","GLOBAL",0)
!InParty([0.0.0.THIEF_ALL])

and

Code: [Select]
Global("TalkedToNarlen","GLOBAL",0)
He wants to alter only the first trigger and not the second, so we tried this d code:

Code: [Select]
REPLACE_TRIGGER_TEXT NARLEN ~Global("TalkedToNarlen","GLOBAL",0)[ %TAB%%LNL%%MNL%%WNL%]*!~ ~Global("TalkedToNarlen","GLOBAL",0) !InParty([0.0.0.BARD_ALL]) !~
No matter what we tried, we couldn't get it to positively match the ! at the end. We tried several tricks to try and get it to work, but it only seems to match if you use a . there. Trying this in a COPY_EXISTING > DECOMPILE_AND_PATCH > REPLACE_TEXTUALLY has the same result which makes me suspect there's something going on in the regexp parser.