IsharaMeradin Posted May 24, 2014 Share Posted May 24, 2014 Are you testing on a clean save? Is it possible you have remnants of using the OnActivate event still interfering? Link to comment Share on other sites More sharing options...
fantasy19 Posted May 24, 2014 Share Posted May 24, 2014 (edited) so looking at your code above, am I right in thinking that basically the DisplayItem formlist will be a list of sub forms which each has a single item or list of the leveled item? so the ebony armor would have a form list that has just the ebony armor listed and chillrend would have a formlist that lists all 6 leveled versions for instance? that seems like a LOT of work to separate each item into it's own formlist XP If that's the case, I'll just tell people "stick it on the rack yourself you lazy *(&^%&!" lolYup, pretty much sums it up. Now if you know beyond a shadow of a doubt which index is what (either item or leveled list) then you could have a mixed list for the display items. You would have to break the process up with at least two if statements. One to handle normal items and one to handle the leveled items. Right now, I can't even think of that off the top of my head. An alternative process might be to use the 1 to 1 ratio form lists for normal items and do specific entries for the leveled items. Sorry i pressed tab and enter accidentally posted while wondering should i post this LOL.Anyway, If you can limit the amount of items being displayed: Scriptname DBM_DisplaySortScript extends ObjectReference Int[] Property Display_Items_Numbers Auto ; same number of slots as Display_Items ObjectReference[] Property Display_Activators Auto ; same number of slots as amountOfRacks ObjectReference[] Property Display_Items Auto ; make the length an even number Int index Int index2 Int index3 Int index4 Int amountOfRacks Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer) While index < Display_Items.Length if (akBaseItem == Display_Items[Index]) if (Display_Items_Numbers[Index] > 1) Display_Items_Numbers[Index]-=aiItemCount else Display_Items[Index] = None Display_Items_Numbers[Index] = 0 endif index = Display_Items.Length endif index+=1 endWhile endEvent Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) While Index < Display_Items.Length - 2 Index2 = Index2 + Display_Items_Numbers[Index] + Display_Items_Numbers[Index+1] if (index == Display_Items_Numbers.Length - 2 && Index2 > amountOfRacks) debug.messagebox("remove stuff first") else Index = 0 Index2 = 0 InsertItem() endif Index+= 2 endWhile endEvent Function InsertItem() While Index < Display_Items.Length if (akBaseItem == Display_Items[Index]) ;if its an existing item inside Display_Items_Numbers[index]+=aiItemCount index = Display_Items.Length endif if (index == Display_Items.Length && akBaseItem != Display_Items[Index]) ;if its not an existing item inside While Index2 < Display_Items.Length if (Display_Items[Index2] == none) ; finds an available slot akBaseItem == Display_Items[Index2] Display_Items_Numbers[index]+=aiItemCount index2 = Display_Items.Length endif index2+=1 endWhile endif index+=1 endWhile index = 0 index2 = 0 index3 = 0 index4 = 0 While Index < Display_Items.Length if (Display_Items[index] != None) Index2 = Index4 + Display_Items_Numbers[index] ; to make the next 1 or more slots have the same item if there are duplicates of the same item While Index3 < Index2 Display_Activators[Index4] = Display_Items[index] index4+=1 index3+=1 endWhile index4 = Index2 endif Index+=1 endWhile endFunction From that then you will execute the displaying with your existing script using the Display_Activators array. Edited May 24, 2014 by fantasy19 Link to comment Share on other sites More sharing options...
icecreamassassin Posted May 25, 2014 Author Share Posted May 25, 2014 (edited) Thanks for the info but the script IS working fine, I'm just having issues with getting the container exit to trigger it. And yes, It's on an entirely new game. I only test with a fresh character I suspect that the OnActivate event was happening still because I had it commented out, and perhaps SKSE doesn't observe commenting as cleanly? dunno. But I removed it all and just had the code listed above and it didn't seem to trigger at all, even when opening and closing the container again Edited May 25, 2014 by icecreamassassin Link to comment Share on other sites More sharing options...
IsharaMeradin Posted May 25, 2014 Share Posted May 25, 2014 (edited) There is one difference between your script and mine where it works. You are applying the script to the container. I have my event on a quest script. My quest runs all the time. Your container is only loaded at certain times. Perhaps that has an effect on what is happening. I wonder how we can adapt the process to work on a quest or even the player alias (which is constantly active too). EDIT:I think I have an idea. Setup a start game enabled quest to control the process.Create an alias for the container you want the work with on the container reference ScriptName SomeName Extends ReferenceAlias Bool property ItemAdded = false hidden Event OnActivate(ObjectReference akActionRef) ;opened the container to add stuff so ensure that the bool is false first ItemAdded = false EndEvent Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) ;an item is added to the container ItemAdded = true EndEvent on the main quest script ScriptName SomeOtherName Extends Quest SomeName Property MyScriptRef Auto {point this to the container alias. Note SomeName must be the same name used for the script on the container alias} Event OnInit() RegisterForMenu("ContainerMenu") EndEvent Event OnMenuClose(String MenuName) If MenuName == "ContainerMenu" && MyScriptRef.ItemAdded == true ;a container menu was closed and the target container had something added so logically this closed menu belongs to the target container MyScriptRef.ItemAdded = false ;do the display enable/disable stuff EndIf EndEvent Edited May 26, 2014 by IsharaMeradin Link to comment Share on other sites More sharing options...
icecreamassassin Posted May 26, 2014 Author Share Posted May 26, 2014 k, trying to set this up but your bool line on the container script is being spit back out saying "No viable alternative at input hidden" Link to comment Share on other sites More sharing options...
IsharaMeradin Posted May 26, 2014 Share Posted May 26, 2014 My bad, mark me down as human... Bool property ItemAdded = false hidden <-- change this Bool property ItemAdded = false auto hidden <-- to this Link to comment Share on other sites More sharing options...
icecreamassassin Posted May 26, 2014 Author Share Posted May 26, 2014 now I'm getting a type mismatch error... I'm assuming because ItemAdded is defined as a bool in one script and a property of the script name in the other? Link to comment Share on other sites More sharing options...
IsharaMeradin Posted May 26, 2014 Share Posted May 26, 2014 now I'm getting a type mismatch error... I'm assuming because ItemAdded is defined as a bool in one script and a property of the script name in the other?I've been doing learning this myself as we go along. Been updating the mod I'm working on to use functions and properties from one central script whenever possible. So I've been having to work through these various errors myself. Updated the earlier post with the code and I'm now confident it should work. Link to comment Share on other sites More sharing options...
icecreamassassin Posted May 26, 2014 Author Share Posted May 26, 2014 hmmm interesting. It all compiles but when I go to define the properties in the quest script it doesn't show anything listed for the alias, just shows NONE. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted May 26, 2014 Share Posted May 26, 2014 Post the actual scripts rather than example code. Maybe there is something we are missing. Link to comment Share on other sites More sharing options...
Recommended Posts