dizietemblesssma Posted March 17, 2021 Share Posted March 17, 2021 I would like users of my mod to be able to write a text file with a list of keywords (comma separated, new line - doesn't matter)that my mod can then create an array or formlist from and use. I've been looking at papyrusutils and also PapyrusINIgetter but it's not clear that they can do what I want.Currently I have added an array of keywords directly to the mod, but this is in response to a request from just one user, if another user wants a different list then no-go!Is this familiar to anyone? Any suggestions? dioziet Link to comment Share on other sites More sharing options...
IsharaMeradin Posted March 17, 2021 Share Posted March 17, 2021 Consider writing a script for SSEEdit? It should theoretically be possible. One of my mods has an SSEEdit script that uses three separate text files to associate different types of keywords with various formlists. But don't ask me how to write such a thing. The base code was written for me and I was guided in making small adjustments that I needed. Each user would have to run it for themselves but you could design the mod such that they'd only need to do so if they have other mods present that yours needs to account for but does not already do so. Link to comment Share on other sites More sharing options...
dylbill Posted March 18, 2021 Share Posted March 18, 2021 You can do this with MiscUtil from PapyrusUtil. It has the function ReadFromFile. I do something similar with my MCM Creator mod. You could tell users to separate keywords with a new line. So the text file would look something like: ActorTypeNPC ActorTypeCreature Then in the script you can do this: Formlist Property MyKeywords Auto Event OnInit() AddKeywordsTolistFromFile(MyKeywords) EndEvent Function AddKeywordsTolistFromFile(Formlist akFormlist) String FileContents = MiscUtil.ReadFromFile("data/Mymod/Keywords.txt") ;get entire contents of file Int I = 0 Int M = StringUtil.GetLength(FileContents) While I < M Int NextLine = StringUtil.Find(FileContents, "\n", I) ;find next line If NextLine == -1 NextLine = M Endif String KeyWordName = StringUtil.Substring(FileContents, I, (NextLine - I)) ;get text of current line Keyword FileKeyword = Keyword.GetKeyword(KeyWordName) If FileKeyword akFormlist.AddForm(FileKeyword) Endif I = (NextLine + 1) ;check next line. EndWhile EndFunction Link to comment Share on other sites More sharing options...
dizietemblesssma Posted March 21, 2021 Author Share Posted March 21, 2021 Thankyou for this, not as complex as I feared:) diziet Link to comment Share on other sites More sharing options...
dylbill Posted March 21, 2021 Share Posted March 21, 2021 No problem :) Link to comment Share on other sites More sharing options...
maxarturo Posted March 22, 2021 Share Posted March 22, 2021 I wonder...? if i can use part of this logic for one of my problems. I haven't dived into it yet, but it's been in my head for around 2 months, and for the moment i'm just processing the idea in my mind. https://forums.nexusmods.com/index.php?/topic/9751998-question-on-keywords-on-other-espsmods-without-having-them-as-dependencies/ If anyone has a bone to throw, i'll be glad to pick it up... Link to comment Share on other sites More sharing options...
dylbill Posted March 22, 2021 Share Posted March 22, 2021 For that, you would need to do some testing. As a simple test, make another esp and make the same keyword in that esp as in your mod. Add the keyword in the extra esp to something and use HasKeyword on it in your mod and see if it returns true. The above I don't think would work because I think the skse function GetKeword would return only 1 keyword form, probably the first it finds in your load order, but I'm just guessing. Also for HasKeyword, I would assume it would only return true for items that have the keyword from your esp, as keywords from another esp, even if they have the same name would have a different formID. Link to comment Share on other sites More sharing options...
maxarturo Posted March 22, 2021 Share Posted March 22, 2021 Yeah... This needs some serious experimenting,! I don't know if this has been done before, but i'm clearly on a completely undiscover terrain. Thanks you for your input. Link to comment Share on other sites More sharing options...
dylbill Posted March 22, 2021 Share Posted March 22, 2021 No problem, good luck :) and post your results when you find out more. Link to comment Share on other sites More sharing options...
dizietemblesssma Posted March 23, 2021 Author Share Posted March 23, 2021 Would this help?https://www.creationkit.com/index.php?title=GetKeyword_-_KeywordI've just found it, I use it to feed a list of strings to a function to find out if any items added by users other mods have certain keywords; mods that aren't dependecnies of my mod. diziet Link to comment Share on other sites More sharing options...
Recommended Posts