danielleonyett Posted October 3, 2015 Share Posted October 3, 2015 (edited) I can't seem to get GetType() to work for me. Can anyone see anything obvious in the following code? Scriptname _0BooksStorage extends ObjectReference FormList Property _0FLSTBooks Auto Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) if ((akBaseItem.GetType() == 27) && (akBaseItem.GetType() != 48)) _0FLSTBooks.AddForm(akBaseItem) endifEndEvent Basically, the use of the GetType() function is to only add books (type 27) to the form list and not notes (type 48).The script compiles just fine and the rest of it works in-game (it's really not that much longer than what's included here). But both books and notes are added to the form list in-game. Edited October 3, 2015 by danielleonyett Link to comment Share on other sites More sharing options...
NorthHare Posted October 4, 2015 Share Posted October 4, 2015 Notes always return as type 27. Not sure if type 48 is unused or refers to something obscure... Maybe you could check the width/height/length of the added item to distinguish between books and notes? Link to comment Share on other sites More sharing options...
danielleonyett Posted October 4, 2015 Author Share Posted October 4, 2015 http://www.creationkit.com/GetType_-_Formsays notes are 48 and books are 27I had thought about differentiating by weight, but that wouldn't necessarily work if a mod adds weight to notes/papers.I had also thought about trying to see the model path to determine if the name of the nif file has "note" in it. But, again, other mods might not use the same naming conventions.Using a size measurement might be the best idea so far. I'll look into that!But it still makes me wonder why this skse function isn't working for me. I've just recently started scripting and I think this is the 1st skse function that I've tried using. So I think I'm going to have to try other skse functions to see if it's an skse problem for me, or if it's just this particular function.thanks! Link to comment Share on other sites More sharing options...
danielleonyett Posted October 4, 2015 Author Share Posted October 4, 2015 hmmm. issues with the width/height/length, I think.I saw at least one journal that had a flat dimension same as all the notes (I think it was height). Link to comment Share on other sites More sharing options...
sLoPpYdOtBiGhOlE Posted October 4, 2015 Share Posted October 4, 2015 (edited) Maybe you could use skse GetWorldModelPath() and stringutil Find.There's only 6 note models types in base skyrim all have the word "note" in the model name.Basically you could use the string "note" to find in the model path, if so then it's a note.eg (compiled fine, but I've not tested it): Scriptname _0BooksStorage extends ObjectReference FormList Property _0FLSTBooks Auto Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) If (akBaseItem As Book) && (StringUtil.Find(akBaseItem.GetWorldModelPath(), "note") < 0) _0FLSTBooks.AddForm(akBaseItem) EndIf EndEventBut that will also filter out Recipes as they also use a note model.Also it doesn't really allow for DLC or Mods that may add new Note Models that may not have the string "note" in the model name/path (haven't checked the vanilla DLCs to see if they add any note models). Edited October 5, 2015 by sLoPpYdOtBiGhOlE Link to comment Share on other sites More sharing options...
danielleonyett Posted October 5, 2015 Author Share Posted October 5, 2015 @sLoPpYdOtBiGhOlEthanks, I mentioned in one of my posts above that mods might not use the same naming conventions for their models.so I don't think it matters how I do it, there will inevitably be a chance that something will slip by.but I'm still puzzled as to why gettype() won't work for me. I have yet to try any other skse functions yet though. if I find that I can't get any of them to work then i'll probably post a new topic! Link to comment Share on other sites More sharing options...
danielleonyett Posted October 5, 2015 Author Share Posted October 5, 2015 @sLoPpYdOtBiGhOlEbtw, thanks for that code, I'll def try it out! Link to comment Share on other sites More sharing options...
Recommended Posts