Jump to content

dont understand activating form list


angelwraith

Recommended Posts

i have forms that are added to a formlist through script..

 

pretty much everything works with the script i am using except for one thing..

 

the formlist does not load properly when loading the game.

im not sure if it loads at all actually because the list is rebuilt every time the container the script is attached to is closed.

 

if when loading the game i go to the terminal that uses the formlist and attempt its operation it does not work.. BUT

if i open (and close obviously) the container the formlist works as it is supposed to for the rest of the time you are there.. until the next load.

but if i set the variables manually through console that do the same EXACT thing as activating the container manually, it does not work.

 

i dont get how walking up to the container and activating it is any different than activating it through the console.. maybe having to do with the calling ref or something?? idk..

 

im really lost anyone know what the hell im talking about?

Link to comment
Share on other sites

If I'm not mistaken, and I often am, I believe that a form list will only contain those entries that are assigned to it in the Geck when you load up the game. It does not surprise me that your activation isn't working after you re-load. Perhaps you need to add a bit of code that opens and closes your container (since that seems to rebuild the list - or just rebuild the list) when you first load the cell. Of course if you do that in an OnLoad block, the block might fail to run if the cell 3-D data is already in the save game. I have problems with form lists as well when moving from cell to cell. They aren't that easy to work with. Perhaps you can search you form list for a specific form and if its not there, rebuild the list.
Link to comment
Share on other sites

If I'm not mistaken, and I often am, I believe that a form list will only contain those entries that are assigned to it in the Geck when you load up the game. It does not surprise me that your activation isn't working after you re-load. Perhaps you need to add a bit of code that opens and closes your container (since that seems to rebuild the list - or just rebuild the list) when you first load the cell. Of course if you do that in an OnLoad block, the block might fail to run if the cell 3-D data is already in the save game. I have problems with form lists as well when moving from cell to cell. They aren't that easy to work with. Perhaps you can search you form list for a specific form and if its not there, rebuild the list.

 

 

yeah im not sure the list saves at all.. is why i have that container with all the objects that need to be added to the list that rebuilds the list.. but thats not my problem.. like i said it works fine if the variables are set by actually walking up to it and activating the container or setting the variables through the console, but NOT through script?? i mean its not a hard thing, in fact i have it set up to run the activation script that that variable controls on a "0" and changes to 1 so that it runs on load.. and IT DOES RUN ON LOAD SV always returns a "1" for that variable... but the sort doesnt work ... unless you manually activate it than all is fine.... all i can say is whatthe!@#$%lesauce!!!

Link to comment
Share on other sites

If I'm not mistaken, and I often am, I believe that a form list will only contain those entries that are assigned to it in the Geck when you load up the game. It does not surprise me that your activation isn't working after you re-load. Perhaps you need to add a bit of code that opens and closes your container (since that seems to rebuild the list - or just rebuild the list) when you first load the cell. Of course if you do that in an OnLoad block, the block might fail to run if the cell 3-D data is already in the save game. I have problems with form lists as well when moving from cell to cell. They aren't that easy to work with. Perhaps you can search you form list for a specific form and if its not there, rebuild the list.

 

 

yeah im not sure the list saves at all.. is why i have that container with all the objects that need to be added to the list that rebuilds the list.. but thats not my problem.. like i said it works fine if the variables are set by actually walking up to it and activating the container or setting the variables through the console, but NOT through script?? i mean its not a hard thing, in fact i have it set up to run the activation script that that variable controls on a "0" and changes to 1 so that it runs on load.. and IT DOES RUN ON LOAD SV always returns a "1" for that variable... but the sort doesnt work ... unless you manually activate it than all is fine.... all i can say is whatthe!@#$%lesauce!!!

*EDIT*

 

hmmm.. what you said at first didnt make any sense about searching for the missing form seeing how the missing forms will always be different per user.. BUT then it was like being hit in the side of the head with a baseball bat:

add a DUMMY item to the add container that doesnt ever show up in the game and therefore will not ever actually be sorted..

than i can do what you said and search for the dummyitem per list.

 

ill see if it helps THANKS!!!

Link to comment
Share on other sites

ya, sorry. I meant that as well. All of my lists that I use to store stuff in game have an "apple" as a dummy added in the geck. Then I always add new entries from the top (ListAddForm SomeList SomeForm 0) so that my dummy is always last in the list. A Form List can get bugged when the last entry is removed making it so that no new form can be added to the list. Doing it this way prevents that from occuring.
Link to comment
Share on other sites

ya, sorry. I meant that as well. All of my lists that I use to store stuff in game have an "apple" as a dummy added in the geck. Then I always add new entries from the top (ListAddForm SomeList SomeForm 0) so that my dummy is always last in the list. A Form List can get bugged when the last entry is removed making it so that no new form can be added to the list. Doing it this way prevents that from occuring.

 

just tried this: ...Didn't work.. I don't know what to do!!!!?!

 

		set DUMMYITEMref to DUMMYITEM
		if (DUMMYITEMref.IsInList SUBsortAdvancedWeapList)
		; DO NOTHING (cause "== 0" caused syntax error)
		else
		ListAddForm SUBsortAdvancedWeapList DUMMYITEM 0
		endif

 

any other ideas?

 

*EDIT*

oook now this is really weird..

 

i copied the commands from the OnClose block and put them in the GAMEMODE block being activated by 0 and then changing to 1....

 

DOES NOT WORK!!! how is this possible??

 

doesnt make sense cause the only thing that actually makes it work is activating the container either manually or through console (with the same exact line onclose uses: set ACTIVATEDF to 0)..

 

 

i realize BTW the code isnt very tidy.. ive tried about 8 million different things to get this to fire and this is the hacked up remains..

 

Video'ed the bug maybe it helps IDK...

http://www.youtube.com/watch?v=DyLfJm3_SJM

Link to comment
Share on other sites

I have to admit, I am a little confused myself. You have two 'container' scripts but I only see you openiong and closing a single container, and activating a switch. I am unclear what script runs on which object and so, I am having trouble following the logic of your setup. Perhpas you can clear that up for me. The video is good though, it does show how you can only sort after opening and closing that one gun cabinet.

 

So...

 

Which script runs on the gun cabinet? Which script runs on the switch? What script runs in the results script of the terminal for the weapon sort option? Are there any background scripts as well - like a quest script or the like?

Link to comment
Share on other sites

WAIT may have found the fix.. testing now. will update soon.

 

*UPDATE**UPDATE**UPDATE**UPDATE**UPDATE**UPDATE**UPDATE**UPDATE*

 

i got it working..ish

for some reason teh set ACTIVAEDF to 0 works from a terminal.. soo i set them to all run instead of the sort script when you hit any terminal button then i moved all those scripts to questscripts that the terminal starts on a slight delay to let the sorters/adders do their thing.

 

this works 99.9% of the time but for some odd reason every once in a while it still doesnt work on the very first attempt but at least now reattempting through the terminal is all it takes.. not running around and manually activating each and every one of the 15 containers.

 

just wish i could nail that last .1% cause i hate buggy scripts...

 

well 99.9% will have to do for now.. people running this mod need a fix to that problem.. otherwise the ADAPTIVE part of the adaptive sorters are almost useless IMO

 

*UPDATE**UPDATE**UPDATE**UPDATE**UPDATE**UPDATE**UPDATE**UPDATE*

 

 

 

I have to admit, I am a little confused myself. You have two 'container' scripts but I only see you openiong and closing a single container, and activating a switch. I am unclear what script runs on which object and so, I am having trouble following the logic of your setup. Perhpas you can clear that up for me. The video is good though, it does show how you can only sort after opening and closing that one gun cabinet.

 

So...

 

Which script runs on the gun cabinet? Which script runs on the switch? What script runs in the results script of the terminal for the weapon sort option? Are there any background scripts as well - like a quest script or the like?

 

2nd container is hidden.. about 2 stories underground compared to the containers you activate...

the reason i am using 2 containers is so if someone removes ALL of the items of a particular type from the first container a copy of that formid still stays in the second container so at rebuilding the formlist that item will continue to sort

 

the switch you saw me hitting does not have a script posted here..

i only showed it in the video to show after the lists are cleared the sorting still works properly.. its just that initial use stumping me

 

so yes every item sort has 4 scripts to make this process work

1. container you see me activating fires the SUBSORTSETTERMOVER script:

 

*EDIT*

i should add the reason i have been providing this script is because this is where i believe the problem is..

THIS is the ACTIVATEDF i keep referring to, when it is triggered by either the onclose block or by manually setting it through console all is fine but i cannot for some reason get it to trigger automatically when the game starts..

i figured it was a timing issue so i triggered it after 3 seconds in gamemode even ... didnt work..

 

SCN SUBsorterSETTERsmallgunsmover
ref rBaseInvObj
int ACTIVATEDF
int iInvPos
int myCount
ref meRef
ref myRef


Begin OnClose
       set ACTIVATEDF to 0
END


BEGIN GAMEMODE


       if ACTIVATEDF == 0
       set meRef to GetSelf
       set myRef to SUBWeapSmallGunsLockeradd
       set SUBWeapSmallGunsLockeradd.ACTIVATEDF to 0
               set iInvPos to meRef.GetNumItems

               Label 1
               if (iInvPos)
                       set iInvPos to (iInvPos - 1)
                       set rBaseInvObj to (meRef.GetInventoryObject iInvPos)
                       if (myRef.getitemcount rBaseInvObj) == 0
                               myRef.additem rBaseInvObj 1
                               
                       endif
                       goto 1
               endif
               set ACTIVATEDF to 1
       endif
END

 

2. hidden container underground keeps a copy of items that have been added to first container so that they are always available when building the formlist.. fires the SUBSETTER script to handle all the formlist work

 

i noticed early on saving formlists is kinda weird.. so this is my way of beating it.. i am kinda using this second container as a formlist... items from teh first container are added only if they dont exist in the second container already, in essence flaging that item to be added to the actual formlist (all at index 0 to keep list and container the same) every time the first container is activated. also this means that when you add an item to the container the scripts refire causing whatever you just added to be added to the sort list every time.. i wanted your changes to be instant.. as you see from the video thats the way it works.

 

anyways less talk more script:

 

 

*EDIT*

just realized i should probably run a getisinlist condition on the object before adding it to avoid overpopulating the list.. and probably causing issues above 255 but i dont think thats the cause of the problem at hand.

SCN SUBsorterSETTERsmallguns

ref rBaseInvObj
int ACTIVATEDF
int iInvPos
int myCount



BEGIN GAMEMODE

       if ACTIVATEDF == 0

               set iInvPos to SUBWeapSmallGunsLockeradd.GetNumItems

               Label 1
               if (iInvPos)
                       set iInvPos to (iInvPos - 1)
                       set rBaseInvObj to (SUBWeapSmallGunsLockeradd.GetInventoryObject iInvPos)
                       ListAddForm SUBsortSmallGunsList rBaseInvObj 0
                       goto 1
               endif
               set ACTIVATEDF to 1
       endif
END

 

 

3. the reset device that makes the list have the same number of entries as a copy of the default list that each container has and removing all the extras from index 0 (where they were added) .. in essence reseting the sort lists:

 

scn SUBlistresetQuestScript

int myCount

int ACTIVATEDF
ref listObjRefn
int ACTIVATELOCKERS 
float timerF
ref DUMMYITEMref

float timers
int activateds

begin onactivate
set ACTIVATEDF to 1
activate
end





begin GAMEMODE



if ACTIVATEDF == 1

SUBsafe04REFadd.RemoveAllItems
SUBsafe03REFadd.RemoveAllItems
SUBsafe02REFadd.RemoveAllItems
SUBsafe01REFadd.RemoveAllItems
SUBWeapUnarmedLockeradd.RemoveAllItems
SUBWeapExplosivesLockeradd.RemoveAllItems
SUBWeapEnergyLockeradd.RemoveAllItems
SUBBigGunsLockeradd.RemoveAllItems
SUBWeapSmallGunsLockeradd.RemoveAllItems
SUBWeapCustomLockeradd.RemoveAllItems
SUBWeapMeleLockeradd.RemoveAllItems
SUBAdvancedWeapLockeradd.RemoveAllItems




label 1
if (ListGetCount SUBsortAdvancedWeapList) > (ListGetCount SUBsortAdvancedWeapListCOPY)
	ListRemoveNthForm SUBsortAdvancedWeapList 0
	goto 1
endif


label 2
if (ListGetCount SUBsortBigGunsList) > (ListGetCount SUBsortBigGunsListCOPY)
	ListRemoveNthForm SUBsortBigGunsList 0
	goto 2
endif


label 3
if (ListGetCount SUBsortcapsList) >  (ListGetCount SUBsortcapsListCOPY)
	ListRemoveNthForm SUBsortcapsList 0
	goto 3
endif


label 4
if (ListGetCount SUBsortCasualList) >  (ListGetCount SUBsortCasualListCOPY)
	ListRemoveNthForm SUBsortCasualList 0
	goto 4
endif


label 5
if (ListGetCount SUBsortCombatArmorList) >  (ListGetCount SUBsortCombatArmorListCOPY)
	ListRemoveNthForm SUBsortCombatArmorList 0
	goto 5
endif


label 6
if (ListGetCount SUBsortCustomList) >  (ListGetCount SUBsortCustomListCOPY)
	ListRemoveNthForm SUBsortCustomList 0
	goto 6
endif


label 7
if (ListGetCount SUBsortEnergyList) >  (ListGetCount SUBsortEnergyListCOPY)
	ListRemoveNthForm SUBsortEnergyList 0
	goto 7
endif


label 8
if (ListGetCount SUBsortExplosivesList) > (ListGetCount SUBsortExplosivesListCOPY)
	ListRemoveNthForm SUBsortExplosivesList 0
	goto 8
endif


label 9
if (ListGetCount SUBsortFOODList2) >  (ListGetCount SUBsortFOODList2COPY)
	ListRemoveNthForm SUBsortFOODlist2 0
	goto 9
endif


label 10
if (ListGetCount SUBsortmedslist) >  (ListGetCount SUBsortmedslistCOPY)
	ListRemoveNthForm SUBsortmedslist 0
	goto 10
endif


label 11
if (ListGetCount SUBsortMeleList) >  (ListGetCount SUBsortMeleListCOPY)
	ListRemoveNthForm SUBsortMeleList 0
	goto 11
endif


label 12
if (ListGetCount SUBsortPAList) > (ListGetCount SUBsortPAListCOPY)
	ListRemoveNthForm SUBsortPAList 0
	goto 12
endif


label 13
if (ListGetCount SUBsortSmallGunsList) >  (ListGetCount SUBsortSmallGunsListCOPY)
	ListRemoveNthForm SUBsortSmallGunsList 0
	goto 13
endif


label 14
if (ListGetCount SUBsortStealthList) >  (ListGetCount SUBsortStealthListCOPY)
	ListRemoveNthForm SUBsortStealthList 0
	goto 14
endif


label 15
if (ListGetCount SUBsortUnarmedList) >  (ListGetCount SUBsortUnarmedListCOPY)
		ListRemoveNthForm SUBsortUnarmedList 0
	goto 15
endif

set ACTIVATEDF to 0
endif

end


 

 

4. almost forgot about the terminal script that actually sorts it out. (but i dont think this is where the problem is... repeatedly activating the terminal changes nothing.. only activating the first container or setting it to "set ACTIVATEDF to 1" through console, NOT SCRIPT, for some odd reason works) anyway.. here it is:

 

int listnumF
int myCount
int formrefnumF
ref formref


Label 1
set formrefnumF to ListGetCount SUBsortBigGunsList
if listnumF <= formrefnumF
set formref to listgetnthform SUBsortBigGunsList listnumF
set myCount to player.getitemcount formref
player.removeitem formref myCount 1
SUBBigGunsLocker.additem formref myCount
set listnumF to listnumF + 1
goto 1
endif
set listnumF to 0
Label 2
set formrefnumF to ListGetCount SUBsortSmallGunsList
if listnumF <= formrefnumF
set formref to listgetnthform SUBsortSmallGunsList listnumF
set myCount to player.getitemcount formref
player.removeitem formref myCount 1
SUBWeapSmallGunsLocker.additem formref myCount
set listnumF to listnumF + 1
goto 2
endif
set listnumF to 0
Label 3
set formrefnumF to ListGetCount SUBsortEnergyList
if listnumF <= formrefnumF
set formref to listgetnthform SUBsortEnergyList listnumF
set myCount to player.getitemcount formref
player.removeitem formref myCount 1
SUBWeapEnergyLocker.additem formref myCount
set listnumF to listnumF + 1
goto 3
endif
set listnumF to 0
Label 4
set formrefnumF to ListGetCount SUBsortMeleList
if listnumF <= formrefnumF
set formref to listgetnthform SUBsortMeleList listnumF
set myCount to player.getitemcount formref
player.removeitem formref myCount 1
SUBWeapMeleLocker.additem formref myCount
set listnumF to listnumF + 1
goto 4
endif
set listnumF to 0
Label 5
set formrefnumF to ListGetCount SUBsortCustomList
if listnumF <= formrefnumF
set formref to listgetnthform SUBsortCustomList listnumF
set myCount to player.getitemcount formref
player.removeitem formref myCount 1
SUBWeapCustomLocker.additem formref myCount
set listnumF to listnumF + 1
goto 5
endif
set listnumF to 0
Label 6
set formrefnumF to ListGetCount SUBsortExplosivesList
if listnumF <= formrefnumF
set formref to listgetnthform SUBsortExplosivesList listnumF
set myCount to player.getitemcount formref
player.removeitem formref myCount 1
SUBWeapExplosivesLocker.additem formref myCount
set listnumF to listnumF + 1
goto 6
endif
set listnumF to 0
Label 7
set formrefnumF to ListGetCount SUBsortUnarmedList
if listnumF <= formrefnumF
set formref to listgetnthform SUBsortUnarmedList listnumF
set myCount to player.getitemcount formref
player.removeitem formref myCount 1
SUBWeapUnarmedLocker.additem formref myCount
set listnumF to listnumF + 1
goto 7
endif
set listnumF to 0
Label 8
set formrefnumF to ListGetCount SUBsortAdvancedWeapList
if listnumF <= formrefnumF
set formref to listgetnthform SUBsortAdvancedWeapList listnumF
set myCount to player.getitemcount formref
player.removeitem formref myCount 1
SUBAdvancedWeapLocker.additem formref myCount
set listnumF to listnumF + 1
goto 8
endif
set listnumF to 0

 

 

 

 

again the only bug in this process is that initial activation...

 

and after browsing this topic again i now remember why i was avoiding posting all the scripts.. its like being drowned in code.. just tooo much...

 

will edit out the scripts from prev. post just to condense the topic

(i already copied them to this post)

Link to comment
Share on other sites

I must confess I did not read through all posts, but from a glance your problems seems to be related to saving form lists?

Elements added by ListAddForm are not saved, elements added by AddFormToFormList are. To work around CTDs on save, I dont use ListRemoveForm but instead ListReplaceForm with a dummy Null record. So if you iterate through the list, just skip these null records, and on reload all duplicated null entries seem to removed, so your list will not grow indefinitely. For me this has worked very well so far, you might wanna try it to avoid the dummy container.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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