Aller au contenu

Photo

Is GetDescription bugged when referencing an item?


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1
Jereniva

Jereniva
  • Members
  • 124 messages

I am trying to get the string that is the item description, but I get a blank string when doing GetDescription on an item placed in the inventory of a placeable.  I get the tag correctly, but not description.

Any ideas what I'm doing wrong?

 

Here's On Used on a placeable, and the sDesc is the "Localized Description" text of the placeable.

void main()
{
    string sDesc = GetDescription(OBJECT_SELF);
    SpeakString(sDesc);    
}

Here's OnInventoryDistrubed of a container object

 

The first message prints "Desc ** is destroyed"

The second prints "Tag *in004_gerts_questitem* is destroyed"

void main()

{    
    object oItem = GetInventoryDisturbItem();
    string sDroppedDesc = GetDescription(oItem);
    string sDroppedTag = GetTag(oItem);
    string sOwnerItem = GetLocalString(OBJECT_SELF, "sPersonalItemTag");

    if (sDroppedTag == sOwnerItem)
    {
        DestroyObject(oItem);
        SendMessageToPC(GetFirstPC(), "Desc *" + sDroppedDesc + "* is destroyed");     
        SendMessageToPC(GetFirstPC(), "Tag *" + sDroppedTag + "* is destroyed");     
    }
    
    
}


#2
kevL

kevL
  • Members
  • 4 061 messages

here's the broken bit:

GetDescription
Does not retrieve the default description (original toolset defined description) Only retrieves correct value after SetDescription has been called
Workaround: Assign value as variable, then set in OnSpawn


#3
Dann-J

Dann-J
  • Members
  • 3 161 messages

I suspect GetDescription() is only looking for text stored in the description field. Since any non-custom item will be using a dialog.tlk reference number, there's no actual text being stored in the item description field. Custom items where you enter text into the field should probably return the description properly, as will any item where you've forced custom text into the field via SetDescription().



#4
Jereniva

Jereniva
  • Members
  • 124 messages

Thank you for the answers.

The weird thing is that I created the item from scratch, setting the Localized Description, Localized Description (when identified) and the Name of the item, distinct from the default. 

 

I also tested using SetDescription.

I made a Misc item in the toolset, I set all the descriptions, and also a variable on it, a string sDesc.

I scripted a chest that created the object in the chest at time of opening it, and then set it's Description equal to the value of the variable.

That all worked.

 

But same result with the above script of putting the item in the container and GetDescription returns empty string.

It's not a huge deal, but interesting to discuss!



#5
kevL

kevL
  • Members
  • 4 061 messages

by jove you're right

ran a dozen tests ... looks like GetDescription() for items at least is borked.

I could get a description from a placeable, even just set in the toolset -- though not from a STRREF

i don't think custom creature descriptions were showing up either,