Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- REM Save this code as C:\Fallout 4\Papyrus Compiler\ScriptCompileCustom.bat
- REM In notepad++ click on "Execute..." and paste this command; "C:\Fallout 4\Papyrus Compiler\ScriptCompileCustom.bat" "$(FILE_NAME)" "$(CURRENT_DIRECTORY)"
- REM and save it with your preferred key combo, then you can use your combo to start the compilation
- setlocal EnableDelayedExpansion
- REM Find out the base path for fallout 4, which is the parent folder
- for %%I in ("%~dp0\..") do set "BasePath=%%~fI"
- REM Find out the partition, windows needs to change to the partition before changing the directory
- for /F "tokens=1 delims=\" %%a in ("%BasePath%") do set Partition=%%a
- REM Stores the full path to the source script
- set Path_to_convert=%2
- REM remove quotes
- set Path_to_convert=%Path_to_convert:"=%
- REM Stores the full path for user scripts
- set Reference_path=%BasePath%\Data\Scripts\Source\User
- REM Change to the Fallout 4 partition
- %Partition%
- REM change directory to the scripts source folder
- cd "!Reference_path!"
- REM If the script folder is the base folder then pass the script name only, otherwise pass the relative path to the source script
- If !Path_to_convert! == !Reference_path! (
- REM call the compiler using the name of the script since it is in the root of the User folder
- "%BasePath%\Papyrus compiler\PapyrusCompiler.exe" %1 -f="Institute_Papyrus_Flags.flg" -i="%BasePath%\Data\Scripts\Source\Base" -o="%BasePath%\Data\Scripts"
- ) ELSE (
- REM Gets the relative path of the current script folder
- set RelativePath=!Path_to_convert:*%Reference_path%\=!
- REM remove quotes
- set RelativePath=!RelativePath:"=!
- REM store the file name
- set file=%1
- REM Remove quotes
- set file=!file:"=!
- REM stores the relative path to the script
- set RelativePath="!RelativePath!\!file!"
- REM call the compiler using the relative path of the script
- "%BasePath%\Papyrus compiler\PapyrusCompiler.exe" !RelativePath! -f="Institute_Papyrus_Flags.flg" -i="%BasePath%\Data\scripts\Source\Base" -o="%BasePath%\Data\scripts"
- )
- REM shows "Press any key to continue..."
- pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement