Arrays and Properties...

Post » Mon Jun 18, 2012 5:09 pm

I've read on the Creation Kit wiki that Papyrus Script allows for the creation of Arrays.

It states that Arrays cannot be variable, but, since for Papyrus Script these are distinct from Properties...this means that Arrays could be Properties?

I clearly remember to have used Array variables in VBA when I wanted to use such matrixes to "load" a lot of data...and usually when at least one dimension wasn't preset.

In this case the idea was much simpler:

I wanted to be able to define the number of items ("x") into a Miscellaneous Items Array from the Spell to which I attached the script and to have x number of items showing up into the Properties list for the spell, which would allow me to make a more universal script for my purpose...


...for example...

...let's say that I created the "iSlots" integer property and then created the "arrContent" Miscellaneous Items array.

...would I be able to set "iSlots" from the attached spell (as any property) and have arrContent[0], arrContent[1], etc...arrContent[x]...show up into the Property list of the linked spell??

...anyone of you guys thinks this is possible?

Thanks,
Jashkar
User avatar
Joe Alvarado
 
Posts: 3467
Joined: Sat Nov 24, 2007 11:13 pm

Post » Mon Jun 18, 2012 9:03 am

Yes, arrays can be properties.

I've been using this when I need to perform the same action on a bunch of objects (in my case, resetting them to their default position when you press a button)

There is a checkbox when you are creating a property - "Array".
User avatar
Marie
 
Posts: 3405
Joined: Thu Jun 29, 2006 12:05 am

Post » Mon Jun 18, 2012 9:40 am

And, btw, arrays are dynamic, the size of the array is stored in "Arrayname.Length".
SO i don't think you would need an iSlots property.
User avatar
Alister Scott
 
Posts: 3441
Joined: Sun Jul 29, 2007 2:56 am

Post » Mon Jun 18, 2012 2:23 pm

Thanks a lot for the clarification, Turn on a Dime...when I read that one couldn't set the dimension of the array as variable I got worried!! ;)
Jashkar
User avatar
Amy Melissa
 
Posts: 3390
Joined: Fri Jun 23, 2006 2:35 pm


Return to V - Skyrim