Versh Posted December 16, 2014 Posted December 16, 2014 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
Heromaster Posted December 18, 2014 Posted December 18, 2014 1. They are safe to use. If values/lists aren't declared, as you guessed, the default value will be returned. 2. It's for the people who rely on PapyrusUtil where they can't rely on people having SexLab installed (handy for non-adult mods)
Versh Posted December 18, 2014 Posted December 18, 2014 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
Ashal Posted December 21, 2014 Author Posted December 21, 2014 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.
h38fh2mf Posted December 21, 2014 Posted December 21, 2014 That might cause another problem if someone uses "HasValue" on a string to check if their mod has initialized.
Ashal Posted December 21, 2014 Author Posted December 21, 2014 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.
Heromaster Posted December 21, 2014 Posted December 21, 2014 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?
zaira Posted December 22, 2014 Posted December 22, 2014 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
Ashal Posted December 22, 2014 Author Posted December 22, 2014 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?
Ashal Posted December 22, 2014 Author Posted December 22, 2014 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.
zaira Posted December 23, 2014 Posted December 23, 2014 ... 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?
Ashal Posted December 23, 2014 Author Posted December 23, 2014 ... 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.
zaira Posted December 23, 2014 Posted December 23, 2014 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".
Heromaster Posted December 23, 2014 Posted December 23, 2014 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.
Ashal Posted December 23, 2014 Author Posted December 23, 2014 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.
Ashal Posted December 23, 2014 Author Posted December 23, 2014 ;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.
zaira Posted December 25, 2014 Posted December 25, 2014 MiscUtil.ToggleFreeCamera does not work properly in the 3.0 version - camera is misplaced and toggle back does not work
zaira Posted December 27, 2014 Posted December 27, 2014 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
zaira Posted December 27, 2014 Posted December 27, 2014 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
zaira Posted January 6, 2015 Posted January 6, 2015 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.
Ashal Posted January 6, 2015 Author Posted January 6, 2015 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
zaira Posted January 6, 2015 Posted January 6, 2015 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 Thank you very much - does not matter because I have decided to make SKSE 1.7.2 required for my mod too...
Teddar Posted January 6, 2015 Posted January 6, 2015 Sorry if this an obvious question but should this be installed before or after Sexlab framework? I ask as it askes to overwrite ActorUtil.pex when you install. Should the SL version or the Util version be used?
zaira Posted January 6, 2015 Posted January 6, 2015 I have currently no issues overwriting SL with the beta 3.0 version.
Teddar Posted January 6, 2015 Posted January 6, 2015 I have currently no issues overwriting SL with the beta 3.0 version. okies. Makes sense
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now