irswat Posted July 19, 2017 Share Posted July 19, 2017 (edited) there is a notable lack of documentation on skse functions SetName and SetDisplayName. I am trying to help watcherzero with his oblivion artifacts mod. His mod adds like 60 or 70 unique items throughout Tamriel and I thought it might be cool to make it a treasure hunt. I offered to add a dynamic book that lists the items, clues to their location, and "checks" off the items when they are found. To accomplish this I created the book with replacement text <alias=OblivionArtifactRefAlias63>, and a quest with a player alias, an alias for the book (With optional, stores text, and uses stores text checked), and an alias for one of the items (until I can get this working then I will add the rest.)I attached a simple script to the player alias with an addinventoryeventfilter and onitemadded event. The script works perfect as far as detecting the item added to inventory, but the SetDisplayName is not working. I was wondering if you could maybe help me figure out why. I'm trying to rename a ref alias filled with a weapon base object. The ref alias name is supposed to be changed to "[X]" when the item is found. Scriptname OblivionArtifactsAliasFilter extends ReferenceAlias FormList Property OblivionArtifactsItemsFormList Auto ReferenceAlias Property OblivionArtifactRefAlias63 Auto Event OnInit() AddInventoryEventFilter(OblivionArtifactsItemsFormList) debug.MessageBox("Alias script initialized") endEvent Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) int i i=OblivionArtifactsItemsFormList.Find(akBaseItem) if i==0 ;battleaxe of hatred debug.MessageBox("Battleaxe of Hatred Added to Inventory") OblivionArtifactRefAlias63.GetRef().SetDisplayName("[X]") endif endEvent When I added a debug messagebox after SetDisplayName() the displayname is empty, but the item being added to inventory is detected. Any idea? Someone mentioned SetDisplayName() might not work with stores text. Is this true? Is there some other way to accomplish what I'm trying to do if so? Edited July 19, 2017 by irswat Link to comment Share on other sites More sharing options...
foamyesque Posted July 19, 2017 Share Posted July 19, 2017 Trying to manipulate objectreferences inside containers is a real pain, because the game wants to try to convert them to forms, making any functions that require them to be objectreferences to fail with an error thrown to the log. Things that fill Quest Aliases are supposed to be immune to this, I believe. Do you have error logging turned on and, if so, does it tell you anything? Link to comment Share on other sites More sharing options...
irswat Posted July 19, 2017 Author Share Posted July 19, 2017 I hadnt checked papyrus cause I thought I was simply using the function wrong Link to comment Share on other sites More sharing options...
irswat Posted July 21, 2017 Author Share Posted July 21, 2017 (edited) help please? how do I use setdisplayname with refalias and text replacement? Edited July 21, 2017 by irswat Link to comment Share on other sites More sharing options...
TheDungeonDweller Posted July 22, 2017 Share Posted July 22, 2017 Doing a quick search, yes your problem lies with Stores Text. SetDisplayName doesn't work with that checked. More over, there are limitations when it comes to renaming actors. It may work and then it may not, and if the alias is a follower, it might break their dialogue. Link to comment Share on other sites More sharing options...
irswat Posted July 22, 2017 Author Share Posted July 22, 2017 it's an object ref alias not for an actor. Do you think if I uncheck stores text text replacement will still display the "[X]"? Link to comment Share on other sites More sharing options...
irswat Posted July 22, 2017 Author Share Posted July 22, 2017 (edited) I tried creating a dummy object of type MiscItem DummyArtifact1, then instead of using SetDisplayName() using SetName. This does work but the text replacement in the book is still not working. To test I tried with both <BaseName> and <Alias=AliasName). I have tried both checking and unchecking stores text. This is not working and I'm beginning to think this is impossible because text replacement requires the refalias to check stores text, and it seems neither SetName() nor SetDisplayName() work with stores text checked. I know that setname is working because the message box displays "Checklist updated: [X]" Yet in the book there is no "[X]".Does anyone have any ideas on how to accomplish this? Again I'm simply looking to display a check mark or an X next to an item in the book when the item is found. The inventoryeventfilter and onitemadded event work fine, but the stupid text replacement is not working. "Battleaxe of Hatred - Embershard Mine on a shelf. <OblivionDummyArt1> Battleaxe of Hatred - Embershard Mine on a shelf. <Alias=OblivionArtifactRefAlias63>" script: Scriptname OblivionArtifactsAliasFilter extends ReferenceAlias FormList Property OblivionArtifactsItemsFormList Auto ReferenceAlias Property OblivionArtifactRefAlias63 Auto MiscObject Property OblivionDummyArt1 Auto Event OnInit() AddInventoryEventFilter(OblivionArtifactsItemsFormList) debug.MessageBox("Alias script initialized") endEvent Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) int i i=OblivionArtifactsItemsFormList.Find(akBaseItem) if i==0 ;battleaxe of hatred debug.MessageBox("Battleaxe of Hatred Added to Inventory") OblivionDummyArt1.SetName("[X]") debug.MessageBox("checklist updated: " + OblivionDummyArt1.GetName()) endif endEvent Edited July 22, 2017 by irswat Link to comment Share on other sites More sharing options...
IsharaMeradin Posted July 22, 2017 Share Posted July 22, 2017 Why not avoid using a book? You could create a MCM menu page that works like a checklist. Link to comment Share on other sites More sharing options...
foamyesque Posted July 22, 2017 Share Posted July 22, 2017 Just to be sure I have this clear: 1. You have a book, in a quest alias, that is tagged 'use stored text', and is set to use text replacer tags to display various item names.2. You have an item, in a quest alias, that is set to 'stores text'.3. When that item is picked up, you are trying to change the display name, so that it is reflected in the book. I understand that the book is not changing. Does the item's display name change elsewhere? For example, in inventory? Do you have any papyrus errors in the log, like calling SetDisplayName() on a null object? Link to comment Share on other sites More sharing options...
irswat Posted July 22, 2017 Author Share Posted July 22, 2017 Why not avoid using a book? You could create a MCM menu page that works like a checklist.that is the next step. The book was going to be part of a quest, so it was for immersion. Link to comment Share on other sites More sharing options...
Recommended Posts