Self Contained New item creation (Done within the script for

Post » Tue Jun 19, 2012 1:02 pm

OK, I've been trying to make an object whose script functions must be called to create a new one, thus making the creation of the object completely private and something you just don't do from another script with PlaceAtMe.

Simplified example:

Scriptname MyPrivateType extends ObjectReferenceMyPrivateType Property NextItem AutoMyPrivateType Property PrevItem AutoGlobalVariableScript Property Gvar Auto ; Variables and Global reference used to store the items is here.MyPrivateType Function NewItem()   MyPrivateType ItemHere   If Gvar.ItemList	  ItemHere = Gvar.ItemList.PlaceAtme(Gvar.PrivateTypeForm,1)	  ItemHere.NextItem = Gvar.ItemList	  Gvar.ItemList.PrevItem = ItemHere   Endif   Gvar.ItemList = ItemHere   return ItemHereendFunction

All the other script needs to have is:

MyPrivateType LocalNameLocalName = LocalName.NewItem(); Do stuff to NewItem - making one is handled internally

Why can't you call the NewItem() function from the variable and get an item? Even if NewItem's value is "none" it is still a variable of type MyPrivateType. I don't get a compiler complaint, it should be calling the function, but it isn't. It seems incredibly dumb if you have to create a new item, outside the item script, just so you can call the function to create a new item, and then delete the one you created just to call the function that one time.
User avatar
Amanda Furtado
 
Posts: 3454
Joined: Fri Dec 15, 2006 4:22 pm

Post » Tue Jun 19, 2012 9:38 pm

Well dang, no matter how I twist and squirm, I can't get a self-contained reference...guess I'll have to give up on that and have every single use of the thing I'm working on create an instance to "Prime the pump" and get the data structures going.

Oh, has anyone figured out a way to assign a display name (what the player sees when he puts his cursor over the item) within a script? I'm doing some debugging, and I'd like to name the items "Item01", "Item02", "Item03" and so on as the script creates them...
User avatar
Nuno Castro
 
Posts: 3414
Joined: Sat Oct 13, 2007 1:40 am


Return to V - Skyrim