Jump to content

ListAddForm vs AddFormToFormlist


Recommended Posts

I remember someone stating there were some differences between these, that ListAddForm didn't check for duplicates and something like one of them persist across saves.

 

Anyone got some solid info to share on this?

 

I'm currently doing this in SCR and wondering if it's causing heavy load being run every 5 seconds or overfilling formlists.

; *** Add to Current Companion lists if Possible Companions are Teammates
		Label 1
		if iCnt > 0
			Set iCnt to iCnt - 1
			Set rNPC to ListGetNthForm SexoutSLActorDataPossibleCompanions iCnt
			if rNPC.GetIsSex Female
				if rNPC.GetPlayerTeammate
					Set fDistanceToPlayer to rZPlayer.GetDistance rNPC
					AddFormToFormList SexoutSLDataCurrCompanionsFem rNPC
				else
					if NX_IsInList SexoutSLDataCurrCompanionsFem rNPC
						ListRemoveForm SexoutSLDataCurrCompanionsFem rNPC	
					endif
				endif
			elseif rNPC.GetIsSex Male
				if rNPC.GetPlayerTeammate
					Set fDistanceToPlayer to rZPlayer.GetDistance rNPC
					AddFormToFormList SexoutSLDataCurrCompanionsMale rNPC
				else
					if NX_IsInList SexoutSLDataCurrCompanionsMale rNPC
						ListRemoveForm SexoutSLDataCurrCompanionsMale rNPC	
					endif
				endif
			endif
		goto 1
		endif

I'm thinking perhaps I should add a check before adding, but not sure if that would cause more unnecessary load if duplication isn't the problem.

I considered clearing the lists every scan may also be an option iff iut doesn't cause too much load.

Link to comment

Wait, wrong link. Jsut as sec..

 

Formlist manipulation should not cause any real slowdowns though, especially not every 5 seconds. Script looks fine to me at a glance.

I'm not sure if you knew about this issue we had with formlists not cleared in the scanner by Slavery & Tryout http://www.loverslab.com/topic/12826-fighting-the-slaverytryout-stutter/?hl=slavery+stutter&do=findComment&comment=286206

Link to comment

I'm not sure about the persistance, but I do believe one of them (i think its ListAddForm) inserts into the beginning of the list and the other inserts at the end, and I do believe ListAddForm is the one that wont duplicate but moves the index down to 0 instead. I currently use one of them as a means of faking a stack, last in last out sort of thing.

 

EDIT *After looking at the Geck Wiki I might have that backwards, was going off the top of my head, i do believe it's the otherway around now after looking at my own scripts

Link to comment

Here's the link I meant to post...

 

http://www.loverslab.com/topic/3722-sexoutslavery-v1411-1232013/page-4?do=findComment&comment=94334

 

All the gibberish about doing lookups is what prompted me to put NX_IsInList in the extender.

 

All lists are stored in savegames and are persistent. I'm pretty sure that none of them allows dupes to go into the formlist -- that's a feature of the lists themselves, not the function used to add to them. Even though they are stored in savegames, they aren't always *loaded* from savegames. Unless you put at least one dummy item in a formlist, there's no guarantee that it will be loaded with the savegame.

Link to comment

Hal, I'll look into that.

 

Everyone using the scanner has to be extremely careful to clear the target formlists out at present. If not, they will fill up with every scanned reference encountered in the game as the player moves from cell to cell.

 

I think I might start clearing them myself in the scanner itself, before I populate them, but there's always the potential for that to break somebodies 'clever' mod that prepopulates the formlist they give to the scanner, or that intentionally leaves it uncleared for a while.

Link to comment

All lists are stored in savegames and are persistent. I'm pretty sure that none of them allows dupes to go into the formlist -- that's a feature of the lists themselves, not the function used to add to them. Even though they are stored in savegames, they aren't always *loaded* from savegames. Unless you put at least one dummy item in a formlist, there's no guarantee that it will be loaded with the savegame.

 

That would explain IsInList and ListGetFormIndex doing silent breaks on scripts. I assumed it was do to a null pointer reference, but the list not loading period makes more sense.

Link to comment

You can get around that by either putting a dummy item in the list from in the geck, or by adding a list 'init' block in a quest script. The latter only makes sense in cases where the list being reset to default every time a game is started or loaded makes sense. Most of the sexout lists work that way, but in some cases, you definitely want to save the state with the savegame and load it back up, so you should use the first 'trick'.

Link to comment

I just realised looking back at this I was missing something stupidly simple that may be causing it not to work, I'm somehow missing the line to count the items in the list, must have deleted it accidently during a cut & paste or something. So it would have been starting at -1.

 

Set iCnt to ListGetCount SexoutSLActorDataPossibleCompanions

 

 

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • 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