batman99000 Posted November 22, 2016 Share Posted November 22, 2016 So I am creating a script to enable/disable objects through message box, and one of my properties are: ObjectReference[] Property ItemsToDisable AutoIs there a simple way to assign a variable to the property? I was hoping I could just put the variable name in front of the property and cal it good, but that obviously didn't work. Any help is greatly appreciated. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted November 22, 2016 Share Posted November 22, 2016 On the object that you attached the script to there is a properties button. If you highlight the script and press the properties button a new window appears. On the new window there will be a list of properties, if you highlight a property the grey area to the right will be populated with various fields depending upon the type of property. Since you are using an array of objectreferences for your property, the size of the array will be dependent upon the number of entries you fill in the Creation Kit (up to 128 as that is the limit for arrays). Link to comment Share on other sites More sharing options...
batman99000 Posted November 22, 2016 Author Share Posted November 22, 2016 I understand that, but I feel that didn't answer my question Say I wanted to assign the variable "int item" to the property, how would I give it that variable? In the end, I want "if this item in the array is disabled, enable it" Link to comment Share on other sites More sharing options...
IsharaMeradin Posted November 22, 2016 Share Posted November 22, 2016 Say I wanted to assign the variable "int item" to the property, how would I give it that variable? You cannot assign an integer to an objectreference. In the end, I want "if this item in the array is disabled, enable it" Int ArraySize = MyArray.Length Int Index = 0 While Index < ArraySize Form Entry = MyArray[Index] If (Entry as ObjectReference).IsDisabled() (Entry as ObjectReference).Enable() EndIf Index += 1 EndWhile Replace MyArray with whatever you are calling your array. Link to comment Share on other sites More sharing options...
batman99000 Posted November 22, 2016 Author Share Posted November 22, 2016 I am sorry, my mistake in wording. I mean, that when selected through the message box, that specific item will get enabled/disabled accordingly. Please forgive my bad choice of words. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted November 22, 2016 Share Posted November 22, 2016 Okay. Lets assume that your index entries on the array match the button entries on the message box. In your event where the message box shows If button == 0 EnableOrDisableArrayObject(button) ElseIf button == 1 EnableOrDisableArrayObject(button) EndIfThe function is placed somewhere in the empty state of the script Function EnableOrDisableArrayObject(Int Index) Form Entry = MyArray[Index] If (Entry as ObjectReference).IsDisabled() (Entry as ObjectReference).Enable() Else (Entry as ObjectReference).Disable() EndIf EndFunctionReplace MyArray with whatever you are calling your array. Link to comment Share on other sites More sharing options...
Recommended Posts