-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCompile.bat
More file actions
97 lines (80 loc) · 2.83 KB
/
Copy pathCompile.bat
File metadata and controls
97 lines (80 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
@echo off
setlocal EnableDelayedExpansion
set SKYRIM_FOLDER=
:: [Compile.bat] - Compile Papyrus scripts!
:: Requires Creation Kit to be installed
set SCRIPTS_FOLDER=Scripts\Source\
set OUTPUT_FOLDER=Scripts
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Compile.bat script code below
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: For newlines in PowerShell commands
(set \n=^
%=Do not remove this line=%
)
if "%SKYRIM_FOLDER%" == "" (
set ERROR_MSG=^[ERROR] Skyim Folder not configured.
set ERROR_MSG=^!ERROR_MSG!`n`nPlease run Setup.bat
goto :error_msg
)
:: Check for pyro.exe
where /q pyro
if %ERRORLEVEL% == 0 (
echo ^[FOUND] pyro
echo ^[SEARCH] .ppj Papyrus Project Files
if exist *.ppj (
echo ^[COMPILE] Compiling project using pyro
for /r %%a in (*.ppj) do echo^ [FOUND] "%%a"
for /r %%a in (*.ppj) do pyro -i "%%a"
goto :done
) else (
echo ^[NOT FOUND] No .ppj Papuyrus Project Files found
echo ^[INFO] Falling back to PapyrusCompiler.exe...
)
) else (
echo ^[NOT FOUND] pyro
echo ^[INFO] Falling back to PapyrusCompiler.exe...
)
:: Check for PapyrusCompiler.exe
where /q PapyrusCompiler
if %ERRORLEVEL% == 0 (
echo ^[FOUND] PapyrusCompiler.exe
)
if not exist "%SKYRIM_FOLDER%" (
echo ^[NOT FOUND] Skyrim Folder "%SKYRIM_FOLDER%"
set ERROR_MSG=^[ERROR] Could not find Skyrim folder
set ERROR_MSG=^!ERROR_MSG!`n`nExpected path:
set ERROR_MSG=^!ERROR_MSG!`n"%SKYRIM_FOLDER%"
goto :error_msg
)
echo ^[SEARCH] PapyrusCompiler.exe
set PAPYRUS_COMPILER=%SKYRIM_FOLDER%\Papyrus Compiler\PapyrusCompiler.exe
if exist "%PAPYRUS_COMPILER%" (
echo ^[FOUND] PapyrusCompiler.exe "%PAPYRUS_COMPILER%"
) else (
echo ^[NOT FOUND] PapyrusCompiler.exe
set ERROR_MSG=^[ERROR] Could not find Papyrus compiler
set ERROR_MSG=^!ERROR_MSG!`n`nExpected path:
set ERROR_MSG=^!ERROR_MSG!`n"%PAPYRUS_COMPILER%"
goto :error_msg
)
set COMPILER_INCLUDES=Scripts\Source
if exist "%SKYRIM_FOLDER%\Data\Scripts\Source" (
set COMPILER_INCLUDES=%COMPILER_INCLUDES%;%SKYRIM_FOLDER%\Data\Scripts\Source
)
if exist "%SKYRIM_FOLDER%\Data\Source\Scripts" (
set COMPILER_INCLUDES=%COMPILER_INCLUDES%;%SKYRIM_FOLDER%\Data\Source\Scripts
)
echo.
echo ^[COMPILE] Compiling project using PapyrusCompiler.exe
echo ^"%PAPYRUS_COMPILER%" %SCRIPTS_FOLDER% -all -f=TESV_Papyrus_Flags.flg -o=%OUTPUT_FOLDER% -i="%COMPILER_INCLUDES%"
echo.
"%PAPYRUS_COMPILER%" %SCRIPTS_FOLDER% -all -f=TESV_Papyrus_Flags.flg -o=%OUTPUT_FOLDER% -i="%COMPILER_INCLUDES%"
echo ^Done!
goto :done
:error_msg
powershell -c "Add-Type -Assembly System.Windows.Forms; $result = [System.Windows.Forms.MessageBox]::Show(@\"!\n!!ERROR_MSG!!\n!\"@).ToString(); ''"
:error
echo ^[ERROR] Exiting...
exit /b 1
:done