Jump to content

Recommended Posts

Uhm, sorry, I've some noobish question about it:

I'm very intrested in this because It could greatly improve the function in my mod, save resources, and allow compatibility/comunications without dependance, but sice I'm a noob in scripting, I want to be sure to not have misunderstood before make a mess

 

1. If I try to recover a stored data that has not been declared, the return value would be like a simple empty declaration? Like "" for strings, False for bool etc? Or there's a risk to mess things up? Just to know If I must take some particular cautions or not

 

2. I've noticed that PapyrusUtil is included in the SL Framework package... So this is a secondary download only for this? Like " 'Simple' storage Mod Pluging for Skse"?

 

3. Any cautions that I should use?

 

I've read as I could, but 18 page in english are a bit tricky for me... sorry if some of this are already been Asked/Answered

 

By the way: Tnx a lot :) So far that storage system could save my life :P

Link to comment

Tnx for the answer :)

 

Anyway I've stepped in the save/load bug only adding a single string XD

 

 

EDIT :

 

Testing around (2.8) I've stepped in something, about the Save/Load crash.

 

It happend to me if I set a variable empty, then the game crash also in other load.

 

What I do:

 

1. added a StorageUtil.SetStringValue(Pet, "Value", StringArg), The StringArg was empty

2. load a game, made a save (aka Save A)

3.Close the game

4.Re-open and loaded another save (aka Save B )-> Crash

5.Re-open and loaded the first save (Save A) -> Crash

 

Afther this I've made a condition that avoid to save an empty string, and all started to work without problem (load A, load B, etc.)

 

Hope it help

 

Link to comment

Tnx for the answer :)

 

Anyway I've stepped in the save/load bug only adding a single string XD

 

 

EDIT :

 

Testing around (2.8) I've stepped in something, about the Save/Load crash.

 

It happend to me if I set a variable empty, then the game crash also in other load.

 

What I do:

 

1. added a StorageUtil.SetStringValue(Pet, "Value", StringArg), The StringArg was empty

2. load a game, made a save (aka Save A)

3.Close the game

4.Re-open and loaded another save (aka Save B )-> Crash

5.Re-open and loaded the first save (Save A) -> Crash

 

Afther this I've made a condition that avoid to save an empty string, and all started to work without problem (load A, load B, etc.)

 

Hope it help

 

Pretty sure I know why and could see how that would cause an error with the serialization, I'll update the SetValue() functions to check for empty values/zeroes, and if they are divert the function to UnsetValue() instead. That should fix it.

Link to comment

That might cause another problem if someone uses "HasValue" on a string to check if their mod has initialized.

 

 

Seems an unlikely scenario to me, and if it does exist then it's an easy problem to track down and correct on their part. At this point anybody this change would affect, it would affect them only by making their existing code functional rather than producing a CTD.

 

 

Cleaning up after the people setting variables to zero/empty/none seems more beneficial to me than accommodating people relying on HasValue to determine important functionality.

Link to comment

Pretty sure I know why and could see how that would cause an error with the serialization, I'll update the SetValue() functions to check for empty values/zeroes, and if they are divert the function to UnsetValue() instead. That should fix it.

What does that mean exactly? Do HasIntValue, HasFloatValue are still working when they have a value of 0?

 

Besides that, a bug report: PayprusUtil.StringArray doesn't work, it returns an array of zero elements. I haven't tested it out, but it might apply to all other dynamic array sizing functions (PapyrusUtil 3.0b, works in PapyrusUtil 2.8).

 

Also what is Slice exactly doing? Taking the portion of the StorageUtil and delete the sliced values or are they still intact?

Link to comment

I need Json slice for my Maria Eden mod - but I think something in Json Utils leads to crashes during game saves.

I do this 3 seconds after MainQuest OnInit

if JsonUtil.Load("maria")
	Form[] c = new Form[15]
	int i = clothes_key.Length ; array with string keys
	while i
		i-=1
		Form[] clothes = GetClothes(i) ; returns a property form array (15 none elements)
		ClearFormList(c) ; fills local array with none
		JsonUtil.FormListSlice("maria",clothes_key[i],c)
		CopyFormList(c,clothes) ; copy all not-none forms into property form array
	endwhile
else
	Trace("failed to load clothes")
endif

And I save the values like this

Form[] clothes = GetClothes(type) ; returns property form array
if clothes != none
	; copies all Forms without any BDSM keyword into the array 
	CopyClothesToFormListFiltered(PlayerRef,clothes,MariaEdensBDSMKeywords)
	string k = clothes_key[type] ; array with keywords
	JsonUtil.FormListClear("maria",k)
	JsonUtil.FormListCopy("maria",k,clothes)
	JsonUtil.Save("maria")
endif
Link to comment

 

I need Json slice for my Maria Eden mod - but I think something in Json Utils leads to crashes during game saves.

I do this 3 seconds after MainQuest OnInit

if JsonUtil.Load("maria")
	Form[] c = new Form[15]
	int i = clothes_key.Length ; array with string keys
	while i
		i-=1
		Form[] clothes = GetClothes(i) ; returns a property form array (15 none elements)
		ClearFormList(c) ; fills local array with none
		JsonUtil.FormListSlice("maria",clothes_key[i],c)
		CopyFormList(c,clothes) ; copy all not-none forms into property form array
	endwhile
else
	Trace("failed to load clothes")
endif

And I save the values like this

Form[] clothes = GetClothes(type) ; returns property form array
if clothes != none
	; copies all Forms without any BDSM keyword into the array 
	CopyClothesToFormListFiltered(PlayerRef,clothes,MariaEdensBDSMKeywords)
	string k = clothes_key[type] ; array with keywords
	JsonUtil.FormListClear("maria",k)
	JsonUtil.FormListCopy("maria",k,clothes)
	JsonUtil.Save("maria")
endif

 

 

Can't see a clear picture of what you're doing without seeing more of the scripts. But check your regular papyrus debug log for errors and the papyrusutildev.log in the main skyrim folder for errors.

 

And are you using 2.8, or the beta version I uploaded a few posts ago?

Link to comment

 

Pretty sure I know why and could see how that would cause an error with the serialization, I'll update the SetValue() functions to check for empty values/zeroes, and if they are divert the function to UnsetValue() instead. That should fix it.

What does that mean exactly? Do HasIntValue, HasFloatValue are still working when they have a value of 0?

 

HasValue() would no longer function if they are set to a 0 yes. I'm probably going to backpedal on that change however.

 

Besides that, a bug report: PayprusUtil.StringArray doesn't work, it returns an array of zero elements. I haven't tested it out, but it might apply to all other dynamic array sizing functions (PapyrusUtil 3.0b, works in PapyrusUtil 2.8).

It works fine for me in all test, only issue I've noticed is FormArray and AliasArray creates arrays that won't let elements be set, try to set any of it's indexes with the appropriate type produces an error in the debug log that types don't match. I'm assuming I'm missing some updated file from the upcoming SKSE update that fixes this, I was only given the new PapyrusArgs file with the VMResultArray template.

 

The non-beta version of PapyrusUtil 3.0 won't have the Int/Float/String/Form/AlilasArray() functions in anycase, since SKSE will have those in their own script. They are just there now so I can continue developing with them in mind.

 

Also what is Slice exactly doing? Taking the portion of the StorageUtil and delete the sliced values or are they still intact?

The original lists are left intact, slice just return a portion of.

 

 

Getting the values of a list from index 4-8:

int[] Slice = new int[4]
int i = 4
while i < 9
	Slice[i] = StorageUtil.IntListGet(Obj, "Key", i) 
	i += 1
endWhile

would be equivalent to:

int[] Slice = new int[4]
StorageUtil.IntListSlice(Obj, "Key", Slice, 4) 

ListSlice() will continue to fill the given array with the lists values until either the array, or the list runs out of values from the starting index.

Link to comment

 

 

...

 

Can't see a clear picture of what you're doing without seeing more of the scripts. But check your regular papyrus debug log for errors and the papyrusutildev.log in the main skyrim folder for errors.

 

And are you using 2.8, or the beta version I uploaded a few posts ago?

Can I use the new version without breaking sexlab or other mods that depends on PapyrusUtils?

Link to comment

 

 

 

...

 

Can't see a clear picture of what you're doing without seeing more of the scripts. But check your regular papyrus debug log for errors and the papyrusutildev.log in the main skyrim folder for errors.

 

And are you using 2.8, or the beta version I uploaded a few posts ago?

Can I use the new version without breaking sexlab or other mods that depends on PapyrusUtils?

 

 

New version doesn't break anything that I'm aware of.

Link to comment

HasValue() would no longer function if they are set to a 0 yes. I'm probably going to backpedal on that change however.

Thanks, it really would be great, because our framework relies on HasValue and a value of 0 would be a perfectly normal value for it. The framework just needs to know if the value had been set or not.

 

It works fine for me in all test, only issue I've noticed is FormArray and AliasArray creates arrays that won't let elements be set, try to set any of it's indexes with the appropriate type produces an error in the debug log that types don't match. I'm assuming I'm missing some updated file from the upcoming SKSE update that fixes this, I was only given the new PapyrusArgs file with the VMResultArray template.

 

The non-beta version of PapyrusUtil 3.0 won't have the Int/Float/String/Form/AlilasArray() functions in anycase, since SKSE will have those in their own script. They are just there now so I can continue developing with them in mind.

We just switched from 2.8 to 3.0b, no code change and the resizing function didn't worked anymore. But when those functions will be replaced by the new SKSE it's fine, we would use 2.8 until the new release.

 

This is the code snippet we are using to create a dynamic sized array

 

;filling up the SyncModeNPCListOptions array with the names of the NPCs, to be shown as a menu later.
Int iSyncModeNPCs = FormListCount(None, SYNC_MODE_NPC_CHANGELIST)
SyncModeNPCListOptions = PapyrusUtil.StringArray(iSyncModeNPCs)
which always returns 0 in 3.0b and the correct amount of elements in 2.8.

 

The original lists are left intact, slice just return a portion of.

 

ListSlice() will continue to fill the given array with the lists values until either the array, or the list runs out of values from the starting index.

Ahh okay, I thought so, but I wasn't sure because in other languages it would work differently.
Link to comment
We just switched from 2.8 to 3.0b, no code change and the resizing function didn't worked anymore. But when those functions will be replaced by the new SKSE it's fine, we would use 2.8 until the new release.

 

Check your debug log, if you're running into the same error I'm describing, you'll see a line about "being unable to set an arrays index to variable, because variable types do not match." Or something like that. Despite you being 100% sure that the variable you are trying to set into the array is a compatible type. 

 

If you aren't seeing that error, than it is a different issue entirely I'll need to look into.

Link to comment
;filling up the SyncModeNPCListOptions array with the names of the NPCs, to be shown as a menu later.
Int iSyncModeNPCs = FormListCount(None, SYNC_MODE_NPC_CHANGELIST)
SyncModeNPCListOptions = PapyrusUtil.StringArray(iSyncModeNPCs)
which always returns 0 in 3.0b and the correct amount of elements in 2.8.

 

 

 

Double check the output of youir iSyncModeNPCs and your SyncModeNPCListOptions.Length, the way you describe the problem either could be a potential cause for such a problem, and result from entirely different issues.

 

You have my Skype, feel free to pester me about this there if you want to work out immediate solutions while I'm still around.

Link to comment

I have found another issue in JsonUtils - I did not check if the new version is affected too:

If I save formlists sometimes JsonUtils writes only the form ids and forget about the plugin filenames - looks like "1234|" instead of "1234|name.esp".

Seems to be fixed in 3.0

Link to comment

I have a small feature request: Storing object positions in JsonUtils.

If I simply store coordinates (obj.GetPositionX()...) Skyrim may load the wrong cell during restore of the position. (obj.SetPosition(x,y,z)

Then I have tried to store a ObjectReference to a marker as a Form (SetFormValue) - does not work either.

 

And some good news:

I have significantly less CTDs with 3.0

Link to comment
  • 2 weeks later...

Is there any way to enter fly camera mode without PapyrusUtils?

In 3.0 MiscUtil.ToggleFreeCamera() it is completely broken but on the other side for me 3.0 is much more stable.

 

Already been reported and fixed in the current development version (which I really just need to fucking officially release already...)

 

Here is the current development version in any case, which should fix it. As a change from the previous 3.0 beta, it now requires SKSE 1.7.2, as the array functions have all been transfered to use it's new Utility.psc functions for array creation instead of using it's own. Backwards compatibility functions have been placed in it's stead.

papyrusutilv30.BETA3.zip

Link to comment

 

Is there any way to enter fly camera mode without PapyrusUtils?

In 3.0 MiscUtil.ToggleFreeCamera() it is completely broken but on the other side for me 3.0 is much more stable.

 

Already been reported and fixed in the current development version (which I really just need to fucking officially release already...)

 

Here is the current development version in any case, which should fix it. As a change from the previous 3.0 beta, it now requires SKSE 1.7.2, as the array functions have all been transfered to use it's new Utility.psc functions for array creation instead of using it's own. Backwards compatibility functions have been placed in it's stead.

attachicon.gifpapyrusutilv30.BETA3.zip

 

Thank you very much - does not matter because I have decided to make SKSE 1.7.2 required for my mod too...

Link to comment

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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use