Syntax for ListClear?

Post » Fri Jun 17, 2011 10:21 am

ListClear NVCompanionWeapons
doesn't seem to be cutting it.

Am I missing an optional variable?

Is there a way to check if a list is populaetd via the console?

Edit - Also, do form list changes get saved/loaded by the game, or do I need to run them on each load of the game?

Edit 2 - Looks like they don't save, which is actually what I was hoping for. Also, I know I'm not missing an optional variable on ListClear since the compiler errors if I try and add one.

Queue
User avatar
Nikki Lawrence
 
Posts: 3317
Joined: Sat Jul 01, 2006 2:27 am

Post » Fri Jun 17, 2011 6:53 am

Changes made with listAddForm don't save, changes made with addFormToFormList do.

And I didn't even know there was a ClearList function, I always use a helper stage function for that :)
User avatar
kirsty williams
 
Posts: 3509
Joined: Sun Oct 08, 2006 5:56 am

Post » Fri Jun 17, 2011 2:40 pm

I'm not sure about ListClear; it doesn't seem to accept any other variables. ListRemoveForm and ListRemoveNthForm should be able to do it, although obviously not all at once.

If you want to get the list count from the console, you can use "set [variable] to ListGetCount [FormList]" and it'll show the value--and set the variable, of course, so use a dummy one if that matters.

Like schlangster says, changes to form lists from NVSE don't persist when loading the game, so you'll have to do it every time. I've stopped using form lists because of that and changed to using containers. If you manage the item count, you can effectively have an indexed list that's persistent.

(LOL we're all replying and editing around each other...)
User avatar
Helen Quill
 
Posts: 3334
Joined: Fri Oct 13, 2006 1:12 pm

Post » Fri Jun 17, 2011 8:34 am

Tried passing it the list through a ref variable?
User avatar
Emilie M
 
Posts: 3419
Joined: Fri Mar 16, 2007 9:08 am

Post » Fri Jun 17, 2011 10:47 am

ListClear will parse, but the actual code is commented out in the source. So it won't do anything.
User avatar
Alina loves Alexandra
 
Posts: 3456
Joined: Mon Jan 01, 2007 7:55 pm

Post » Fri Jun 17, 2011 7:24 am

Ah ha.
Also, lots of good information here, like usual. =]

Humorously Pelinor, I'm trying as hard as possible for non-persistent changes; I want to be able to deactivate my mod, at any time, no questions asked, without there being any lingering effects. That said, a container certainly does that, as long as my mod adds it, or at least all items within it are mod added.

Anyone know off hand if you change a form list with an NVSE function, then change that same form list with AddFormToFormList, if all the changes are saved, or if it's still only the chnages from AFTFL? I'm not trying to be lazy here, really, just have my hands full with trying out all sorts of things and would love if someone already knew.

Edit - Wound up just doing this:
if ListGetCount NVCompanionWeapons	label 0	ListRemoveNth NVCompanionWeapons 0	if ListGetCount NVCompanionWeapons		goto 0	endifendif


Queue
User avatar
YO MAma
 
Posts: 3321
Joined: Thu Dec 21, 2006 8:24 am

Post » Fri Jun 17, 2011 3:41 am

Anyone know off hand if you change a form list with an NVSE function, then change that same form list with AddFormToFormList, if all the changes are saved


I don't know offhand, but I bloody hope it doesn't :)
I use both functions, but on different formlists.

I did find that formlists do persist between savegame loads though.
So I've got quite a few empty formlists that are populated once within a GetGameRestarted block.

The NVSE functions allow you to add duplicate items. *If* they were to get saved then any duplicates are removed when the savegame is loaded, so it won't grow indefinitly.

I use a similar method for listclear too.
Label 1if ListGetCount TunaSCTmp ListRemoveNth TunaSCTmp 0 Goto 1endif

User avatar
Gen Daley
 
Posts: 3315
Joined: Sat Jul 08, 2006 3:36 pm

Post » Fri Jun 17, 2011 10:24 am

I did find that formlists do persist between savegame loads though.

Is that true regardless of if you use the non-NVSE or NVSE functions?

Regardless, that'll let me chop my form list code off into a quest stage script that I'll only fire once, like my item renames.

I have one single script that's now, essentially, thousands of lines of codes, because I also call quest stage scripts (rarely, but still...). Quest stage scripts really make good function surrogates, though passing them variables is a bit bulky, so I've been mainly giving them work that doesn't require local variables.

Queue
User avatar
kyle pinchen
 
Posts: 3475
Joined: Thu May 17, 2007 9:01 pm

Post » Fri Jun 17, 2011 1:30 am

schlangster, you seem to use quest stage scripts a lot; declaring local variables in them has never given you trouble right? Just wanted to double-check with someone who has worked them hard that there's no issue like dialog result scripts before I start declaring local variables in them.

Queue
User avatar
Far'ed K.G.h.m
 
Posts: 3464
Joined: Sat Jul 14, 2007 11:03 pm

Post » Fri Jun 17, 2011 10:56 am

Is that true regardless of if you use the non-NVSE or NVSE functions?


I've not checked that with non-NVSE functions. I wouldn't hazard a guess.
I like to use the NVSE functions where I can.

I've put in quite a few 'belt & braces' checks regarding the formlists.
ie. the one that uses AFTFL gets built within an OnLoad block.
It's only because that block doesn't fire on a savegame load that I had to store it in the savegame.
It varies depending on the current cell, so gets a 'Listclear' before rebuilding.

I have one single script that's now, essentially, thousands of lines of codes, because I also call quest stage scripts (rarely, but still...). Quest stage scripts really make good function surrogates, though passing them variables is a bit bulky, so I've been mainly giving them work that doesn't require local variables.


Yep, I do the same for procedural type functions in Sortomatic.
For code that is more like a proper function call, I use a secondary object 'ref rHI' with the TunaSCHIScr script.
This gets called from other scripts using the vars in a quest for the function number and parameters.
set TunaSCVRQ.iFunc to 2rHI.Activate rHI 1


EDIT:
You ninja'd me, but not hard to do when I have to stop and change nappies :)
There's is a thread on here somewhere about some wierdness with vars in quest stages - which is why I did it as above.
I can't place it now. Where's David Allen when you need him?

EDIT2:
nvm, think you've seen the thread I was thinking of anyway.
http://www.gamesas.com/index.php?/topic/1170296-issues-with-variables-in-dialogue-result-scripts/
User avatar
Britta Gronkowski
 
Posts: 3475
Joined: Mon Apr 09, 2007 3:14 pm

Post » Fri Jun 17, 2011 12:16 am

schlangster, you seem to use quest stage scripts a lot; declaring local variables in them has never given you trouble right? Just wanted to double-check with someone who has worked them hard that there's no issue like dialog result scripts before I start declaring local variables in them.

No, I never had any issues with local variables in quest stage scripts.

Edit: Until now :D

There's an incompatibility between Arwen's MedTec esp and Project Nevada, which causes a crash that looks like an infinite loop if both mods are loaded together. On side of the MedTek module, the crash happens because it attaches a script to the player. If that script is removed, everything is fine. I made a workaround, which would use setScript to attach the script, but I think Arwen did some testing on that patch and the script did no longer work as intended when attaching it like that.

Anyway, so I was curious which part of PN causes the hang. After disabling all features, it would happen when the visor overlays are enabled. And in there, it was the call of a stage function:

; Remove all effects; Local Varsshort iref effectprintToConsole "p0"set i to 0printToConsole "p1 %.0f" ilabel 1if i < PNxCVisorVisionEffectCount	set effect to listGetNthForm PNxCVisorVisionEffectsISFXList i		; Remove Effect	if effect != 0		if IsImageSpaceActive effect == 1			rimod effect		endif	endif	set i to i + 1printToConsole "p2 %.0f" i	;goto 1 ; commented out because otherwise it would crashendifprintToConsole "p4"setUIFloat "HUDMainMenu\_PNxVisorColorRed" 1.0setUIFloat "HUDMainMenu\_PNxVisorColorGreen" 1.0setUIFloat "HUDMainMenu\_PNxVisorColorBlue" 1.0


After commenting out the goto 1, the crash is gone, so that's where the infinite loop was happening. The lines that are printed to the console are p0 and p4. p1 and p2, which should contain i, are omitted, and I guess the same happens to i++. For some reason i seems to be corrupted when the script is attached to the player.
I don't this this is the only stage function this happens to, merely the first I discovered. Oh, and the player script for reference:
scn ArwenWeaponInjuryScript ; NV Med-Tec Module, version 1.9 - by Arwen;object script ; updated 03/10/11, To test scripted values/modifiers: printc "TimeScale is: %g" TimeScale;ArwenArmorLevel global, set in Health script: from 0 to 9: ;0AR:0AL; 6AR:1AL; 12AR:2AL; 18AR:3AL; 24AR:4AL; 30AR:5AL; 36AR:6AL; 42AR:7AL; 48AR:8AL; 54AR(and up):9ALBegin OnHitWith ArwenBulletWeapons	if ArwenMedTecOn		set ArwenWoundLevel to ArwenWoundLevel + (1.0 - ArwenArmorLevel/15) ; AL9=0.25, AL2=0.83, AL0=1.0		;set ArwenBulletLevel to ArwenBulletLevel + (1.6 - ArwenArmorLevel/7) ; AL9=0.31, AL2=1.30 AL0=1.6		showmessage ArwenInjuredMessage ArwenWoundLevel ArwenBloodLost ArwenTraumaLevel ArwenBurnLevel ArwenInfectionLevel	endifEndBegin OnHitWith ArwenCuttingWeapons	if ArwenMedTecOn		set ArwenWoundLevel to ArwenWoundLevel + (1.2 - ArwenArmorLevel/9) ; AL9=0.2, AL2=0.98 AL0=1.2		showmessage ArwenInjuredMessage ArwenWoundLevel ArwenBloodLost ArwenTraumaLevel ArwenBurnLevel ArwenInfectionLevel	endifEndBegin OnHitWith ArwenBurnWeapons	if ArwenMedTecOn		set ArwenBurnLevel to ArwenBurnLevel + (1.2 - ArwenArmorLevel/9) ; AL9=0.2, AL2=0.98 AL0=1.2		showmessage ArwenInjuredMessage ArwenWoundLevel ArwenBloodLost ArwenTraumaLevel ArwenBurnLevel ArwenInfectionLevel	endifEndBegin OnHitWith ArwenSevereBurnWeapons	if ArwenMedTecOn		set ArwenBurnLevel to ArwenBurnLevel + (1.4 - ArwenArmorLevel/8) ; AL9=0.275, AL2=1.15 AL0=1.4		showmessage ArwenInjuredMessage ArwenWoundLevel ArwenBloodLost ArwenTraumaLevel ArwenBurnLevel ArwenInfectionLevel	endifEndBegin OnHitWith ArwenTraumaWeapons	if ArwenMedTecOn		set ArwenTraumaLevel to ArwenTraumaLevel + (1.3 - ArwenArmorLevel/7) ; AL9=0.14, AL2=1.0 AL0=1.3		showmessage ArwenInjuredMessage ArwenWoundLevel ArwenBloodLost ArwenTraumaLevel ArwenBurnLevel ArwenInfectionLevel	endifEnd

User avatar
Kat Lehmann
 
Posts: 3409
Joined: Tue Jun 27, 2006 6:24 am


Return to Fallout: New Vegas