Orvid / Champollion

A PEX to Papyrus Decompiler for Skyrim, Fallout 4 and Starfield
GNU Lesser General Public License v3.0
106 stars 20 forks source link

Skyrim event functions, named events, instead of function. Causing Papyrus Compiler to not compile it. #6

Closed Michael-wigontherun closed 1 year ago

Michael-wigontherun commented 1 year ago

What this decompiles FISSFactory into:


;-- Functions ---------------------------------------

FISSInterface Function getFISS() Global
  Return Game.GetFormFromFile(4804, "fiss.esp") as FISSInterface
EndFunction

; Skipped compiler generated GetState

Event onEndState()
{ Event received when this state is switched away from }
  ; Empty function
EndEvent

; Skipped compiler generated GotoState

Event onBeginState()
{ Event received when this state is switched to }
  ; Empty function
EndEvent

What the original Champollion decompiles into:

scriptName fissfactory

;-- Properties --------------------------------------

;-- Variables ---------------------------------------

;-- Functions ---------------------------------------

FISSInterface function getFISS() global

    return game.GetFormFromFile(2048, "FISS.esp") as FISSInterface
endFunction

; Skipped compiler generated GotoState

function onBeginState()
{Event received when this state is switched to}

    ; Empty function
endFunction

; Skipped compiler generated GetState

function onEndState()
{Event received when this state is switched away from}

    ; Empty function
endFunction

The original Champollion decompiles it into its original source code, minus comments. the capitalization isn't a problem. I have a long command line for Papyrus Compiler because its automated in ESLify Everything.

C:\Steam\steamapps\common\Skyrim Special Edition\Papyrus Compiler>PapyrusCompiler.exe "C:\Modding\SkyrimSE\ESLifyEveryth
ing\ESLifyEverything\bin\Personal\net6.0\ChangedScripts" -q -f="TESV_Papyrus_Flags.flg" -a -i="C:\Modding\SkyrimSE\ESLif
yEverything\ESLifyEverything\bin\Personal\net6.0\ExtractedBSAModData\Source\Scripts" -o="E:\SkyrimMods\MO2\mods\ESLify E
verything\Scripts"
C:\Modding\SkyrimSE\ESLifyEverything\ESLifyEverything\bin\Personal\net6.0\ExtractedBSAModData\Source\Scripts\fissfactory
.psc(14,0): no viable alternative at input 'EndEvent'
C:\Modding\SkyrimSE\ESLifyEverything\ESLifyEverything\bin\Personal\net6.0\ExtractedBSAModData\Source\Scripts\fissfactory
.psc(21,0): no viable alternative at input 'EndEvent'
No output generated for fissfactory.psc, compilation failed.

Changing "Event" and "EndEvent" to "Function" and "EndFunction" fixes the issue but its necessary in all of the scripts

Skyrim just uses the function identifier instead of Event for events.

I am hoping to switch ESLify Everything to using this instead of the original Champollion.

nikitalita commented 1 year ago

I can't reproduce the compiler errors you're getting here.

We may be using different compilers, or there's something about your setup that's causing this. Can you ping me on the Skyrim Mods discord so we can diagnose this further? @nikitalita