Author Topic: BUT_ONLY trouble for .dlgs  (Read 11760 times)

Offline Galactygon

  • Modding since 2002
  • Planewalker
  • *****
  • Posts: 374
  • Gender: Male
  • Not an AD&D rules lawyer.
Re: BUT_ONLY trouble for .dlgs
« Reply #50 on: August 19, 2010, 02:02:06 AM »
I copied and pasted it, removed the COPY (as LCLIST_SPELLS.2da was already in the override), and it still refused to work.

I then copied and pasted the COPY in front of it, changed the directory of "TestMod" to "SpellPackB5", and it worked.

I'm 100% sure LCLIST_SPELLS.2da was already in the override, since my earlier code of
Code: [Select]
COPY_EXISTING ~SPPR302.spl~ ~override~
        SPRINT gh "CLERIC_CHANT"
        PATCH_IF (FILE_CONTAINS_EVALUATED (~override/LCLIST_SPELLS.2da~ ~%gh%~)) BEGIN
                PATCH_PRINT "Chanting..."
        END
        PATCH_IF (FILE_CONTAINS_EVALUATED (~override/LCLIST_SPELLS.2da~ ~CLERIC_CHANT~)) BEGIN
                PATCH_PRINT "Chanting..."
        END
        PATCH_IF (FILE_CONTAINS ~override/LCLIST_SPELLS.2da~ ~CLERIC_CHANT~) BEGIN
                PATCH_PRINT "Chanting..."
        END
        BUT_ONLY
worked.

-Galactygon

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: BUT_ONLY trouble for .dlgs
« Reply #51 on: August 19, 2010, 03:11:14 AM »
The code couldn't be more straightforward, and the fact it works for Mike leads me to believe that your LCLIST_SPELLS.2da file doesn't, in fact, contain CLERIC_CHANT.

FILE_CONTAINS accepts only paths to actual files.  If the file doesn't exist, it spits out an error.

With FILE_CONTAINS_EVALUATED,

If you specify a filename:
  1) If the file exists in the main directory (e.g. baldur.ini), check it.
  2) Else if the file exists in the override directory, check it.
  3) Else if the file exists in the game biffs, check it.
  4) Else return 0.

If you specify a path to a file:
  1) If the file exists, check it.
  2) Else return 0.
That's 100% correct.
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline Galactygon

  • Modding since 2002
  • Planewalker
  • *****
  • Posts: 374
  • Gender: Male
  • Not an AD&D rules lawyer.
Re: BUT_ONLY trouble for .dlgs
« Reply #52 on: August 19, 2010, 03:28:50 AM »
The weird thing is, now the same original code works. Whatever.

-Galactygon

Offline cmorgan

  • Planewalker
  • *****
  • Posts: 1424
  • Gender: Male
  • Searcher of Bugs
Re: BUT_ONLY trouble for .dlgs
« Reply #53 on: August 19, 2010, 11:03:00 AM »
And the followup - using a 0 kb text file named "null.wav', the MOVE command, and your code addition, WeiDU successfully cleans up on uninstall. very, very cool.

Offline Galactygon

  • Modding since 2002
  • Planewalker
  • *****
  • Posts: 374
  • Gender: Male
  • Not an AD&D rules lawyer.
Re: BUT_ONLY trouble for .dlgs
« Reply #54 on: August 23, 2010, 03:36:07 AM »
In fact, it's necessary to remove .wav files at uninstall. Because if they aren't, this block will return false at reinstall, and the sounds will not be appended to the .bat file, so the sounds will not be installed at reinstall.

Code: [Select]
  ACTION_IF (NOT FILE_EXISTS ~SpellPackB5/Audio/%sound%.wav~) BEGIN
    COPY ~SpellPackB5/Audio/null.wav~ ~SpellPackB5/Audio/%sound%.wav~
    APPEND_OUTER ~SpellPackB5/Audio/win%AUDIO_INDEX%.bat~ ~oggdec %sound%.ogg~
    APPEND_OUTER ~SpellPackB5/Audio/osx%AUDIO_INDEX%.sh~ ~SpellPackB5/Audio/sox SpellPackB5/Audio/%sound%.ogg SpellPackB5/Audio/%sound%.wav~
            APPEND_OUTER ~SpellPackB5/Audio/lin%AUDIO_INDEX%.sh~ ~oggdec SpellPackB5/Audio/%sound%.ogg~
  END

Testing confirms this.

-Galactygon

Online Mike1072

  • Planewalker
  • *****
  • Posts: 296
  • Gender: Male
Re: BUT_ONLY trouble for .dlgs
« Reply #55 on: August 23, 2010, 02:39:26 PM »
In fact, it's necessary to remove .wav files at uninstall. Because if they aren't, this block will return false at reinstall, and the sounds will not be appended to the .bat file, so the sounds will not be installed at reinstall.

Code: [Select]
  ACTION_IF (NOT FILE_EXISTS ~SpellPackB5/Audio/%sound%.wav~) BEGIN
    COPY ~SpellPackB5/Audio/null.wav~ ~SpellPackB5/Audio/%sound%.wav~
    APPEND_OUTER ~SpellPackB5/Audio/win%AUDIO_INDEX%.bat~ ~oggdec %sound%.ogg~
    APPEND_OUTER ~SpellPackB5/Audio/osx%AUDIO_INDEX%.sh~ ~SpellPackB5/Audio/sox SpellPackB5/Audio/%sound%.ogg SpellPackB5/Audio/%sound%.wav~
            APPEND_OUTER ~SpellPackB5/Audio/lin%AUDIO_INDEX%.sh~ ~oggdec SpellPackB5/Audio/%sound%.ogg~
  END

Testing confirms this.

-Galactygon
I can't reproduce this.  What you're suggesting shouldn't happen, because if the .wav already exists, then yes, the sound won't be appended to the script that converts .ogg to .wav (because it's already in .wav format). However, the sounds that are copied over do not depend on what was converted - every sound you specify that exists as a .wav in the folder should be installed.

Offline Galactygon

  • Modding since 2002
  • Planewalker
  • *****
  • Posts: 374
  • Gender: Male
  • Not an AD&D rules lawyer.
Re: BUT_ONLY trouble for .dlgs
« Reply #56 on: August 24, 2010, 02:38:21 AM »
The script copies a new .bat file at each install, which gets deleted at uninstall, because it's done by WeiDU.
Code: [Select]
COPY ~SpellPackB5/Audio/convert_win.bat~ ~SpellPackB5/Audio/win%AUDIO_INDEX%.bat~

This blank .bat file is then appended if it does not see a .wav file in the audio folder. But since there are leftovers at reinstall, the .bat file does not get appended.

-Galactygon

Online Mike1072

  • Planewalker
  • *****
  • Posts: 296
  • Gender: Male
Re: BUT_ONLY trouble for .dlgs
« Reply #57 on: August 24, 2010, 03:01:41 AM »
The script copies a new .bat file at each install, which gets deleted at uninstall, because it's done by WeiDU.
Code: [Select]
COPY ~SpellPackB5/Audio/convert_win.bat~ ~SpellPackB5/Audio/win%AUDIO_INDEX%.bat~

This blank .bat file is then appended if it does not see a .wav file in the audio folder. But since there are leftovers at reinstall, the .bat file does not get appended.

-Galactygon
Yes... but that's not a problem.  All the .bat does is ensure that there is a .wav version of each sound file in the folder.  If there are .wav versions already in the folder, the .bat doesn't need to do anything.

Once there are .wav versions of all of the sound files, they get installed with this code:
Code: [Select]
ACTION_PHP_EACH ~sounds~ AS ~index~ => ~sound~ BEGIN
  ACTION_IF (NOT FILE_EXISTS_IN_GAME ~%sound%.wav~) BEGIN
    MOVE ~your_mod/Audio/%sound%.wav~ ~override~
  END
END

Offline Galactygon

  • Modding since 2002
  • Planewalker
  • *****
  • Posts: 374
  • Gender: Male
  • Not an AD&D rules lawyer.
Re: BUT_ONLY trouble for .dlgs
« Reply #58 on: August 25, 2010, 05:40:41 AM »
Thanks for pointing out that bit of code Mike, it turned out it had to do with what I was having trouble with; I might have fiddled with the code and got false results. I not only failed my saving throw against intelligence, but suffered a critical hit.

I was trying to override in-game .wav files that did not exist in the override. So then changing this
Code: [Select]
ACTION_PHP_EACH ~sounds~ AS ~index~ => ~sound~ BEGIN
  ACTION_IF (NOT FILE_EXISTS_IN_GAME ~%sound%.wav~) BEGIN
    MOVE ~SpellPackB6/Audio/%sound%.wav~ ~override~
  END
END
into this
Code: [Select]
ACTION_PHP_EACH ~sounds~ AS ~index~ => ~sound~ BEGIN
  ACTION_IF (NOT FILE_EXISTS ~override/%sound%.wav~) BEGIN
    MOVE ~SpellPackB6/Audio/%sound%.wav~ ~override~
  END
END
fixed what I was dealing with. This will still look for duplicates in the override, but will allow existing in-game sounds to be overriden.

-Galactygon

Offline Galactygon

  • Modding since 2002
  • Planewalker
  • *****
  • Posts: 374
  • Gender: Male
  • Not an AD&D rules lawyer.
Re: BUT_ONLY trouble for .dlgs
« Reply #59 on: August 27, 2010, 12:03:05 PM »
I've tried the refractor code, it works fine up until the point when it gets stuck whenever it finds something that it shouldn't patch.

Here is the code (copied and pasted plus a PATCH_PRINT) :
Code: [Select]
PRINT "Patching dialogue files, this will take some time..."
COPY_EXISTING_REGEXP GLOB ~^.+\.dlg$~ ~override~
  PATCH_IF ( SOURCE_SIZE > 0x33 ) BEGIN
  PATCH_PRINT "%SOURCE_FILE%"
  DECOMPILE_DLG_TO_D
    REFACTOR_D_TRIGGER CASE_INSENSITIVE EXACT_MATCH ~StateCheck(Myself,STATE_CHARMED)~ ~OR(2)
    StateCheck(Myself,STATE_CHARMED)
    Global("CHARMED","LOCALS",1)~
  COMPILE_D_TO_DLG
  END
IF ~StateCheck.Myself.STATE_CHARMED~
BUT_ONLY_IF_IT_CHANGES

And I copied this into ALDETH.dlg's Top Level #26 trigger:
Code: [Select]
OR(2)
StateCheck(Myself,STATE_CHARMED)
StateCheck(Myself,STATE_CHARMED)

This causes it to go into an endless loop.

-Galactygon

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: BUT_ONLY trouble for .dlgs
« Reply #60 on: August 27, 2010, 12:30:32 PM »
Can reproduce.
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: BUT_ONLY trouble for .dlgs
« Reply #61 on: August 27, 2010, 01:11:32 PM »
This works:
Code: [Select]
PRINT "Patching dialogue files, this will take some time..."
COPY_EXISTING_REGEXP GLOB ~^.+\.dlg$~ ~override~
  PATCH_IF ( SOURCE_SIZE > 0x33 ) BEGIN
  PATCH_PRINT "%SOURCE_FILE%"
  DECOMPILE_DLG_TO_D
    REFACTOR_D_TRIGGER CASE_INSENSITIVE EXACT_MATCH ~StateCheck(Myself,STATE_CHARMED)~ ~OR(2) StateCheck(Myself,STATE_CHARMED) Global("CHARMED","LOCALS",1)~
  COMPILE_D_TO_DLG
  END
IF ~StateCheck.Myself.STATE_CHARMED~
BUT_ONLY_IF_IT_CHANGES

Next version you won't have to be paranoid about which matter of whitespace you use in REPLACE_D_TRIGGER.
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: BUT_ONLY trouble for .dlgs
« Reply #62 on: August 27, 2010, 01:55:13 PM »
The bug, in fact, was severe enough to warrant uploading a new version post-haste.
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

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:
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)?: