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: the bigg
« on: August 27, 2010, 01:55:13 PM »

The bug, in fact, was severe enough to warrant uploading a new version post-haste.
Posted by: the bigg
« 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.
Posted by: the bigg
« on: August 27, 2010, 12:30:32 PM »

Can reproduce.
Posted by: Galactygon
« 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
Posted by: Galactygon
« 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
Posted by: Mike1072
« 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
Posted by: Galactygon
« 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
Posted by: Mike1072
« 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.
Posted by: Galactygon
« 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
Posted by: cmorgan
« 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.
Posted by: Galactygon
« on: August 19, 2010, 03:28:50 AM »

The weird thing is, now the same original code works. Whatever.

-Galactygon
Posted by: the bigg
« 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.
Posted by: Galactygon
« 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
Posted by: Mike1072
« on: August 19, 2010, 01:28:38 AM »

Code: [Select]
COPY ~TestMod/LCLIST_SPELLS.2da~ ~override~

COPY_EXISTING ~SPPR302.spl~ ~override~
  SPRINT gh "CLERIC_CHANT"
  PATCH_IF (FILE_CONTAINS_EVALUATED (~LCLIST_SPELLS.2da~ ~%gh%~)) BEGIN
    PATCH_PRINT "Chanting..."
  END
  PATCH_IF (FILE_CONTAINS_EVALUATED (~LCLIST_SPELLS.2da~ ~CLERIC_CHANT~)) BEGIN
    PATCH_PRINT "Chanting..."
  END
  BUT_ONLY
It prints out both for me just fine.
Posted by: Galactygon
« on: August 19, 2010, 12:48:55 AM »

Thanks Mike, the directory part was the problem. All 3 of these work:

Quote
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

But now for some more WeiDU wierdness. This does not work.
Code: [Select]
COPY_EXISTING ~SPPR302.spl~ ~override~
        SPRINT gh "CLERIC_CHANT"
        PATCH_IF (FILE_CONTAINS_EVALUATED (~LCLIST_SPELLS.2da~ ~%gh%~)) BEGIN
                PATCH_PRINT "Chanting..."
        END
        PATCH_IF (FILE_CONTAINS_EVALUATED (~LCLIST_SPELLS.2da~ ~CLERIC_CHANT~)) BEGIN
                PATCH_PRINT "Chanting..."
        END

But I had a macro that starts with
Code: [Select]
PATCH_IF (SOURCE_SIZE > 0x71 AND !(FILE_CONTAINS_EVALUATED (~LCLIST_PATCHIGNORE_TELEPORT.2da~ ~%SOURCE_FILE%~)))
which always worked for me.

The_bigg, maybe you could help us out and explain what is happening.

-Galactygon