Jump to content

Can someone help me compile a script?


Recommended Posts

Posted

Hey, I'm looking to edit a compiled script for the mod Crime and Punishment. I have successfully converted the .pex to a .psc and edited the script, but I cannot get the .psc to compile now matter what I try. I was hoping someone could aid me in this process? 

The CK keeps giving me issues saying that the script name is not the same as the file name, but everything seems to be in order. Could it be because the mod itself was packaged into a BA2?

Posted (edited)

Its definitely not because of the BA2, loose files are loaded in priority over BA2 files. That error sounds like the name at the top of the script is different than the name the creation kit is looking for. Look for whatever the script is attached to, and make sure the name of the script in the creation kit is the same as the the 1 at the top of the psc file.

 

Example from my mod.

 

Under a quest named AKTQuest

there's a script named AKTSettingScript.

Then if you open the AKTSettingScript.psc file, the line at the top says. Scriptname AKT_SettingsScript extends Quest

 

It sounds like you may be trying to manually edit and rename a file but you didn't do it through the creation kit, so the creation kit is still looking for the old file.

You have to manually add a script and name it what you want the script name to be, open the file in an editor, and copy paste what you have, change the the scriptname to match what you have in the creation kit now, and i think at that point you won't have that compiling error.

Edited by AKawaiiTent
Posted
38 minutes ago, AKawaiiTent said:

Its definitely not because of the BA2, loose files are loaded in priority over BA2 files. That error sounds like the name at the top of the script is different than the name the creation kit is looking for. Look for whatever the script is attached to, and make sure the name of the script in the creation kit is the same as the the 1 at the top of the psc file.

 

Example from my mod.

 

Under a quest named AKTQuest

there's a script named AKTSettingScript.

Then if you open the AKTSettingScript.psc file, the line at the top says. Scriptname AKT_SettingsScript extends Quest

 

It sounds like you may be trying to manually edit and rename a file but you didn't do it through the creation kit, so the creation kit is still looking for the old file.

You have to manually add a script and name it what you want the script name to be, open the file in an editor, and copy paste what you have, change the the scriptname to match what you have in the creation kit now, and i think at that point you won't have that compiling error.



in order to access the script, i have to unpack the BA2....
so in the creationkit, when I am editing the script, should I repack the BA2? because otherwise I don't believe I can access the script, as it also says it has no source..........

Posted (edited)

Yes, unpack all of the scripts in the BA2 you're editing. Anytime you're doing scripting in creation kit, you should always have unpacked scripts. Including the vanilla scripts.

 

As for repacking, you shouldn't need to repack to compile.

 

Also does the file you're editing have any other script files it requires? The creation kit requires those all to be unpacked too. Example. if you were editing something that requires F4SE it would require the unpacked F4SE scripts to be in your scripts folder too.

 

Your best bet is to just unpack litterly everything in the BA2 for the mod you're trying to edit, and any stuff that mod requires. BA2 files work similair to .zip files in that you can unpack them and still have the original BA2 file as a backup.

 

You should only repack them when you're 100% everything works how you want it to.

Edited by AKawaiiTent
Posted
2 hours ago, AKawaiiTent said:

 

 

Also does the file you're editing have any other script files it requires? The creation kit requires those all to be unpacked too. Example. if you were editing something that requires F4SE it would require the unpacked F4SE scripts to be in your scripts folder too.

 


I'm not sure. Though, now that you mention it, that might be my problem. I might have another script it needs with a similar name. As I'm only editing one line of code in the script, I didn't think I would need anything more than just the psc i was working with. I'll take a look and see what I can do, thanks.

Posted
12 hours ago, RatchetW said:


I'm not sure. Though, now that you mention it, that might be my problem. I might have another script it needs with a similar name. As I'm only editing one line of code in the script, I didn't think I would need anything more than just the psc i was working with. I'll take a look and see what I can do, thanks.

Psc is source code, youneed to compile it to make it work

Posted
19 hours ago, AKawaiiTent said:

Yes, unpack all of the scripts in the BA2 you're editing. Anytime you're doing scripting in creation kit, you should always have unpacked scripts. Including the vanilla scripts.

 

As for repacking, you shouldn't need to repack to compile.

 

Also does the file you're editing have any other script files it requires? The creation kit requires those all to be unpacked too. Example. if you were editing something that requires F4SE it would require the unpacked F4SE scripts to be in your scripts folder too.

 

Your best bet is to just unpack litterly everything in the BA2 for the mod you're trying to edit, and any stuff that mod requires. BA2 files work similair to .zip files in that you can unpack them and still have the original BA2 file as a backup.

 

You should only repack them when you're 100% everything works how you want it to.

 

4 hours ago, Indarello said:

Psc is source code, youneed to compile it to make it work



Right, so I am looking at a bunch of .pex files, and I had to decompile them to edit. Now that I have successfully decompiled and edited the line I want to change, I cannot recompile the .psc back into a .pex

The mod script I am trying to edit only contains compiled .pex files. I don't see any sources with the mod itself, which means I think I have to decompile the scripts I want to edit each time....

Is this why I cannot compile the script correctly? Is missing a source going to interfere with the process? I cannot figure out what the CK is trying to tell me in the error section because everything looks like it should work.....

Posted
18 minutes ago, RatchetW said:

 



Right, so I am looking at a bunch of .pex files, and I had to decompile them to edit. Now that I have successfully decompiled and edited the line I want to change, I cannot recompile the .psc back into a .pex

The mod script I am trying to edit only contains compiled .pex files. I don't see any sources with the mod itself, which means I think I have to decompile the scripts I want to edit each time....

Is this why I cannot compile the script correctly? Is missing a source going to interfere with the process? I cannot figure out what the CK is trying to tell me in the error section because everything looks like it should work.....

Send me file

Posted
10 minutes ago, Indarello said:

Send me file



sure.

Here is the decompiled script without edits. I'm trying to remove instances of captivefaction which I believe is making ALL npcs non-hostile when the item is equipped. If I can remove the player from the faction while equipping the item, i believe aggro will stay the same.

I haven't removed anything from this script yet. But it's not compiling :/

AN_PlayerSolicitScript.psc

Posted

Copyright (C) ZeniMax Media. All rights reserved.
Starting 1 compile threads for 1 files...
Compiling "AN_PlayerSolicitScript.psc"...
D:\Games\Steam Center\steamapps\common\Fallout 4\Data\Scripts\Source\User\AN_PlayerSolicitScript.psc(0,0): filename does not match script name: "advancedneeds:an_playersolicitscript" expected: "AN_PlayerSolicitScript"
No output generated for AN_PlayerSolicitScript.psc, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on AN_PlayerSolicitScript.psc




This is the error I keep getting, but I cannot change the name.

Posted (edited)

So "advancedneeds:an_playersolicitscript" expected: "AN_PlayerSolicitScript"

 

The advancedneeds: part is likely the problem

 

The creation kit can add a mod authors name to the script name, but i dont think you can compile that unless ur editing the esp advancedneeds: in the creaiton kit. Out of curiousity, are you attempting to compile it in the creation kit or using the external compiler?

Edited by AKawaiiTent
Posted
6 hours ago, AKawaiiTent said:

 

 

The creation kit can add a mod authors name to the script name, but i dont think you can compile that unless ur editing the esp advancedneeds: in the creaiton kit. Out of curiousity, are you attempting to compile it in the creation kit or using the external compiler?



I tried to do both, once with an addon with notepad ++ papyrus extension and it kept crashing the application. The other with CK itself and changing the name still gives me errors. 

As for the latter, I don't think/want to change all references of the name to avoid messing up the mod further since I just wanted to change 1 or 2 lines and call it a day ?

Posted
7 hours ago, RatchetW said:



I tried to do both, once with an addon with notepad ++ papyrus extension and it kept crashing the application. The other with CK itself and changing the name still gives me errors. 

As for the latter, I don't think/want to change all references of the name to avoid messing up the mod further since I just wanted to change 1 or 2 lines and call it a day ?

I tried to compile and I have this errors
 

\AdvancedNeeds\AN_PlayerSolicitScript.psc(157,66): OnBegin is not an event on scriptobject or one if its parents
\AdvancedNeeds\AN_PlayerSolicitScript.psc(158,67): OnBegin is not an event on scriptobject or one if its parents
\AdvancedNeeds\AN_PlayerSolicitScript.psc(159,66): OnBegin is not an event on scriptobject or one if its parents
\AdvancedNeeds\AN_PlayerSolicitScript.psc(160,66): OnEnd is not an event on scriptobject or one if its parents
\AdvancedNeeds\AN_PlayerSolicitScript.psc(161,67): OnEnd is not an event on scriptobject or one if its parents
\AdvancedNeeds\AN_PlayerSolicitScript.psc(162,66): OnEnd is not an event on scriptobject or one if its parents
\AdvancedNeeds\AN_PlayerSolicitScript.psc(214,56): OnItemEquipped is not an event on scriptobject or one if its parents
\AdvancedNeeds\AN_PlayerSolicitScript.psc(215,56): OnItemUnequipped is not an event on scriptobject or one if its parents
\AdvancedNeeds\AN_PlayerSolicitScript.psc(278,1): variable advancedneeds:an_karmahandlerscript is undefined
\AdvancedNeeds\AN_PlayerSolicitScript.psc(278,37): none is not a known user-defined script type
\AdvancedNeeds\AN_PlayerSolicitScript.psc(278,49): void is not a known user-defined script type
\AdvancedNeeds\AN_PlayerSolicitScript.psc(285,6): variable advancedneeds:an_karmahandlerscript is undefined
\AdvancedNeeds\AN_PlayerSolicitScript.psc(285,42): none is not a known user-defined script type
\AdvancedNeeds\AN_PlayerSolicitScript.psc(285,54): void is not a known user-defined script type
\AdvancedNeeds\AN_PlayerSolicitScript.psc(297,10): variable advancedneeds:an_playerpregnancyscript is undefined
\AdvancedNeeds\AN_PlayerSolicitScript.psc(297,49): none is not a known user-defined script type
\AdvancedNeeds\AN_PlayerSolicitScript.psc(297,61): void is not a known user-defined script type
\AdvancedNeeds\AN_PlayerSolicitScript.psc(312,7): variable advancedneeds:an_playerpregnancyscript is undefined
\AdvancedNeeds\AN_PlayerSolicitScript.psc(312,46): none is not a known user-defined script type
\AdvancedNeeds\AN_PlayerSolicitScript.psc(312,58): void is not a known user-defined script type
\AdvancedNeeds\AN_PlayerSolicitScript.psc(343,56): OnPlayerLoadGame is not an event on scriptobject or one if its parents
\AdvancedNeeds\AN_PlayerSolicitScript.psc(344,56): OnItemEquipped is not an event on scriptobject or one if its parents
\AdvancedNeeds\AN_PlayerSolicitScript.psc(345,56): OnItemUnequipped is not an event on scriptobject or one if its parents
\AdvancedNeeds\AN_PlayerSolicitScript.psc(357,76): OnEnd is not an event on scriptobject or one if its parents


I guess this script is bugged or requires something else

Posted
16 hours ago, Indarello said:

I tried to compile and I have this errors
 

\AdvancedNeeds\AN_PlayerSolicitScript.psc(157,66): OnBegin is not an event on scriptobject or one if its parents
\AdvancedNeeds\AN_PlayerSolicitScript.psc(158,67): OnBegin is not an event on scriptobject or one if its parents
\AdvancedNeeds\AN_PlayerSolicitScript.psc(159,66): OnBegin is not an event on scriptobject or one if its parents
\AdvancedNeeds\AN_PlayerSolicitScript.psc(160,66): OnEnd is not an event on scriptobject or one if its parents
\AdvancedNeeds\AN_PlayerSolicitScript.psc(161,67): OnEnd is not an event on scriptobject or one if its parents
\AdvancedNeeds\AN_PlayerSolicitScript.psc(162,66): OnEnd is not an event on scriptobject or one if its parents
\AdvancedNeeds\AN_PlayerSolicitScript.psc(214,56): OnItemEquipped is not an event on scriptobject or one if its parents
\AdvancedNeeds\AN_PlayerSolicitScript.psc(215,56): OnItemUnequipped is not an event on scriptobject or one if its parents
\AdvancedNeeds\AN_PlayerSolicitScript.psc(278,1): variable advancedneeds:an_karmahandlerscript is undefined
\AdvancedNeeds\AN_PlayerSolicitScript.psc(278,37): none is not a known user-defined script type
\AdvancedNeeds\AN_PlayerSolicitScript.psc(278,49): void is not a known user-defined script type
\AdvancedNeeds\AN_PlayerSolicitScript.psc(285,6): variable advancedneeds:an_karmahandlerscript is undefined
\AdvancedNeeds\AN_PlayerSolicitScript.psc(285,42): none is not a known user-defined script type
\AdvancedNeeds\AN_PlayerSolicitScript.psc(285,54): void is not a known user-defined script type
\AdvancedNeeds\AN_PlayerSolicitScript.psc(297,10): variable advancedneeds:an_playerpregnancyscript is undefined
\AdvancedNeeds\AN_PlayerSolicitScript.psc(297,49): none is not a known user-defined script type
\AdvancedNeeds\AN_PlayerSolicitScript.psc(297,61): void is not a known user-defined script type
\AdvancedNeeds\AN_PlayerSolicitScript.psc(312,7): variable advancedneeds:an_playerpregnancyscript is undefined
\AdvancedNeeds\AN_PlayerSolicitScript.psc(312,46): none is not a known user-defined script type
\AdvancedNeeds\AN_PlayerSolicitScript.psc(312,58): void is not a known user-defined script type
\AdvancedNeeds\AN_PlayerSolicitScript.psc(343,56): OnPlayerLoadGame is not an event on scriptobject or one if its parents
\AdvancedNeeds\AN_PlayerSolicitScript.psc(344,56): OnItemEquipped is not an event on scriptobject or one if its parents
\AdvancedNeeds\AN_PlayerSolicitScript.psc(345,56): OnItemUnequipped is not an event on scriptobject or one if its parents
\AdvancedNeeds\AN_PlayerSolicitScript.psc(357,76): OnEnd is not an event on scriptobject or one if its parents


I guess this script is bugged or requires something else


i get the same errors. I think it requires something else...

does this mean i need to decompile all the .pex files in this mod since it came with no sources?

 

Posted
15 hours ago, RatchetW said:


i get the same errors. I think it requires something else...

does this mean i need to decompile all the .pex files in this mod since it came with no sources?

 

You can try

Posted
On 8/14/2022 at 5:22 PM, RatchetW said:


i get the same errors. I think it requires something else...

does this mean i need to decompile all the .pex files in this mod since it came with no sources?

 

 

dumb question, but have you unpacked all of the vanilla source script files? cuz a lot of those errors are vanilla scripts like OnItemEquip is a vanilla event for object refrences.

Posted
15 hours ago, AKawaiiTent said:

 

dumb question, but have you unpacked all of the vanilla source script files? cuz a lot of those errors are vanilla scripts like OnItemEquip is a vanilla event for object refrences.



Yes I have, I'm still working on the issue. I think it might be something related to not converting all .pex files within the mod i'm editing the original script (Crime and Punishment) but I'm still having trouble. 

I believe if I had the CK recognize source files from decompiling OR if I had the authors source files I could edit this successfully myself but I can't get either.

  • 3 months later...
Posted (edited)

Did you ever figure this out?

 

The colon prefixed name is part of a "namespace" mechanism.

 

Turns out the problem is that when colons are used for the ScriptName, you can compile in the CK but might not easily be able compile via the command line.

It's documented briefly at https://www.creationkit.com/fallout4/index.php?title=Papyrus_FAQs#When_I_try_to_compile_namespaced_scripts_outside_the_Creation_Kit.2C_my_scripts_always_fail_to_compile._Help.21

 

I did find that at least one script that would not compile from the command line did compile via the CK.   If you're using MO2, launch the CK from MO2 and make sure sources are in a directory structure of .../mods/My-Mod-Name/Scripts/Source/User/My-NameSpace/My-Script.psc

 

See also some discussion where I asked about a similar problem in the [FO4 CK] General Help thread where vaultbait was able to compile a namespaced script outside the CK.

 

Edited by MikeWander
  • 2 weeks later...
Posted

You need all of the base scripts available, and ALL of the scripts from the mod you are recompiling, and all of the source scripts for mods it depends on. The directory structure has to be exactly the same as well. The 'source' flag on the compiler line has to contain every directory and sub directory being used. It will not traverse directories for source files, unless they're explicitly stated.

 

I recompiled for one line in Deviously Cursed Wasteland, and had to build up the entire structure and 'source' structure for a Devious Devices as well.

 

Also, anything with a structure, doesn't decompile properly. If you decompile and see # everywhere, that's the structs breaking.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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