Jump to content

Compiling papyrus in namespaces


Recommended Posts

One of the requirements to use relative paths is running the compiler from Source\User folder, as the "current path". Otherwise the file is relative to whatever folder you are running from and obvioulsy you'll get a malformed path.

But given the results of your test it seems that is also required to run the compiler from inside of the game folder, or said with other words, the "current path" must be under the game's directory tree, which is fortunatelly fulfilled by using relative paths.

 

I've been using my script to compile with namespaces, even with multiple inner name spaces, and it works just fine. So I don't really know what makes it bug out for others tbh, but I guess the location of the script might have something to do.

I have the script located at the same folder than the compiler, and my setup is vanilla. I mean I compile with my script with the same DLC folder structure needed to compile with the CK's editor.

 

So, in short, I think that the compiler's success is very dependant on the run path and the batch script path.

Link to comment
Share on other sites

OK I have this figured out for Notepad++ macros.

 

Usually Notepad++ is configured to pass "$(FILE_NAME)" as %1 and "$(CURRENT_DIRECTORY)" as %2 to the compiler batchfile:

 

**********************************************
Papyrus debug compile
Command : (%0) "C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Papyrus Compiler\ScriptCompile.bat"
FileName: (%1) "DLC01_MechanistDoorScript.psc"
FilePath: (%2) "C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\DLC01"
**********************************************
One could parse out the quotes and concatinate path and name "%2\%1", or simply edit Notepad++ shortcuts to pass the full file path "$(FULL_CURRENT_PATH)"
**********************************************
Papyrus debug compile
Command : (%0) "C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Papyrus Compiler\ScriptCompile.bat"
FileName: (%1) "DLC01_MechanistDoorScript.psc"
FilePath: (%2) "C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\DLC01"
FullPath: (%3) "C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\DLC01\DLC01_MechanistDoorScript.psc"
**********************************************
Running the papyrus compiler against %3 full path now works perfectly for normal and namespace files.
Notepad++ has set the current working directory $(CURRENT_DIRECTORY)" to the source file which works fine, no changes required in the compiler batch file. Infact changing that causes the compile to fail.

 

shortcuts.xml

 

<NotepadPlus>
    <InternalCommands />
    <Macros>
        <Macro name="Trim Trailing Space and Save" Ctrl="no" Alt="yes" Shift="yes" Key="83">
            <Action type="2" message="0" wParam="42024" lParam="0" sParam="" />
            <Action type="2" message="0" wParam="41006" lParam="0" sParam="" />
        </Macro>
    </Macros>
    <UserDefinedCommands>
        <Command name="Papyrus Compile Debug" Ctrl="no" Alt="no" Shift="no" Key="0">"C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Papyrus Compiler\ScriptCompile.bat" "$(FILE_NAME)" "$(CURRENT_DIRECTORY)" "$(FULL_CURRENT_PATH)"</Command>
        <Command name="Papyrus Compile Release" Ctrl="no" Alt="no" Shift="no" Key="0">"C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Papyrus Compiler\ScriptCompileReleaseFinal.bat" "$(FILE_NAME)" "$(CURRENT_DIRECTORY)" "$(FULL_CURRENT_PATH)"</Command>
    </UserDefinedCommands>
    <PluginCommands />
    <ScintillaKeys />
</NotepadPlus>

 

 

 

ScriptCompile.bat

 

 


@echo off
cls
echo ********************************************** 
echo Papyrus debug compile
echo Compiler:  %0
echo FileName:  %1
echo FilePath:  %2
echo FullPath:  %3
echo ********************************************** 
echo.

set FLAGS=C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\Base\Institute_Papyrus_Flags.flg

set COMPILERPATH=C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Papyrus Compiler

set IMPORT1=C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User
set IMPORT2=C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\Base

set OUTPUT=C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts

"%COMPILERPATH%\PapyrusCompiler.exe" %3 -f="%FLAGS%" -i="%IMPORT1%;%IMPORT2%" -o="%OUTPUT%"

:END
pause

 

 

 

I appreciate all the help, pointers and ideas on this one.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...