Jump to content

[LE] Decompilion with Champollion


szaumoor

Recommended Posts

So I decompiled some .pex files from a mod and I think the decompiler marks "events" in the original code as "functions" in the decompiled code. So, can this break things completely if I recompile it and use it like that?

 

I know nothing about papyrus, so I need some help. I don't want to be breaking things.

 

Link to comment
Share on other sites

I would have thought that EVENT and FUNCTION were different functions, as it were, but it's been a while.

 

Also, you should still have the original *.pex files, even if you decompiled them to *.pcm.

 

Scripts are usually stored in ...\Skyrim\Data\Scripts

 

and uncompiled scripts, if included with mods, in ...\Skyrim\Data\Scripts\Source

 

Assuming they are not in a *.bsa.

 

 

All I know for a fact is, whatever you end up doing, always keep a completely unmodified copy of the mod safe in it's own folder so you can go back to it.

 

And also have a set of saved games which have never seen the mod that you can use for testing.

 

It's also a good idea to keep incremental copies after you've made some changes.

 

I've subbed to this thread, as I am also interested in the answer.

 

 

Good Luck

 

:smile:

Link to comment
Share on other sites

The PSC files created by decompiling a PEX with Champollion are completely safe to use. As far as papyrus is concerned there is no difference between an event and a function. The difference is to make things easier on code writers.

 

For your information:

Functions are complete blocks of code

Event is used by coders to reference those functions that are triggered by the game engine.

Fragments are "special" or "hybrid" functions if you will. They are created by the Creation Kit using entered code and are triggered by the game engine.

 

There is no difference between the following as far as Papyrus is concerned:

Event OnActivate(ObjectReference akActivator)
EndEvent

and

Function OnActivate(ObjectReference akActivator)
EndFunction
Link to comment
Share on other sites

Hey IsharaMeradin, I think that there may be a difference, but I'm not sure and it definitely needs some testing that I hope I don't forget to do it once I get home.


I was wondering if this:



Event OnActivate(ObjectReference akActivator)
EndEvent



can be access externally like this one



Function OnActivate(ObjectReference akActivator)
EndFunction



by this line calling on a 'Function' inside another ref



(....... as ........).OnActivate()




I hope i'm making myself clear, if no, then sorry... I literally just woke up and was the first thing that came to my mind.

Edited by maxarturo
Link to comment
Share on other sites

Events can be treated just like functions as well. I believe I have seen some mod scripts force an OnInit or OnUpdate to run again for a specific reason by calling them directly. You could probably do the same with OnActivate but not sure why one would with that particular event. Especially, since Activate already exists and OnActivate should run after Activate unless BlockActivation was used.

 

I, personally, wouldn't call an event like a function unless I absolutely had to. I'd rather create a function that the event and whatever else both call. But the answer to the original question still stands. The compiler converts both events and functions into the same type of thing in the PEX file. That is why the de-compiler cannot differentiate between event or function and thus gives everything the function label instead. And so, it is perfectly fine to take Champollion's resultant PSC, modify it and re-compile it all while leaving the function labels as-is.

Link to comment
Share on other sites

I agree with you on the part "wouldn't call an event like a function unless I absolutely had to", but I wonder if through Papyrus you can call from an external ref an 'Event' like you can with a 'Function'.

I guess the only way to solve this conundrum is by testing it. Well, I'll home in 14 days and if I haven't forgoten about it I'll test this and report the result.

* I can think a couple of occasions that I could have use this, if it actually works.

Link to comment
Share on other sites

It can be handy for events that arent otherwise used unless registered. Example is the SKSE call OnMenuOpen("Whatever") will work on any Form/Alias/AME script. The relayed string can be an Int like a FormEx Hex that can be resolved on the other end. It need not have anything to do with menus at all, and can be useful

 

OnGainLOS is another nice one since you can relay an actor and objectreference. Etc

Link to comment
Share on other sites

  • Recently Browsing   0 members

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