Scripting Help: Cycling through a form list

Post » Wed Jun 20, 2012 4:49 am

Here's the script in question. Fairly simple, the form lists however are generated on the fly with SkyProc. That's unrelated to my issue, though, as that all works properly. :P

It appears that it's not recognizing the GetAt command referencing the form list. My gut feeling is that it's a really simple fix, but I'm at a loss. Too spoiled by modern IDE's. :P Thanks for any help here.

Edit: Forgot to add what it's intended to do. It's tied in with my increased spawns scripts, which basically, SkyProc creates form lists of all the factions attached to the base NPC, and attaches this to a duplicate NPC with a clean up script. Since some NPC's template to others, I had to rig up faction changes so when a silver hand spawn spawns a duplicate NPC, which templates to a bandit and doesn't correctly take the silver hand faction, it'll re-add the original factions.

From this, each form list is just intended to add the factions to the NPC this script is attached to.

Error given:
Compiling "cleanUpIS"...d:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\cleanUpIS.psc(28,29): required (...)+ loop did not match anything at input 'factionsFormList'No output generated for cleanUpIS, compilation failed.

Script:
Spoiler

Scriptname cleanUpIS extends Actor  {Clean up script for Increased Spawns.Takes in an integer property for the hours beforedeleting the reference.}import Utilityint property hoursToCleanUp autoFormList property factionsFormList autoEvent OnLoad()	addFactions(self)	cleanUp(self)EndEventFunction cleanUp(Actor arSpawnRef)	Utility.WaitGameTime(hoursToCleanUp)	arSpawnRef.Disable()	arSpawnRef.Delete()endFunctionFunction addFactions(Actor arSpawnRef)	int currentElement = 0	int size = factionsFormList.GetSize()	faction factionForNPC	while (currentElement < size)		factionForNPC = (faction) factionsFormList.GetAt(currentElement)   <----  Error Line		arSpawnRef.AddToFaction(factionForNPC)		currentElement += 1	endWhileendFunction
User avatar
Tyrel
 
Posts: 3304
Joined: Tue Oct 30, 2007 4:52 am

Post » Wed Jun 20, 2012 7:34 am

Yeah, you're head is in the wrong language :smile:
I think you mean...
factionForNPC = factionsFormList.GetAt(currentElement) As faction

Edit: doesn't look like you need the cast here anyway.
User avatar
danni Marchant
 
Posts: 3420
Joined: Sat Oct 07, 2006 2:32 am

Post » Wed Jun 20, 2012 7:06 am

OH.

Yeah, that was simple. *facepalm*

Thanks, appreciate it. Compiled just fine now. :smile:

Edit: Caught that edit just now, I can check it out to see if it works without it. About to test it in-game, now.
User avatar
Lauren Dale
 
Posts: 3491
Joined: Tue Jul 04, 2006 8:57 am


Return to V - Skyrim