Questions about arrays

Post » Fri May 17, 2013 9:20 pm

Hey guys I'll use this thread for any questions I have on arrays.

I haven't written one yet but I'm going to soon. I want to write a script I can reuse and wonder if when I fill the properties of my array, if I leave some blank, and only set 1, 2, and 3, will the script fail? Or when it runs through it's while loop will it just skip any I don't fill?

Thanks all :)
User avatar
Latino HeaT
 
Posts: 3402
Joined: Thu Nov 08, 2007 6:21 pm

Post » Fri May 17, 2013 8:10 pm

Empty elements will return None, so simply check with an if statement to make sure it's not None before you start using the element.

User avatar
abi
 
Posts: 3405
Joined: Sat Nov 11, 2006 7:17 am

Post » Fri May 17, 2013 11:16 pm

just check if your array[x] == none then you will be fine

User avatar
Marlo Stanfield
 
Posts: 3432
Joined: Wed May 16, 2007 11:00 pm

Post » Sat May 18, 2013 7:02 am

e.g.

Actor[] Property kActorArray Auto ; Assume element 0 is 'None'Event DoNotCauseScriptError()	If kActorArray[0] ; != None		kActorArray[0].SomeActorFunction() ; Will not run/cause a script error	EndIfEndEventEvent CauseScriptError()	kActorArray[0].SomeActorFunction() ; Will cause a script errorEndEvent
User avatar
tiffany Royal
 
Posts: 3340
Joined: Mon Dec 25, 2006 1:48 pm


Return to V - Skyrim