timsterse Posted July 26, 2019 Share Posted July 26, 2019 I'm doing a script that I hope to make more compact. Two things I'm unclear about: 1. objectReference[]I'm setting these properties ObjectReference Property dummyRefDagger Auto ObjectReference Property dummyRefGreatsword Auto ObjectReference Property dummyRefStaff Auto ObjectReference Property dummyRefSword Auto In CK I have to go into the script properties and manually reference them. But I want to use the placed Form (the instance, not the base) and utilize the LinkedRef tab there to set the linked references - avoiding the script properties. How do I iterate though a few linked ref forms? something with .getLinkedRef() I suppose. The script is attached to the base Form (not the instance). 2. Keyword[]Right now I'm setting keywords in the script Keyword Property WeapTypeDagger Auto Keyword Property WeapTypeGreatsword Auto Keyword Property WeapTypeStaff Auto Keyword Property WeapTypeSword Autoand doing a very basic function with a zillion if statements If MountedItem.HasKeyword(WeapTypeSword) debug.notification("sword") ElseIf MountedItem.HasKeyword(WeapTypeStaff) debug.notification("staff") etc... which is bugging me. How will I be able to set these keywords as array so I can just loop though with While()? In the end, I'm thinking I'll loop through the objectReference array and in each statement loop though the keyword array to determine what's what. Link to comment Share on other sites More sharing options...
PeterMartyr Posted July 28, 2019 Share Posted July 28, 2019 I am trying to work out if you are serious? If you can't create an Array, what make you think code for one? This is MAJOR problem with skyrim and why game saves get bloated. Notice no one except me has replied, and I am fairly confident no one going to tell you how. Stick with the Nested If at the moment, it will work fine. Link to comment Share on other sites More sharing options...
foamyesque Posted July 29, 2019 Share Posted July 29, 2019 Hm. I'm not clear on what you're asking in the first question, but in the second, there's nothing wrong with a set of if-elseif statements. It can look kludgey but it's often much clearer about what you're trying to do than, say, trying to remember which array element is a Staff or a Bow or a Sword or whatever. Something I do occasionally do is pair arrays. For example, you could have an array of Keywords and an array of strings. You can then transform from one to the other based on the index of an element: Look up a Keyword's position in the Keyword array, then use that position to pull its name from the string array. Link to comment Share on other sites More sharing options...
Recommended Posts