Jump to content

[LE] Papyrus Util scripting help


Recommended Posts

Hello there! I am new to this forum and skyrim scripting itself and just was funning around to get some stuff work. So, lets come to my issue
I was trying to use MiscUtil.WriteToFile() method and for some odd reason this method is not creating any file. I dont see any errors during compiling and i'm sure that papyrus util is installed.
There is a code:

Scriptname coolDebug extends Quest Hidden 

Event OnInit()
    Debug.Notification("OnInit() called")
    MiscUtil.WriteToFile("CoolDebug.txt", "Debug")
EndEvent 

Also want to mention that "OnInit() called" notification comes on loading the save game. Its all information i can provide. Thanks in advance!

Edited by RockeyWerewolf
Link to comment
Share on other sites

Looks like that should be working. Make sure you're looking in the right folder for the file. I don't remember where the default folder is for WriteToFile, but It's either the Skyrim root folder or the Data folder. If you can't find it, try first creating an empty CoolDebug.txt file first before running the code and see if that helps.

Link to comment
Share on other sites

Looks like that should be working. Make sure you're looking in the right folder for the file. I don't remember where the default folder is for WriteToFile, but It's either the Skyrim root folder or the Data folder. If you can't find it, try first creating an empty CoolDebug.txt file first before running the code and see if that helps.

Thanks for your response, but unfortunately creating file by mysef both in Skyrim root and Data doesn't help. Is there a way to debug if the function is running or some error has occurred?

In general, initially I tried to read something from an already created file using the ReadFromFile function, but also to no avail. This idea of trying to write a file came about as a test to see if any function from MiscUtil works.

I also had an idea that maybe the game doesn't have file management permissions, but the game is running as administrator so that's probably not an option either.

And do you know any other community where i can get help? Forums, Discord servers, idk.

Edited by RockeyWerewolf
Link to comment
Share on other sites

No problem. I do know that miscUtil.writetofile does work, as I've used it in some of my mods. Off the top of my head, My mod MCM Creator comes to mind:

 

https://www.nexusmods.com/skyrimspecialedition/mods/45647

 

Source code is provided.

 

If your script is compiling it should work. Make sure you also have all requirements installed as well. SKSE and Address Library if you're working with Skyrim Special Edition.

Link to comment
Share on other sites

No problem. I do know that miscUtil.writetofile does work, as I've used it in some of my mods. Off the top of my head, My mod MCM Creator comes to mind:

 

https://www.nexusmods.com/skyrimspecialedition/mods/45647

 

Source code is provided.

 

If your script is compiling it should work. Make sure you also have all requirements installed as well. SKSE and Address Library if you're working with Skyrim Special Edition.

Thank you! I found where my problem was. I was using versions of Adress Library and Papyrus Util for AE, not for SE....

Link to comment
Share on other sites

No worries, glad you found the problem!

Hi again, do you know of any way to find out what an object is from a form id? I mean is it an item, just an object or an NPC(e.g cheese, chair, werewolf)? I really don't know how to explain this more clearly, I hope you get my question.

Edited by RockeyWerewolf
Link to comment
Share on other sites

If you need to resolve the form, aka you only have the ID for whatever reason, you can call GetFormEx

 

Once you have a Form, run a GetType() call to determine what it is

Form Something = Game.GetFormEx(TheProvidedFormID)
Int Kind = Something.GetType()
Bool ItsARef = Kind == 61; 62 is also a ref, but just actor, and always is 43 Base Type
If ItsARef
 Int DNA = (Something as ObjectReference).GetBaseObject().GetFormID()
 Bool ItsAnActivator = DNA == 24
 Bool ItsAMiscObject = !ItsAnActivator && DNA == 32
 ; Etc
EndIf

Above is just native SKSE capabilities. There might be something more steamlined available from PUtil to do it too

Link to comment
Share on other sites

  • Recently Browsing   0 members

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