icecreamassassin Posted July 6, 2015 Share Posted July 6, 2015 so I have the following script which is working great other than one small section. The script sorts through all items in a container, and sorts them to containers based on spell tome, note, journal, scroll, and then by alphabet. It also should be doing skill books but I can't seem to structure a conditional that works. The one I have written in the script and commented out, does not work, and passes all items as skill books which weren't properly sorted in the earlier conditionals. The problem as I see it is that the polling for GetSkill() returns an INT rather than a form or string and INT's can't have a NONE check. I changed the NONE value to a >= 0 but the GetSkill() function always seems to return a positive value instead of a -1 which I would expect it to do for books which have no skill attached. Any help is much appreciated. Event OnActivate(ObjectReference akActionRef) If AkActionRef == Game.GetPlayer() Debug.Notification("Book Sorting Begun") While BookReturn.GetNthForm(0) != None CurBook = BookReturn.GetNthForm(0) as book NameCheck = GetNthChar(CurBook.GetName(),0) Spell MySpell = CurBook.GetSpell() ; Int MySkill = CurBook.GetSkill() If CurBook.HasKeyword(VendorItemNote) BookReturn.RemoveItem(CurBook, 1, False, NoteStore) Debug.notification("Note placed") ElseIf CurBook.HasKeyword(VendorItemJournal) BookReturn.RemoveItem(CurBook, 1, False, JournalStore) Debug.notification("Journal placed") ElseIf CurBook.HasKeyword(VendorItemScroll) BookReturn.RemoveItem(CurBook, 1, False, ScrollStore) Debug.notification("Scroll placed") ElseIf CurBook.GetSpell() != NONE BookReturn.RemoveItem(CurBook, 1, False, SpellShelf) Debug.notification("Spellbook placed") ; Elseif CurBook.GetSkill() != NONE ; BookReturn.RemoveItem(CurBook, 1, False, SkillShelf) ; Debug.notification("Skillbook placed") Elseif (NameCheck == "1") || (NameCheck == "2") || (NameCheck == "3") || (NameCheck == "4") || (NameCheck == "5") || (NameCheck == "6") || (NameCheck == "7") || (NameCheck == "8") || (NameCheck == "9") || (NameCheck == "0") BookReturn.RemoveItem(CurBook, 1, False, NumShelf) Debug.notification("A to G placed") Elseif (NameCheck == "A") || (NameCheck == "B") || (NameCheck == "C") || (NameCheck == "D") || (NameCheck == "E") || (NameCheck == "F") || (NameCheck == "G") BookReturn.RemoveItem(CurBook, 1, False, AGShelf) Debug.notification("A to G placed") Elseif (NameCheck == "H") || (NameCheck == "I") || (NameCheck == "J") || (NameCheck == "K") || (NameCheck == "L") BookReturn.RemoveItem(CurBook, 1, False, HLShelf) Debug.notification("H to L placed") Elseif (NameCheck == "M") || (NameCheck == "N") || (NameCheck == "O") || (NameCheck == "P") || (NameCheck == "Q") || (NameCheck == "R") BookReturn.RemoveItem(CurBook, 1, False, MRShelf) Debug.notification("M to R placed") Elseif (NameCheck == "S") || (NameCheck == "T") || (NameCheck == "U") || (NameCheck == "V") || (NameCheck == "W") || (NameCheck == "X") || (NameCheck == "Y") || (NameCheck == "Z") BookReturn.RemoveItem(CurBook, 1, False, SZShelf) Debug.notification("S to Z placed") Else BookReturn.RemoveItem(CurBook, 1, True, TransferBox) Debug.notification("Reject placed placed") EndIf EndWhile TransferBox.RemoveAllItems(akTransferTo = BookReturn) Debug.Notification("All Done Sorting") EndIf EndEvent Link to comment Share on other sites More sharing options...
Mattiewagg Posted July 6, 2015 Share Posted July 6, 2015 Well it returns 0 if it's aggression, so that's clearly not what you're looking for. Try None. Link to comment Share on other sites More sharing options...
icecreamassassin Posted July 6, 2015 Author Share Posted July 6, 2015 yeah, as I mention above, INT cannot check for a NONE return value, it has to be an integer I thought that -1 was a viable return value for INT values that are polled and not found, but it doesn't seem to work that way Link to comment Share on other sites More sharing options...
sLoPpYdOtBiGhOlE Posted July 7, 2015 Share Posted July 7, 2015 Maybe go through the skill books in CK and see what type of skills they offer.Then you can get an idea of the range to ignore for return. Looking at the Actor Value IDs which are the values that GetSkill returns (range from 0 to 163): 114 OneHandedSkillAdvance 115 TwoHandedSkillAdvance 116 MarksmanSkillAdvance 117 BlockSkillAdvance 118 SmithingSkillAdvance 119 HeavyArmorSkillAdvance 120 LightArmorSkillAdvance 121 PickPocketSkillAdvance 122 LockPickingSkillAdvance 123 SneakSkillAdvance 124 AlchemySkillAdvance 125 SpeechcraftSkillAdvance 126 AlterationSkillAdvance 127 ConjurationSkillAdvance 128 DestructionSkillAdvance 129 IllusionSkillAdvance 130 RestorationSkillAdvance 131 EnchantingSkillAdvanceThis range would cover generic skill book increases (I think, not sure, I should say I haven't tested the values).So for example you could say anything outside this range is not a skill book.eg: If MySkill > 113 && MySkill < 132 ;I'm a skill book EndIfJust a thought on how you can tackle it.As I say I'm unsure of what skill books use for upping the skill and the above is just assumption mainly. Ways you test the value returns for skill books so you can find the values that actual skill books return so you can find range to work with. Write test script and fire it at the QASkillBookContainer to loop through each book and log the the return.This wouldn't take much to do and it'll give you what each skill book value returns.Then from there you have a range of returns you can use as a filter in your actual container sorting script. Link to comment Share on other sites More sharing options...
sLoPpYdOtBiGhOlE Posted July 7, 2015 Share Posted July 7, 2015 Well it got me intrigued so I wrote a test script and logged the returns of the QASkillBookContainer.here you go: [07/07/2015 - 11:57:40AM] ========= Start QASkillBookContainer Get Skill Book Actor Value ID ========= [07/07/2015 - 11:57:41AM] QA Current Skill Book Name = Battle of Sancre Tor | CurBook.GetSkill() = 7 [07/07/2015 - 11:57:41AM] QA Current Skill Book Name = Song Of Hrormir | CurBook.GetSkill() = 7 [07/07/2015 - 11:57:41AM] QA Current Skill Book Name = King | CurBook.GetSkill() = 7 [07/07/2015 - 11:57:41AM] QA Current Skill Book Name = The Legendary Sancre Tor | CurBook.GetSkill() = 7 [07/07/2015 - 11:57:41AM] QA Current Skill Book Name = Words and Philosophy | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:41AM] QA Current Skill Book Name = Biography of the Wolf Queen | CurBook.GetSkill() = 17 [07/07/2015 - 11:57:41AM] QA Current Skill Book Name = The Buying Game | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:41AM] QA Current Skill Book Name = 2920, Second Seed, v5 | CurBook.GetSkill() = 17 [07/07/2015 - 11:57:41AM] QA Current Skill Book Name = A Dance in Fire, v7 | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:42AM] QA Current Skill Book Name = A Dance in Fire, v6 | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:42AM] QA Current Skill Book Name = The Red Kitchen Reader | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:42AM] QA Current Skill Book Name = Legend of Krately House | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:42AM] QA Current Skill Book Name = Sacred Witness | CurBook.GetSkill() = 15 [07/07/2015 - 11:57:42AM] QA Current Skill Book Name = 2920, Last Seed, v8 | CurBook.GetSkill() = 15 [07/07/2015 - 11:57:42AM] QA Current Skill Book Name = Three Thieves | CurBook.GetSkill() = 15 [07/07/2015 - 11:57:42AM] QA Current Skill Book Name = Heavy Armor Forging | CurBook.GetSkill() = 10 [07/07/2015 - 11:57:42AM] QA Current Skill Book Name = Cherim's Heart | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:42AM] QA Current Skill Book Name = Light Armor Forging | CurBook.GetSkill() = 10 [07/07/2015 - 11:57:43AM] QA Current Skill Book Name = Last Scabbard of Akrash | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:43AM] QA Current Skill Book Name = The Armorer's Challenge | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:43AM] QA Current Skill Book Name = Mystery of Talara, v2 | CurBook.GetSkill() = 22 [07/07/2015 - 11:57:43AM] QA Current Skill Book Name = 2920, Rain's Hand, v4 | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:43AM] QA Current Skill Book Name = The Exodus | CurBook.GetSkill() = 22 [07/07/2015 - 11:57:43AM] QA Current Skill Book Name = Racial Phylogeny | CurBook.GetSkill() = 22 [07/07/2015 - 11:57:43AM] QA Current Skill Book Name = Withershins | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:44AM] QA Current Skill Book Name = Guide to Better Thieving | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:44AM] QA Current Skill Book Name = Beggar | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:44AM] QA Current Skill Book Name = Aevar Stone-Singer | CurBook.GetSkill() = 13 [07/07/2015 - 11:57:44AM] QA Current Skill Book Name = Thief | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:44AM] QA Current Skill Book Name = Purloined Shadows | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:44AM] QA Current Skill Book Name = Mace Etiquette | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:44AM] QA Current Skill Book Name = Night Falls on Sentinel | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:44AM] QA Current Skill Book Name = Fire and Darkness | CurBook.GetSkill() = 6 [07/07/2015 - 11:57:45AM] QA Current Skill Book Name = 2920, Morning Star, v1 | CurBook.GetSkill() = 6 [07/07/2015 - 11:57:45AM] QA Current Skill Book Name = The Importance of Where | CurBook.GetSkill() = 6 [07/07/2015 - 11:57:45AM] QA Current Skill Book Name = The Black Arrow, v2 | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:45AM] QA Current Skill Book Name = Father Of The Niben | CurBook.GetSkill() = 8 [07/07/2015 - 11:57:45AM] QA Current Skill Book Name = Vernaccus and Bourlor | CurBook.GetSkill() = 8 [07/07/2015 - 11:57:45AM] QA Current Skill Book Name = The Marksmanship Lesson | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:45AM] QA Current Skill Book Name = The Gold Ribbon of Merit | CurBook.GetSkill() = 8 [07/07/2015 - 11:57:45AM] QA Current Skill Book Name = Surfeit of Thieves | CurBook.GetSkill() = 14 [07/07/2015 - 11:57:46AM] QA Current Skill Book Name = Advances in Lockpicking | CurBook.GetSkill() = 14 [07/07/2015 - 11:57:46AM] QA Current Skill Book Name = Proper Lock Design | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:46AM] QA Current Skill Book Name = The Wolf Queen, v1 | CurBook.GetSkill() = 14 [07/07/2015 - 11:57:46AM] QA Current Skill Book Name = The Locked Room | CurBook.GetSkill() = 14 [07/07/2015 - 11:57:46AM] QA Current Skill Book Name = Rislav The Righteous | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:46AM] QA Current Skill Book Name = The Refugees | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:46AM] QA Current Skill Book Name = Jornibret's Last Dance | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:47AM] QA Current Skill Book Name = Ice and Chitin | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:47AM] QA Current Skill Book Name = The Rear Guard | CurBook.GetSkill() = 12 [07/07/2015 - 11:57:47AM] QA Current Skill Book Name = Mystery of Talara, v4 | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:47AM] QA Current Skill Book Name = Before the Ages of Man | CurBook.GetSkill() = 21 [07/07/2015 - 11:57:47AM] QA Current Skill Book Name = The Black Arts On Trial | CurBook.GetSkill() = 21 [07/07/2015 - 11:57:47AM] QA Current Skill Book Name = 2920, Sun's Dawn, v2 | CurBook.GetSkill() = 21 [07/07/2015 - 11:57:48AM] QA Current Skill Book Name = Incident at Necrom | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:48AM] QA Current Skill Book Name = The Knights of the Nine | CurBook.GetSkill() = 11 [07/07/2015 - 11:57:48AM] QA Current Skill Book Name = Orsinium and the Orcs | CurBook.GetSkill() = 11 [07/07/2015 - 11:57:48AM] QA Current Skill Book Name = Chimarvamidium | CurBook.GetSkill() = 11 [07/07/2015 - 11:57:48AM] QA Current Skill Book Name = 2920, MidYear, v6 | CurBook.GetSkill() = 11 [07/07/2015 - 11:57:48AM] QA Current Skill Book Name = Hallgerd's Tale | CurBook.GetSkill() = 11 [07/07/2015 - 11:57:48AM] QA Current Skill Book Name = Catalogue of Armor Enchantments | CurBook.GetSkill() = 23 [07/07/2015 - 11:57:48AM] QA Current Skill Book Name = Catalogue of Weapon Enchantments | CurBook.GetSkill() = 23 [07/07/2015 - 11:57:49AM] QA Current Skill Book Name = Twin Secrets | CurBook.GetSkill() = 23 [07/07/2015 - 11:57:49AM] QA Current Skill Book Name = A Tragedy in Black | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:49AM] QA Current Skill Book Name = Enchanter's Primer | CurBook.GetSkill() = 23 [07/07/2015 - 11:57:49AM] QA Current Skill Book Name = Mystery of Talara, v3 | CurBook.GetSkill() = 20 [07/07/2015 - 11:57:49AM] QA Current Skill Book Name = The Art of War Magic | CurBook.GetSkill() = 20 [07/07/2015 - 11:57:49AM] QA Current Skill Book Name = A Hypothetical Treachery | CurBook.GetSkill() = 20 [07/07/2015 - 11:57:50AM] QA Current Skill Book Name = Response to Bero's Speech | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:50AM] QA Current Skill Book Name = Horror of Castle Xyr | CurBook.GetSkill() = 20 [07/07/2015 - 11:57:50AM] QA Current Skill Book Name = The Warrior's Charge | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:50AM] QA Current Skill Book Name = 2920, Frostfall, v10 | CurBook.GetSkill() = 19 [07/07/2015 - 11:57:50AM] QA Current Skill Book Name = 2920, Hearth Fire, v9 | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:50AM] QA Current Skill Book Name = Liminal Bridges | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:50AM] QA Current Skill Book Name = The Doors of Oblivion | CurBook.GetSkill() = 19 [07/07/2015 - 11:57:51AM] QA Current Skill Book Name = Battle of Red Mountain | CurBook.GetSkill() = 9 [07/07/2015 - 11:57:51AM] QA Current Skill Book Name = Warrior | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:51AM] QA Current Skill Book Name = A Dance in Fire, v2 | CurBook.GetSkill() = 9 [07/07/2015 - 11:57:51AM] QA Current Skill Book Name = The Mirror | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:51AM] QA Current Skill Book Name = Death Blow of Abernanit | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:51AM] QA Current Skill Book Name = The Lunar Lorkhan | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:51AM] QA Current Skill Book Name = Reality & Other Falsehoods | CurBook.GetSkill() = 18 [07/07/2015 - 11:57:52AM] QA Current Skill Book Name = Sithis | CurBook.GetSkill() = 18 [07/07/2015 - 11:57:52AM] QA Current Skill Book Name = Breathing Water | CurBook.GetSkill() = 18 [07/07/2015 - 11:57:52AM] QA Current Skill Book Name = Daughter of the Niben | CurBook.GetSkill() = 18 [07/07/2015 - 11:57:52AM] QA Current Skill Book Name = Herbalist's Guide to Skyrim | CurBook.GetSkill() = 16 [07/07/2015 - 11:57:52AM] QA Current Skill Book Name = De Rerum Dirennis | CurBook.GetSkill() = 16 [07/07/2015 - 11:57:52AM] QA Current Skill Book Name = Song of the Alchemists | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:52AM] QA Current Skill Book Name = Mannimarco, King of Worms | CurBook.GetSkill() = 16 [07/07/2015 - 11:57:53AM] QA Current Skill Book Name = A Game at Dinner | CurBook.GetSkill() = 0 [07/07/2015 - 11:57:53AM] ========= End QASkillBookContainer Get Skill Book Actor Value ID =========90 books in the container, but at least it gives you an idea of the base skyrim skill book returns But to be truthful I don't think that GetSkill() is accurate at all with books.For example the book "The Mirror" returns 0 (aggression) yet it should return 9 (Block)There are many of the skill books return 0 and they should not be returning 0. Leads me to believe that GetSkill() is not trustworthy for what your trying to do. Link to comment Share on other sites More sharing options...
icecreamassassin Posted July 7, 2015 Author Share Posted July 7, 2015 yeah I don't think it will be viable. I probably will just have to submit to allow the books to sort into their alphabetical cabinets with the rest of the books. Oh well. I'll keep fiddling with it and hoping that someone knows a way to poll for if a book provides a skill bonus or not. Thanks a bunch for trying :) Link to comment Share on other sites More sharing options...
sLoPpYdOtBiGhOlE Posted July 7, 2015 Share Posted July 7, 2015 Easy way, but not dynamic (in other words doesn't cater for custom skill books). Basically in CK drop all the skillbooks in to a formlist.In your script useIf SkillBookFormlist.HasForm(CurBook) ;yep I'm a native skill bookEndIf To accomodate SkillBooks from other official DLC's and not require your mod to use the DLC.Then open the DLC in CK, get the form id's of the skill books. Then in your script you do onload or whatever event you find suitable use Game.GetFromFile(0x00XXXXXX, "DLCName.esX") for each of those dlc forms and add them to your Skillbook formlist. This way your filter can accommodate for DLC skill books if the user has the DLC loaded.Bit of effort and not so dynamic, but it's an option. It's like 95%+ that you want to do in skyrim is a bloody workaround.Due to the constant inconsistent crap that should work correctly on paper, but no..Write another bloated workaround instead because of inconstant unknowns. Link to comment Share on other sites More sharing options...
icecreamassassin Posted July 7, 2015 Author Share Posted July 7, 2015 yep, I know this feeling all too well lol, the whole "cloak ability" system just to register when you hit someone it utterly ridiculous; 3 magic effects, 3 spell abilities and 2 scripts just to dynamically track when you smack someone.... such crap, and don't even get me started on altering existing merchant setups dynamically... uhhggg Bethesda really needed to rethink a few things. Papyrus is versatile in some ways but there are some basic functions that oblivion handled so much more elegantly it's not even funny. Thanks again for the suggestions, I'll probably just go ahead and let the skill books sort to the alphabet shelves instead. A bit disappointing, but not worth hassling over. Link to comment Share on other sites More sharing options...
Recommended Posts